From: Galen Charlton Date: Thu, 3 Jan 2008 18:36:43 +0000 (-0600) Subject: batch import: do not ersatz MARC item fields X-Git-Tag: v3.00.00-alpha~68 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;ds=sidebyside;h=98180ac0a16fc0e5296b8138cfae0a2bb9dc76c6;p=koha-ffzg.git batch import: do not ersatz MARC item fields Batch import was not removing item fields (e.g., 952 or 995) from MARC records. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 764b8bd882..ca2378a994 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -458,7 +458,15 @@ sub BatchCommitBibRecords { if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'imported') { $num_ignored++; } + my $marc_record = MARC::Record->new_from_usmarc($rowref->{'marc'}); + + # remove any item tags - rely on BatchCommitItems + my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",''); + foreach my $item_field ($marc_record->field($item_tag)) { + $marc_record->delete_field($item_field); + } + if ($overlay_action eq 'create_new' or ($overlay_action eq 'replace' and $rowref->{'overlay_status'} eq 'no_match')) { $num_added++; @@ -479,7 +487,6 @@ sub BatchCommitBibRecords { # remove item fields so that they don't get # added again if record is reverted my $old_marc = MARC::Record->new_from_xml($oldxml, 'UTF-8', $rowref->{'encoding'}); - my ($item_tag,$item_subfield) = &GetMarcFromKohaField("items.itemnumber",''); foreach my $item_field ($old_marc->field($item_tag)) { $old_marc->delete_field($item_field); }