|
Lines 908-913
sub BuildSummary {
Link Here
|
| 908 |
# for MARC21, the authority type summary displays a label meant for |
908 |
# for MARC21, the authority type summary displays a label meant for |
| 909 |
# display |
909 |
# display |
| 910 |
if (C4::Context->preference('marcflavour') ne 'UNIMARC') { |
910 |
if (C4::Context->preference('marcflavour') ne 'UNIMARC') { |
|
|
911 |
$summary{label} = $authref->{summary}; |
| 912 |
} else { |
| 911 |
$summary{summary} = $authref->{summary}; |
913 |
$summary{summary} = $authref->{summary}; |
| 912 |
} |
914 |
} |
| 913 |
} |
915 |
} |
|
Lines 942-976
sub BuildSummary {
Link Here
|
| 942 |
# suit the MARC21 version, so for now the "templating" |
944 |
# suit the MARC21 version, so for now the "templating" |
| 943 |
# feature will be enabled only for UNIMARC for backwards |
945 |
# feature will be enabled only for UNIMARC for backwards |
| 944 |
# compatibility. |
946 |
# compatibility. |
| 945 |
if ($summary_template and C4::Context->preference('marcflavour') eq 'UNIMARC') { |
947 |
if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') { |
| 946 |
my @fields = $record->fields(); |
948 |
my @matches = ($summary{summary} =~ m/\[(.*?)(\d{3})([\*a-z0-9])(.*?)\]/g); |
| 947 |
# $reported_tag = '$9'.$result[$counter]; |
949 |
my (@textbefore, @tag, @subtag, @textafter); |
| 948 |
my @repets; |
950 |
for(my $i = 0; $i < scalar @matches; $i++){ |
| 949 |
foreach my $field (@fields) { |
951 |
push @textbefore, $matches[$i] if($i%4 == 0); |
| 950 |
my $tag = $field->tag(); |
952 |
push @tag, $matches[$i] if($i%4 == 1); |
| 951 |
my $tagvalue = $field->as_string(); |
953 |
push @subtag, $matches[$i] if($i%4 == 2); |
| 952 |
my $localsummary= $summary_template; |
954 |
push @textafter, $matches[$i] if($i%4 == 3); |
| 953 |
$localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g; |
955 |
} |
| 954 |
if ($tag<10) { |
956 |
for(my $i = scalar @tag; $i >= 0; $i--){ |
| 955 |
if ($tag eq '001') { |
957 |
my $textbefore = $textbefore[$i] || ''; |
| 956 |
$reported_tag.='$3'.$field->data(); |
958 |
my $tag = $tag[$i] || ''; |
| 957 |
} |
959 |
my $subtag = $subtag[$i] || ''; |
| 958 |
} else { |
960 |
my $textafter = $textafter[$i] || ''; |
| 959 |
my @subf = $field->subfields; |
961 |
my $value = ''; |
| 960 |
for my $i (0..$#subf) { |
962 |
my $field = $record->field($tag); |
| 961 |
my $subfieldcode = $subf[$i][0]; |
963 |
if ( $field ) { |
| 962 |
my $subfieldvalue = $subf[$i][1]; |
964 |
if($subtag eq '*') { |
| 963 |
my $tagsubf = $tag.$subfieldcode; |
965 |
if($tag < 10) { |
| 964 |
$localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g; |
966 |
$value = $textbefore . $field->data() . $textafter; |
|
|
967 |
} |
| 968 |
} else { |
| 969 |
my @subfields = $field->subfield($subtag); |
| 970 |
if(@subfields > 0) { |
| 971 |
$value = $textbefore . join (" - ", @subfields) . $textafter; |
| 972 |
} |
| 965 |
} |
973 |
} |
| 966 |
} |
974 |
} |
| 967 |
if ($localsummary ne $summary_template) { |
975 |
$summary{summary} =~ s/\[\Q$textbefore$tag$subtag$textafter\E\]/$value/; |
| 968 |
$localsummary =~ s/\[(.*?)\]//g; |
|
|
| 969 |
$localsummary =~ s/\n/<br>/g; |
| 970 |
push @repets, $localsummary; |
| 971 |
} |
| 972 |
} |
976 |
} |
| 973 |
$summary{repets} = \@repets; |
977 |
$summary{summary} =~ s/\\n/<br \/>/g; |
| 974 |
} |
978 |
} |
| 975 |
my @authorized; |
979 |
my @authorized; |
| 976 |
my @notes; |
980 |
my @notes; |