Bug 16951: Replace some more
[koha.git] / catalogue / detail.pl
index 09aa55c..a31a0c5 100755 (executable)
@@ -42,6 +42,7 @@ use C4::HTML5Media;
 use C4::CourseReserves qw(GetItemCourseReservesInfo);
 use C4::Acquisition qw(GetOrdersByBiblionumber);
 use Koha::AuthorisedValues;
+use Koha::Patrons;
 use Koha::Virtualshelves;
 
 my $query = CGI->new();
@@ -132,8 +133,9 @@ my $dbh = C4::Context->dbh;
 
 my @all_items = GetItemsInfo( $biblionumber );
 my @items;
+my $patron = Koha::Patrons->find( $borrowernumber );
 for my $itm (@all_items) {
-    push @items, $itm unless ( $itm->{itemlost} && GetHideLostItemsPreference($borrowernumber) && !$showallitems);
+    push @items, $itm unless ( $itm->{itemlost} && $patron->category->hidelostitems && !$showallitems);
 }
 
 # flag indicating existence of at least one item linked via a host record
@@ -190,11 +192,11 @@ $dat->{'showncount'} = scalar @items + @hostitems;
 $dat->{'hiddencount'} = scalar @all_items + @hostitems - scalar @items;
 
 my $shelflocations =
-  { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.location' } ) };
+  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.location' } ) };
 my $collections =
-  { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
+  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
 my $copynumbers =
-  { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
+  { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
 my (@itemloop, @otheritemloop, %itemfields);
 my $norequests = 1;