koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] patch for multiple subjects


From: Chris Michalak
Subject: [Koha-devel] patch for multiple subjects
Date: Tue Nov 18 00:48:07 2003
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031016

There appears to be a bug in Koha 2.0.0pre4 (and pre5) when handling multiple subjects. The code is designed to handle multiple subjects per biblio (hence the use of an entirely seperate table) but there is a small bug in the code which prevents all but the last subject from being added to the bibliosubject table.

Well actually, to be more accurate all the subjects are added, but all but the last are subsequently deleted. Anyways, instead of going on and on about it, why don't I just give you the simple patch!

Thanks for all the hard work Koha developers.

*** Biblio.pm.bak       2003-11-17 21:45:33.000000000 -0800
--- Biblio.pm   2003-11-17 22:28:56.000000000 -0800
***************
*** 1261,1272 ****
($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject");
        my @subj = $record->field($tagfield);
        foreach my $subject (@subj) {
                my @subjsubfield = $subject->subfield($tagsubfield);
-               my @subjects;
                foreach my $subfieldcount (0..$#subjsubfield) {
                        push @subjects,$subjsubfield[$subfieldcount];
                }
-               OLDmodsubject($dbh,$oldbibnum,1,@subjects);
        }
        # we must add bibnum and bibitemnum in MARC::Record...
        # we build the new field with biblionumber and biblioitemnumber
--- 1261,1272 ----
($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject");
        my @subj = $record->field($tagfield);
+       my @subjects;
        foreach my $subject (@subj) {
                my @subjsubfield = $subject->subfield($tagsubfield);
                foreach my $subfieldcount (0..$#subjsubfield) {
                        push @subjects,$subjsubfield[$subfieldcount];
                }
        }
+       OLDmodsubject($dbh,$oldbibnum,1,@subjects);
        # we must add bibnum and bibitemnum in MARC::Record...
        # we build the new field with biblionumber and biblioitemnumber
***************
*** 1321,1332 ****
($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject");
        my @subj = $record->field($tagfield);
        foreach my $subject (@subj) {
                my @subjsubfield = $subject->subfield($tagsubfield);
-               my @subjects;
                foreach my $subfieldcount (0..$#subjsubfield) {
                        push @subjects,$subjsubfield[$subfieldcount];
                }
-               OLDmodsubject($dbh,$oldbiblionumber,1,@subjects);
        }
        return 1;
  }
--- 1321,1332 ----
($tagfield,$tagsubfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubject.subject");
        my @subj = $record->field($tagfield);
+       my @subjects;
        foreach my $subject (@subj) {
                my @subjsubfield = $subject->subfield($tagsubfield);
                foreach my $subfieldcount (0..$#subjsubfield) {
                        push @subjects,$subjsubfield[$subfieldcount];
                }
        }
+       OLDmodsubject($dbh,$oldbiblionumber,1,@subjects);
        return 1;
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]