Bugzilla – Attachment 140992 Details for
Bug 25539
Remove AddBiblio "defer_marc_save" option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25539: Remove AddBiblio option "defer_marc_save"
Bug-25539-Remove-AddBiblio-option-defermarcsave.patch (text/plain), 5.46 KB, created by
David Gustafsson
on 2022-09-26 15:20:44 UTC
(
hide
)
Description:
Bug 25539: Remove AddBiblio option "defer_marc_save"
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2022-09-26 15:20:44 UTC
Size:
5.46 KB
patch
obsolete
>From ef8bdbca432a252a329f2a7074102fdb8fb105cc Mon Sep 17 00:00:00 2001 >From: David Gustafsson <glasklas@gmail.com> >Date: Fri, 12 Nov 2021 23:16:55 +0100 >Subject: [PATCH] Bug 25539: Remove AddBiblio option "defer_marc_save" > >Items are no longer embedded in the MARCXML and because of this the MARC data >does not need to be saved once more after changing record items data. >The "defer_marc_save" is no longer needed since bulkmarcimport.pl was the only >place this option was utilized in order to resave MARC data after possibly changing >items data. There is also a bug bulkmarcimport.pl where the record data is re-saved >without stripping items if duplicate items are found and the dedup barcodes >option is enabled that is resolved by this change. > >This change enables MARC Overlay rules to be enabled for bulkmarkcimport.pl as using >the defer_marc option would previously effectively bypass any defined rules. > >To test >1) Apply patch 29440 (which this depends on), but no not yet apply this > patch >2) Remove comments around "bulkmarcimport: _("bulkmarcimport.pl")," > in koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt > line 463 >3) Enable MARC overlay rules and add a rule (with source => "*" or > 'bulkmarcimport') to protect some field. >4) Import a biblio using the bulkmarcimport script. Overlay rules will > only be applied on updates so a match condition matching the > record in Koha when bulkmarcimport.pl is run the next time for the same > record needs to be supplied (for example -match "control-number,001") >5) Edit the imported biblio and change the value of the protected field >6) Run bulkmarcimport with the same parameters as in 4) and verify the > the field that should have been protected has been overwritten >7) Revert changes for line 463 in marc-overlay-rules.tt (or will result in > conflict applying the patch), apply the patch and repeat steps 4-5, > verify that the field now was protected from being overwritten. >--- > C4/Biblio.pm | 6 +----- > misc/migration_tools/bulkmarcimport.pl | 13 +------------ > 2 files changed, 2 insertions(+), 17 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f24a358838..759d033476 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -188,9 +188,6 @@ The C<$options> argument is a hashref with additional parameters: > > =over 4 > >-=item B<defer_marc_save> >-Used when ModBiblioMarc is handled by the caller >- > =item B<skip_record_index> > Used when the indexing scheduling will be handled by the caller > >@@ -211,7 +208,6 @@ sub AddBiblio { > my $mod_biblio_marc_options = { > skip_record_index => $options->{'skip_record_index'} // 0 > }; >- my $defer_marc_save = $options->{defer_marc_save} // 0; > my $disable_autolink = $options->{disable_autolink} // 0; > > if (!$record) { >@@ -298,7 +294,7 @@ sub AddBiblio { > } > > # now add the record >- ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options ) unless $defer_marc_save; >+ ModBiblioMarc( $record, $biblionumber, $mod_biblio_marc_options ); > > # update OAI-PMH sets > if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index 417b6b27c6..53b5d59548 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -542,7 +542,7 @@ RECORD: foreach my $record (@{$marc_records}) { > } > } > elsif ($insert) { >- eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { disable_autolink => 1, defer_marc_save => 1 }) }; >+ eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { disable_autolink => 1 }) }; > if ($@) { > warn "ERROR: Insert biblio $originalid failed: $@\n"; > printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile); >@@ -564,13 +564,6 @@ RECORD: foreach my $record (@{$marc_records}) { > my $error_adding = $@; > $record_has_added_items = @{$itemnumbers_ref}; > >- # Work on a clone so that if there are real errors, we can maybe >- # fix them up later. >- my $clone_record = $record->clone(); >- C4::Biblio::_strip_item_fields($clone_record, $framework); >- # This sets the marc fields if there was an error, and also calls >- # defer_marc_save. >- ModBiblioMarc($clone_record, $record_id, $mod_biblio_options); > if ($error_adding) { > warn "ERROR: Adding items to bib $record_id failed: $error_adding"; > printlog({ id => $record_id, op => "insert items", status => "ERROR"}) if ($logfile); >@@ -615,10 +608,6 @@ RECORD: foreach my $record (@{$marc_records}) { > printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile); > # if we failed because of an exception, assume that > # the MARC columns in biblioitems were not set. >- >- # @FIXME: Why do we save here without stripping items? Besides, >- # save with stripped items has already been performed >- ModBiblioMarc($record, $record_id, $mod_biblio_options); > next RECORD; > } > $record_has_added_items ||= @{$itemnumbers_ref}; >-- >2.35.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25539
:
105065
|
105066
|
109789
|
110260
|
110261
|
127599
|
127600
|
127601
|
127602
|
127603
|
127976
|
127977
|
127978
|
127979
|
127980
|
127981
|
133030
|
133031
|
133032
|
133034
|
133035
|
133036
|
140992
|
140993
|
140994
|
156224
|
156225
|
156226
|
160158
|
160159
|
160160
|
160489
|
160490
|
160491