[Koha-patches] [PATCH] Bug 7442: Corrects selection of authorities
Adrien Saurat
adrien.saurat at biblibre.com
Fri Jan 13 14:45:53 CET 2012
When editing a biblio record, if an authority
is searched the generated links now behave
correctly (if 200$x or 200$y exist they won't
have their own link).
---
authorities/auth_finder.pl | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl
index 99ac2c1..6a2b052 100755
--- a/authorities/auth_finder.pl
+++ b/authorities/auth_finder.pl
@@ -72,16 +72,23 @@ 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++) {
- push @repets_loop,
- { index => $index, repet => $i+1, value => $repets[$i] };
- }
- $heading->{repets} = \@repets_loop;
+ my $record = GetAuthority($heading->{'authid'});
+ my $auth_name = ''; # will be displayed in the link tooltip
+ my $cpt = 0;
+ my @repets_loop;
+ 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 => $cpt, value => $auth_name };
+ }
+ if ( $cpt < 2 ) {
+ undef @repets_loop;
+ }
+ else {
+ $heading->{repets} = \@repets_loop
}
}
# multi page display gestion
--
1.7.4.1
More information about the Koha-patches
mailing list