X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=authorities%2Fblinddetail-biblio-search.pl;h=6b3d122b8776e5c73792f69ec46b41ba0239f39d;hb=aacb81f0abd36a2ce3800f5bff15ef2652e418a9;hp=0f734b20622fa8610914adbfbe0a48fe4bef88da;hpb=a75a9264e19fe658f475c8a8ee40e0b1ca53dbd2;p=koha_fer diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 0f734b2062..6b3d122b87 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -54,6 +54,7 @@ my $dbh = C4::Context->dbh; my $authid = $query->param('authid'); my $index = $query->param('index'); my $tagid = $query->param('tagid'); +my $relationship = $query->param('relationship'); my $authtypecode = &GetAuthTypeCode($authid); my $tagslib = &GetTagsLabels( 1, $authtypecode ); @@ -80,22 +81,40 @@ if ($authid) { my @fields = $record->field( $auth_type->{auth_tag_to_report} ); my $repet = ($query->param('repet') || 1) - 1; my $field = $fields[$repet]; + + # Get all values for each distinct subfield + my %subfields; for ( $field->subfields ) { - my ($letter, $value) = @$_; - $letter = '@' unless $letter; - push @subfield_loop, { marc_subfield => $letter, marc_value => $value }; + next if $_->[0] == "9"; # $9 will be set with authid value + my $letter = $_->[0]; + next if defined $subfields{$letter}; + my @values = $field->subfield($letter); + $subfields{$letter} = \@values; + } + + # Add all subfields to the subfield_loop + for( keys %subfields ) { + my $letter = $_ || '@'; + push( @subfield_loop, {marc_subfield => $letter, marc_values => $subfields{$_}} ); } + + push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); } else { # authid is empty => the user want to empty the entry. $template->param( "clear" => 1 ); } +# Extract the tag number from the index +my $tag_number = $index; +$tag_number =~ s/^tag_(\d*)_.*$/$1/; + $template->param( authid => $authid ? $authid : "", index => $index, tagid => $tagid, SUBFIELD_LOOP => \@subfield_loop, + tag_number => $tag_number, ); output_html_with_http_headers $query, $cookie, $template->output;