@@ -, +, @@ --- C4/AuthoritiesMarc.pm | 2 +- C4/Biblio.pm | 18 +++++++++++++----- authorities/blinddetail-biblio-search.pl | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -1353,7 +1353,7 @@ sub merge { if ($auth_number==$mergefrom) { my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto); my $exclude='9'; - foreach my $subfield (@record_to) { + foreach my $subfield (grep {$_->[0] ne 9} @record_to) { $field_to->add_subfields($subfield->[0] =>$subfield->[1]); $exclude.= $subfield->[0]; } --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -1675,10 +1675,13 @@ sub GetMarcSubjects { if ( $counter != 0 ) { $operator = ' and '; } - if ( $code eq 9 ) { + if ( $code eq 9 and $linkvalue ne " 0 ") { $found9 = 1; @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } ); } + if ( $code eq 9 and $linkvalue eq " 0 ") { + next; + } if ( not $found9 ) { push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator }; } @@ -1734,7 +1737,7 @@ sub GetMarcAuthors { my $count_auth = 0; # if there is an authority link, build the link with Koha-Auth-Number: subfield9 - my $subfield9 = $field->subfield('9'); + my $found9 ; for my $authors_subfield (@subfields) { # don't load unimarc subfields 3, 5 @@ -1749,9 +1752,14 @@ sub GetMarcAuthors { } # if we have an authority link, use that as the link, otherwise use standard searching - if ($subfield9) { - @link_loop = ( { 'limit' => 'an', link => "$subfield9" } ); - } else { + if ( $subfieldcode eq 9 and $linkvalue ne " 0 ") { + $found9 = 1; + @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } ); + } + if ( not $found9 ) { + push @link_loop, { 'limit' => 'au', link => $linkvalue, operator => $operator }; + } + unless ($found9){ # reset $linkvalue if UNIMARC author responsibility if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] eq "4" ) ) { --- a/authorities/blinddetail-biblio-search.pl +++ a/authorities/blinddetail-biblio-search.pl @@ -84,6 +84,7 @@ if ($authid) { # Get all values for each distinct subfield my %subfields; for ( $field->subfields ) { + next if $_->[0] == "9"; my $letter = $_->[0]; next if defined $subfields{$letter}; my @values = $field->subfield($letter); --