From 98180ac0a16fc0e5296b8138cfae0a2bb9dc76c6 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 3 Jan 2008 12:36:43 -0600 Subject: [PATCH] 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 --- C4/ImportBatch.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); } -- 2.39.5