Bugzilla – Attachment 11134 Details for
Bug 8071
link beween bib and authorities with the authid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch (2)
Bug-8071-link-between-bib-and-authorities-with-the-a.patch (text/plain), 6.25 KB, created by
Fridolin Somers
on 2012-07-25 16:13:16 UTC
(
hide
)
Description:
Proposed patch (2)
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2012-07-25 16:13:16 UTC
Size:
6.25 KB
patch
obsolete
>From bb2a56c51fb058f16e4791ac8e90f7ac1ac692b3 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Wed, 25 Jul 2012 17:59:54 +0200 >Subject: [PATCH] Bug 8071: link between bib and authorities with the authid > >--- > C4/AuthoritiesMarc.pm | 2 +- > C4/Biblio.pm | 18 +++++++--- > authorities/blinddetail-biblio-search.pl | 1 + > .../authorities/blinddetail-biblio-search.tt | 38 ++++++++++---------- > 4 files changed, 35 insertions(+), 24 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index ece46a3..00cbd8d 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1362,7 +1362,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]; > } >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f8ba099..6a9be6c 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1721,10 +1721,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 }; > } >@@ -1780,7 +1783,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 >@@ -1795,9 +1798,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" ) ) { >diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl >index 7de7db3..469676a 100755 >--- a/authorities/blinddetail-biblio-search.pl >+++ b/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); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >index 56ed94f..b8793ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt >@@ -13,24 +13,6 @@ > } > > var field_start = whichfield.parentNode.parentNode; >- >- // browse all its subfields (clear and $9) >- var subfields = field_start.getElementsByTagName('input'); >- var re = /^tag_\d*_code_/; >- for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields >- if(subfields[i].getAttribute('name').match(re)){ // it s a subfield >- var code = subfields[i]; // code is the first input >- var subfield = subfields[i+1]; // subfield the second >- >- [% IF ( clear ) %] >- if (subfield){subfield.value="" ;} >- [% ELSE %] >- if(code.value=='9'){ >- subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; >- } >- [% END %] >- } >- } > > // Sets the good number of form fields for the specified subfield > // Returns false if the cloning failed >@@ -90,6 +72,7 @@ > }); > } > >+ [% UNLESS ( clear ) %] > [% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %] > SetSubfieldValues( > "[% tag_number |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %][% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]" >@@ -98,6 +81,25 @@ > [% END %] > ); > [% END %] >+ [% END %] >+ >+ // browse all its subfields (clear and $9) >+ var subfields = field_start.getElementsByTagName('input'); >+ var re = /^tag_\d*_code_/; >+ for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields >+ if(subfields[i].getAttribute('name').match(re)){ // it s a subfield >+ var code = subfields[i]; // code is the first input >+ var subfield = subfields[i+1]; // subfield the second >+ >+ [% IF ( clear ) %] >+ if (subfield){subfield.value="" ;} >+ [% ELSE %] >+ if(code.value=='9'){ >+ subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; >+ } >+ [% END %] >+ } >+ } > > opener.close(); > window.close(); >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8071
:
9513
|
11134
|
11157
|
11554