bug 2258 - do not duplicate embedded items
authorGalen Charlton <galen.charlton@liblime.com>
Wed, 18 Jun 2008 19:50:22 +0000 (14:50 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 19 Jun 2008 00:25:07 +0000 (19:25 -0500)
If a MARC bib is modified by this batch job,
do not duplicate the item tags embedded in
it (e.g., 952 for MARC21).  When modifying
a bib record, any embedded item tags must
be removed before calling ModBiblio - perhaps
this should be moved to ModBiblio itself.

Also removed an error in the job's help text.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>

misc/link_bibs_to_authorities.pl

index 1cb0483..9954fd6 100755 (executable)
@@ -85,6 +85,11 @@ sub process_bib {
             print "Bib $biblionumber ($title): $headings_changed headings changed\n";
         }
         if (not $test_only) {
+            # delete any item tags
+            my ($itemtag, $itemsubfield) = GetMarcFromKohaField("items.itemnumber", '');
+            foreach my $field ($bib->field($itemtag)) {
+                $bib->delete_field($field);
+            }
             ModBiblio($bib, $biblionumber, GetFrameworkCode($biblionumber));
             $num_bibs_modified++;
         }
@@ -111,10 +116,6 @@ Parameters:
     --test                  only test the authority linking
                             and report the results; do not
                             change the bib records.
-    --comment <comment>     optional comment to describe
-                            the record batch; if the comment
-                            has spaces in it, surround the
-                            comment with quotation marks.
     --help or -h            show this message.
 _USAGE_
 }