Bug 15550: Fix authority search and detail at the OPAC
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 12 Jan 2016 10:21:16 +0000 (10:21 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Sat, 23 Jan 2016 18:34:06 +0000 (18:34 +0000)
The author of Bug 15381 (me!) has mismatch the objects he was
manipulating and forgotten to update a template.
for the opac-aythorities-home, the variable is named authority_types,
not authtypesloop.
In opac-authoritiesdetail.pl, the $record is a MARC::Record and there is
no authtypecode method. We need to retrieve the authtypecode using
the new Koha::Authorities module.

Test plan:
Search for authorities at the OPAC and click on the detail link to go to
the detail page.
Without this patch, you will get errors.
With this patch, the errors should have gone and everything should work
as before bug 15381.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described. Pull down for choosing the auth_type displayed again

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt
opac/opac-authoritiesdetail.pl

index 85ecf8d..d3dfcf8 100644 (file)
                                     <li>
                                         <label for="authtypecode">Authority type: </label>
                                         <select name="authtypecode" id="authtypecode">
-                                            [% FOREACH authtypesloo IN authtypesloop %]
-                                                [% IF ( authtypesloo.selected ) %]
-                                                    <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
+                                            [% FOREACH authority_type IN authority_types %]
+                                                [% IF authority_type.authtypecode == authtypecode %]
+                                                    <option value="[% authority_type.authtypecode%]" selected="selected">[% authority_type.authtypetext %]</option>
                                                 [% ELSE %]
-                                                    <option value="[% authtypesloo.value %]"> [% authtypesloo.authtypetext %]</option>
+                                                    <option value="[% authority_type.authtypecode%]">[% authority_type.authtypetext %]</option>
                                                 [% END %]
                                             [% END %]
                                         </select>
index b867012..f46c511 100755 (executable)
@@ -47,6 +47,7 @@ use CGI qw ( -utf8 );
 use MARC::Record;
 use C4::Koha;
 
+use Koha::Authorities;
 use Koha::Authority::Types;
 
 my $query = new CGI;
@@ -75,7 +76,8 @@ if ( ! $record ) {
     exit;
 }
 
-my $authtypecode = $record->authtypecode;
+my $authority = Koha::Authorities->find( $authid );
+my $authtypecode = $authority->authtypecode;
 
 if ($display_hierarchy){
     $template->{VARS}->{'displayhierarchy'} = $display_hierarchy;