From 19ac7c156942ef67cc343b5682e635fa747d7ae7 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 11 Nov 2009 20:59:32 +0100 Subject: [PATCH] Bug Fix : 3343 MT1313 Authorities MARC summary When more than one heading, fields are mixed and not well ordered --- C4/AuthoritiesMarc.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 501ff09aa1..12ba169d28 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -999,10 +999,12 @@ sub BuildSummary{ if ($summary and C4::Context->preference('marcflavour') eq 'UNIMARC') { my @fields = $record->fields(); # $reported_tag = '$9'.$result[$counter]; + my @stringssummary; foreach my $field (@fields) { my $tag = $field->tag(); my $tagvalue = $field->as_string(); - $summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g; + my $localsummary= $summary; + $localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g; if ($tag<10) { if ($tag eq '001') { $reported_tag.='$3'.$field->data(); @@ -1013,12 +1015,16 @@ sub BuildSummary{ my $subfieldcode = $subf[$i][0]; my $subfieldvalue = $subf[$i][1]; my $tagsubf = $tag.$subfieldcode; - $summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; + $localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g; } } + push @stringssummary, $localsummary if ($localsummary ne $summary); } - $summary =~ s/\[(.*?)]//g; - $summary =~ s/\n/
/g; + my $resultstring; + $resultstring = join(" -- ",@stringssummary); + $resultstring =~ s/\[(.*?)\]//g; + $resultstring =~ s/\n/
/g; + $summary = $resultstring; } else { my $heading; my $authid; @@ -1035,7 +1041,6 @@ sub BuildSummary{ # accepted form foreach my $field ($record->field('2..')) { $heading.= $field->subfield('a'); - $authid=$field->subfield('3'); } # rejected form(s) foreach my $field ($record->field('3..')) { -- 2.39.5