@@ -, +, @@ --- authorities/auth_finder.pl | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) --- a/authorities/auth_finder.pl +++ a/authorities/auth_finder.pl @@ -72,14 +72,34 @@ if ( $op eq "do_search" ) { $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++) { + my @repets_loop; + if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { + my $record = GetAuthority($heading->{'authid'}); + my $auth_name = ''; # will be displayed in the link tooltip + my $cpt = 0; + foreach my $field ($record->field('200')) { + $auth_name = $field->subfield('a'); + if ($field->subfield('b')) { $auth_name .= ', ' . $field->subfield('b') } + $cpt++; push @repets_loop, - { index => $index, repet => $i+1, value => $repets[$i] }; + { index => $index, repet => $cpt, value => $auth_name }; + } + if ( $cpt < 2 ) { + undef @repets_loop; + } + else { + $heading->{repets} = \@repets_loop; + } + } + else { + 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; } --