Bug 19537: (QA follow-up) Consistent structures
[koha.git] / authorities / detail-biblio-search.pl
index c6af075..717061b 100755 (executable)
@@ -50,6 +50,8 @@ use C4::Koha;
 # use C4::Biblio;
 # use C4::Catalogue;
 
+use Koha::Authorities;
+use Koha::Authority::Types;
 
 my $query=new CGI;
 
@@ -57,7 +59,7 @@ my $dbh=C4::Context->dbh;
 
 my $authid = $query->param('authid');
 my $index = $query->param('index');
-my $authtypecode = &GetAuthTypeCode($authid);
+my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
 my $tagslib = &GetTagsLabels(1,$authtypecode);
 
 my $record =GetAuthority($authid);
@@ -119,18 +121,12 @@ my @fields = $record->fields();
        }
        $template->param("0XX" =>\@loop_data);
 
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
-       my %row =(value => $thisauthtype,
-                               selected => $thisauthtype eq $authtypecode,
-                               authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
-                       );
-       push @authtypesloop, \%row;
-}
-
-$template->param(authid => $authid,
-               authtypesloop => \@authtypesloop, index => $index,
-               );
+my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
+
+$template->param(
+    authid          => $authid,
+    authority_types => $authority_types,
+    index           => $index,
+);
 output_html_with_http_headers $query, $cookie, $template->output;