my ($record,$authid,$authtypecode)=@_;
my $dbh=C4::Context->dbh;
my %summary;
+ my $summary_template;
# handle $authtypecode is NULL or eq ""
if ($authtypecode) {
my $authref = GetAuthType($authtypecode);
$summary{authtypecode} = $authref->{authtypecode};
$summary{type} = $authref->{authtypetext};
- $summary{summary} = $authref->{summary};
+ $summary_template = $authref->{summary};
}
my $marc21subfields = 'abcdfghjklmnopqrstuvxyz68';
my %marc21controlrefs = ( 'a' => 'earlier',
# suit the MARC21 version, so for now the "templating"
# feature will be enabled only for UNIMARC for backwards
# compatibility.
- if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') {
+ if ($summary_template and C4::Context->preference('marcflavour') eq 'UNIMARC') {
my @fields = $record->fields();
# $reported_tag = '$9'.$result[$counter];
- my @stringssummary;
+ my @repets;
foreach my $field (@fields) {
my $tag = $field->tag();
my $tagvalue = $field->as_string();
- my $localsummary= $summary{summary};
+ my $localsummary= $summary_template;
$localsummary =~ s/\[(.?.?.?.?)$tag\*(.*?)\]/$1$tagvalue$2\[$1$tag$2\]/g;
if ($tag<10) {
if ($tag eq '001') {
$localsummary =~ s/\[(.?.?.?.?)$tagsubf(.*?)\]/$1$subfieldvalue$2\[$1$tagsubf$2\]/g;
}
}
- push @stringssummary, $localsummary if ($localsummary ne $summary{summary});
+ if ($localsummary ne $summary_template) {
+ $localsummary =~ s/\[(.*?)\]//g;
+ $localsummary =~ s/\n/<br>/g;
+ push @repets, $localsummary;
+ }
}
- my $resultstring;
- $resultstring = join(" -- ",@stringssummary);
- $resultstring =~ s/\[(.*?)\]//g;
- $resultstring =~ s/\n/<br>/g;
- $summary{summary} = $resultstring;
+ $summary{repets} = \@repets;
}
my @authorized;
my @notes;
$startfrom * $resultsperpage,
$resultsperpage, $authtypecode, $orderby );
- # If an authority heading is repeated, add an arrayref to those repetions
- # First heading -- Second heading
- for my $heading (@$results) {
- my @repets = split / -- /, $heading->{summary};
- if ( @repets > 1 ) {
- my @repets_loop;
- for ( my $i = 0 ; $i < @repets ; $i++ ) {
- push @repets_loop,
- { index => $index, repet => $i + 1, value => $repets[$i] };
- }
- $heading->{repets} = \@repets_loop;
- }
- }
-
# multi page display gestion
my $displaynext = 0;
my $displayprev = $startfrom;
[% END %]
[% END %]
[% BLOCK authresult %]
- [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
+ <div class="authres_repet">
+ [% FOREACH repet IN summary.repets %]
+ <span>[% repet | html %]</span>
+ [% UNLESS loop.last %] | [% END %]
+ [% END %]
+ </div>
[% UNLESS ( summary.summaryonly ) %]
<div class="authorizedheading">
[% FOREACH authorize IN summary.authorized %]
<span class="authorizedheading">[% authorize.heading | html %]</span>
+ [% UNLESS loop.last %] | [% END %]
[% END %]
</div>
[% IF ( marcflavour == 'UNIMARC' ) %]
[% IF summary.notes %]
<div class="authres_notes">
[% FOREACH note IN summary.notes %]
- [% note.note | html %]</span>
+ <span>[% note.note | html %]</span>
[% END %]
</div>
[% END %]
<td>[% PROCESS authresult summary=resul.summary %]</td>
<td>[% resul.used %] times</td>
<td>
- [% IF resul.repets %]
- [% FOREACH repet IN resul.repets %]
- <a href="javascript:doauth('[% resul.authid %]', '[% repet.index %]', '[% repet.repet %]')" title="[% repet.value %]">[% repet.repet %]</a>
+ [% IF resul.summary && resul.summary.repets && resul.summary.repets.size > 1 %]
+ [% FOREACH repet IN resul.summary.repets %]
+ <a href="javascript:doauth('[% resul.authid %]', '[% index %]', '[% loop.count %]')" title="[% repet | html %]">[% loop.count %]</a>
[% END %]
[% ELSE %]
<a href="javascript:doauth('[% resul.authid %]', '[% index %]', '')">choose</a>
[% END %]
[% END %]
[% BLOCK authresult %]
- [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
+ <div class="authres_repet">
+ [% FOREACH repet IN summary.repets %]
+ <span>[% repet | html %]</span>
+ [% UNLESS loop.last %] | [% END %]
+ [% END %]
+ </div>
[% UNLESS ( summary.summaryonly ) %]
<div class="authorizedheading">
[% FOREACH authorize IN summary.authorized %]
<span class="authorizedheading">[% authorize.heading | html %]</span>
+ [% UNLESS loop.last %] | [% END %]
[% END %]
</div>
[% IF ( marcflavour == 'UNIMARC' ) %]
[% IF summary.notes %]
<div class="authres_notes">
[% FOREACH note IN summary.notes %]
- [% note.note | html %]</span>
+ <span>[% note.note | html %]</span>
[% END %]
</div>
[% END %]