@@ -, +, @@ patch 'bulkmarcimport') to protect some field. only be applied on updates so a match condition need to be supplied (for example -match "control-number,001") protected has been overwritten protected and has not been overwritten --- C4/Biblio.pm | 17 +---------------- misc/migration_tools/bulkmarcimport.pl | 13 +------------ 2 files changed, 2 insertions(+), 28 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -187,31 +187,16 @@ The first argument is a C object containing the bib to add, while the second argument is the desired MARC framework code. -This function also accepts a third, optional argument: a hashref -to additional options. The only defined option is C, -which if present and mapped to a true value, causes C -to omit the call to save the MARC in C -This option is provided B -for the use of scripts such as C that may need -to do some manipulation of the MARC record for item parsing before -saving it and which cannot afford the performance hit of saving -the MARC record twice. Consequently, do not use that option -unless you can guarantee that C will be called. - =cut sub AddBiblio { my $record = shift; my $frameworkcode = shift; my $options = @_ ? shift : undef; - my $defer_marc_save = 0; if (!$record) { carp('AddBiblio called with undefined record'); return; } - if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { - $defer_marc_save = 1; - } my $schema = Koha::Database->schema; my ( $biblionumber, $biblioitemnumber ); @@ -292,7 +277,7 @@ sub AddBiblio { } # now add the record - ModBiblioMarc( $record, $biblionumber ) unless $defer_marc_save; + ModBiblioMarc( $record, $biblionumber ); # update OAI-PMH sets if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { --- a/misc/migration_tools/bulkmarcimport.pl +++ a/misc/migration_tools/bulkmarcimport.pl @@ -548,7 +548,7 @@ RECORD: foreach my $record (@{$marc_records}) { } } elsif ($insert) { - eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { defer_marc_save => 1 }) }; + eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework) }; if ($@) { warn "ERROR: Insert biblio $originalid failed: $@\n"; printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile); @@ -570,13 +570,6 @@ RECORD: foreach my $record (@{$marc_records}) { $record_has_added_items = @{$itemnumbers_ref}; my $error_adding = $@; - # 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, $modify_biblio_marc_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); @@ -624,10 +617,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, $modify_biblio_marc_options); next RECORD; } else { --