Bug 14100: Generic solution for language overlay - Item types
[koha.git] / authorities / authorities.pl
index 16910c8..1753de6 100755 (executable)
@@ -83,23 +83,17 @@ sub build_authorized_values_list {
             push @authorised_values, $branchcode;
             $authorised_lib{$branchcode} = $branchname;
         }
-
-        #----- itemtypes
     }
     elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
-        my $sth =
-        $dbh->prepare(
-            "select itemtype,description from itemtypes order by description");
-        $sth->execute;
         push @authorised_values, ""
           unless ( $tagslib->{$tag}->{$subfield}->{mandatory}
             && ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
-        
+
         my $itemtype;
-        
-        while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
-            push @authorised_values, $itemtype;
-            $authorised_lib{$itemtype} = $description;
+        my $itemtypes = GetItemTypes( style => 'array' );
+        for my $itemtype ( @$itemtypes ) {
+            push @authorised_values, $itemtype->{itemtype};
+            $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
         }
         $value = $itemtype unless ($value);