Bug 21018: Allow uris defined in the item
[koha_ffzg] / opac / opac-shelves.pl
index e5b9cc6..b2799ea 100755 (executable)
@@ -29,7 +29,9 @@ use C4::Output;
 use C4::Tags qw( get_tags );
 use C4::XSLT;
 
+use Koha::Biblios;
 use Koha::Biblioitems;
+use Koha::IssuingRules;
 use Koha::Items;
 use Koha::ItemTypes;
 use Koha::Patrons;
@@ -272,6 +274,7 @@ if ( $op eq 'view' ) {
                 my $this_item    = GetBiblioData($biblionumber);
                 my $record = GetMarcBiblio({ biblionumber => $biblionumber });
                 my $framework = GetFrameworkCode( $biblionumber );
+                my $biblio = Koha::Biblios->find( $biblionumber );
                 $record_processor->options({
                     interface => 'opac',
                     frameworkcode => $framework
@@ -315,8 +318,11 @@ if ( $op eq 'view' ) {
                     });
                 }
 
-                $this_item->{allow_onshelf_holds} = C4::Reserves::OnShelfHoldsAllowed($this_item, $patron);
-
+                my $items = $biblio->items;
+                while ( my $item = $items->next ) {
+                    $this_item->{allow_onshelf_holds} = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
+                    last if $this_item->{allow_onshelf_holds};
+                }
 
                 if ( grep {$_ eq $biblionumber} @cart_list) {
                     $this_item->{incart} = 1;