[Koha-bugs] [Bug 32332] bulkmarcimport.pl -insert fails to add MARC field 999

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Nov 25 07:50:55 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32332

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.druart+koha at gmail.
                   |                            |com,
                   |                            |martin.renvoize at ptfs-europe
                   |                            |.com,
                   |                            |nick at bywatersolutions.com

--- Comment #3 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
I am not familiar with this script, but I am wondering: should not we skip to
the next record way before we reach those lines?

Maybe we need a "next" in the "search for a match" block?

iff --git a/misc/migration_tools/bulkmarcimport.pl
b/misc/migration_tools/bulkmarcimport.pl
index d2dfe1ad56a..45a7c94e39c 100755
--- a/misc/migration_tools/bulkmarcimport.pl
+++ b/misc/migration_tools/bulkmarcimport.pl
@@ -349,6 +349,7 @@ RECORD: while (  ) {
                     next;
                 }
             }
+            next if $insert;
         } elsif ( $results && scalar(@$results) > 1 ) {
             $logger->debug("more than one match for $query");
         } else {

But not knowing much this script it's hard to tell if it won't introduce
regressions.

Or, another option, more inline with your diagnostic, could be to 

 diff --git a/misc/migration_tools/bulkmarcimport.pl
b/misc/migration_tools/bulkmarcimport.pl
index d2dfe1ad56a..e95b1fa199e 100755
--- a/misc/migration_tools/bulkmarcimport.pl
+++ b/misc/migration_tools/bulkmarcimport.pl
@@ -480,7 +480,7 @@ RECORD: while (  ) {
             C4::Biblio::_strip_item_fields($clone_record, '');
             # This sets the marc fields if there was an error, and also calls
             # defer_marc_save.
-            ModBiblioMarc( $clone_record, $biblionumber );
+            ModBiblioMarc( $clone_record, $biblionumber ) if $insert;
             if ( $error_adding ) {
                 warn "ERROR: Adding items to bib $biblionumber failed:
$error_adding";
                                printlog({id=>$id||$originalid||$biblionumber,
op=>"insertitem",status=>"ERROR"}) if ($logfile);

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list