From db14275db430fb76afbab8a18464f54591b30f53 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Sep 2017 13:03:04 -0300 Subject: [PATCH] Bug 19298: Placing a hold from a list at the OPAC should respect issuing rules The issuing rule retrieve to know if a hold can be placed on a record of a list is not correct. Test plan: 0/ With item-level_itypes = item level 1/ Define a item.itype=BK and biblioitems.itemtype=CF 2/ Create a default rule to allow on shelf holds 3/ Create a specific rule for CF with on shelf holds="If any unavailable" 4/ Add this bibliographic record to a list and view the list => Without this patch you will not see "Place hold" => With this patch applied you will see the "Place hold" button, respecting the correct issuing rule Followed test plan, patches worked as described. Note: Just to clarify the test plan slightly in step 4 where it says you will not see 'Place Hold' it means to the left of the 'Save to another List' link below the item availability in the opac-shelves.pl page. Not the 'Place hold' button in the grey page header box. Signed-off-by: Alex Buckley Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- opac/opac-shelves.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index e5b9cc62a1..1feaf57cae 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -29,6 +29,7 @@ use C4::Output; use C4::Tags qw( get_tags ); use C4::XSLT; +use Koha::Biblios; use Koha::Biblioitems; use Koha::Items; use Koha::ItemTypes; @@ -272,6 +273,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 +317,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} = C4::Reserves::OnShelfHoldsAllowed($item->unblessed, $patron); + last if $this_item->{allow_onshelf_holds}; + } if ( grep {$_ eq $biblionumber} @cart_list) { $this_item->{incart} = 1; -- 2.39.5