From 59e92cc71237d8270bb2fa6261f3b3931dc17c7e Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 4 Oct 2005 14:48:23 +0000 Subject: [PATCH] fixing a bug in getMARCsubject --- C4/SearchMarc.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index 15dbb5d237..423c14dccf 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -597,11 +597,13 @@ sub getMARCsubjects { my @marcsubjcts; my $subject = ""; -# my $subfield = ""; my $marcsubjct; my $field9; my $activetagorder=0; - while (my ($subfieldvalue,$subfieldcode,$tagorder,$tag)=$sth->fetchrow) { + my $lasttag; + my ($subfieldvalue,$subfieldcode,$tagorder,$tag); + while (($subfieldvalue,$subfieldcode,$tagorder,$tag)=$sth->fetchrow) { + $lasttag=$tag if $tag; if ($activetagorder && $tagorder != $activetagorder) { $subject=~ s/ -- $//; $marcsubjct = {MARCSUBJCT => $subject, @@ -610,6 +612,8 @@ sub getMARCsubjects { }; push @marcsubjcts, $marcsubjct; $subject=''; + $tag=''; + $field9=''; } if ($subfieldcode eq 9) { $field9=$subfieldvalue; @@ -618,7 +622,10 @@ sub getMARCsubjects { } $activetagorder=$tagorder; } - $marcsubjct = {MARCSUBJCT => $subject,}; + $marcsubjct = {MARCSUBJCT => $subject, + link => $lasttag."9", + linkvalue => $field9, + }; push @marcsubjcts, $marcsubjct; $sth->finish; -- 2.39.5