Bug 17642: Add and use get_descriptions_by_koha_field
[srvgit] / circ / returns.pl
index e849a46..5927759 100755 (executable)
@@ -47,6 +47,7 @@ use C4::Members;
 use C4::Members::Messaging;
 use C4::Koha;   # FIXME : is it still useful ?
 use C4::RotatingCollections;
+use Koha::AuthorisedValues;
 use Koha::DateUtils;
 use Koha::Calendar;
 
@@ -278,10 +279,8 @@ if ($barcode) {
     $returnbranch = $biblio->{$hbr};
 
     my $materials = $biblio->{'materials'};
-    my $avcode = GetAuthValCode('items.materials');
-    if ($avcode) {
-        $materials = GetKohaAuthorisedValueLib($avcode, $materials);
-    }
+    my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
+    $materials = $descriptions->{lib} // '';
 
     $template->param(
         title            => $biblio->{'title'},
@@ -552,7 +551,8 @@ $template->param( errmsgloop => \@errmsgloop );
 my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
 my $count = 0;
 my @riloop;
-my $shelflocations = GetKohaAuthorisedValues('items.location','');
+my $shelflocations =
+  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) };
 foreach ( sort { $a <=> $b } keys %returneditems ) {
     my %ri;
     if ( $count++ < $returned_counter ) {