@@ -, +, @@ patch in koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt line 463 'bulkmarcimport') to protect some field. 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") the field that should have been protected has been overwritten conflict applying the patch), apply the patch and repeat steps 4-5, verify that the field now was protected from being overwritten. <148193449+mkibp@users.noreply.github.com> --- C4/Biblio.pm | 6 +----- misc/migration_tools/bulkmarcimport.pl | 13 +------------ 2 files changed, 2 insertions(+), 17 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -190,9 +190,6 @@ The C<$options> argument is a hashref with additional parameters: =over 4 -=item B -Used when ModBiblioMarc is handled by the caller - =item B Used when the indexing scheduling will be handled by the caller @@ -211,7 +208,6 @@ sub AddBiblio { $options //= {}; my $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) { @@ -297,7 +293,7 @@ sub AddBiblio { } # now add the record, don't index while we are in the transaction though - ModBiblioMarc( $record, $biblionumber, { skip_record_index => 1 } ) unless $defer_marc_save; + ModBiblioMarc( $record, $biblionumber, { skip_record_index => 1 } ); # update OAI-PMH sets if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { --- a/misc/migration_tools/bulkmarcimport.pl +++ a/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}; --