-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,
+);