From 6ae3d4a8be975f4ba32325e98fa38af11fe7c104 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 28 Jun 2012 18:25:55 -0400 Subject: [PATCH] Bug 8332: Add relationships to auth_finder for authority links Content-Type: text/plain; charset="UTF-8" In addition to the work in bug 8207 that enables auth_finder use, it would be very useful when creating authorities to have the auth_finder plugin automatically fill out the relationship information in $w (in MARC21). To test (note that you must either apply the patch for bug 8207 or manually add a thesaurus to a 5xx linking field in one of the authority type frameworks): 1. Create a new authority record. 2. Go to the 5xx tab. 3. Click the authority control plugin ellipsis. 4. Do a search for an authority. 5. Select a relationship type. 6. Note that after you choose an authority, that the $w control field is automatically populated with the relationship type. --- authorities/auth_finder.pl | 4 +++ authorities/blinddetail-biblio-search.pl | 3 ++ .../prog/en/includes/auth-finder-search.inc | 28 +++++++++++++++++++- .../intranet-tmpl/prog/en/includes/form-blocks.inc | 5 +++ .../prog/en/modules/authorities/authorities.tt | 2 +- .../modules/authorities/searchresultlist-auth.tt | 16 ++++++++++- 6 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/form-blocks.inc diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl index a3821ee..8182299 100755 --- a/authorities/auth_finder.pl +++ b/authorities/auth_finder.pl @@ -35,6 +35,7 @@ my $authtypecode = $query->param('authtypecode'); my $index = $query->param('index'); my $tagid = $query->param('tagid'); my $resultstring = $query->param('result'); +my $relationship = $query->param('relationship'); my $dbh = C4::Context->dbh; my $startfrom = $query->param('startfrom'); @@ -192,6 +193,9 @@ $template->param( authtypecode => $authtypecode, ); +$template->{VARS}->{source} = $query->param('source') || ''; +$template->{VARS}->{relationship} = $query->param('relationship') || ''; + # Print the page output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 7de7db3..4aa2093 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 ); @@ -95,6 +96,8 @@ if ($authid) { 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. diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc index a6d55df..598a51d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc @@ -1,3 +1,4 @@ +[% PROCESS 'form-blocks.inc' %] @@ -73,10 +85,10 @@ function jumpfull(page) [% IF resul.repets %] [% FOREACH repet IN resul.repets %] - [% repet.repet %] + [% repet.repet %] [% END %] [% ELSE %] - choose + choose [% END %] Edit authority -- 1.7.2.5