From 546a3b6d4d6333fe938572f0247dfcbe4a4d35a8 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Thu, 4 Apr 2019 01:10:16 -0300 Subject: [PATCH] Bug 22284: New message, new column and filter pickup locations in reserve/request.tt This patch adds a new message to 'Hold' column in 'Place a hold on a specific item' table. The message is "Cannot place hold from patrons's library". It appears when patron's homebranch is not in item's hold group, and hold_fulfillment_policy is set to 'holdgroup'. This patch also adds a new column "Allowed pickup locations" that lists allowed pickup locations per item. Finally, the select that displays pickup locations is filtered by allowed pickup locations, when multi_hold is not enabled To test: 1) Apply this patch 2) In library groups add a root group and check it as hold group. 3) Add two libraries to the group 4) In circulation and fines rules, in 'Default checkout, hold and return policy', in Hold policy change the value to 'From local hold group' 5) Search a patron from a different library than step 3, select one and click 'search to hold' 6) Search by location for items in any library of step 3 7) On any item, clic on 'Place hold for ...' SUCCESS => when the page is loaded, in the 'Place a hold on a specific item', you should see the message "Cannot place hold from patrons's library" in 'Hold' column => You should see a new column called "Allowed pickup locations" and the message is "Any library" 8) In circulation and fines rules, in 'Default checkout, hold and return policy', in 'Hold policy' change the value again to 'From any library' and change 'Hold pickup library match' to "Item's hold group" 8) Repeat steps 5 to 7 SUCCESS => when the page is loaded, you should see the "Pickup at" select filtered by libraries in hold group => You should see in "Allowed pickup locations" a coma separated list of the libraries in item's hold group => If biblio has an item whose control branch is not in a hold group, you should see the control branch name in "Allowed pickup locations" 9) Sign off Sponsored-by: VOKAL Signed-off-by: Josef Moravec Signed-off-by: Liz Rea Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 12 +++++++++++- reserve/request.pl | 11 ++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 43c0f2aa84..4b3d20c1b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -424,7 +424,11 @@
  • @@ -540,6 +544,7 @@ Vol no. [% END %] Information + Allowed pickup locations @@ -576,6 +581,8 @@ Not holdable [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %] Patron is from different library + [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %] + Cannot place hold from patrons's library [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %] Patron already has hold for this item [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %] @@ -673,6 +680,9 @@ Not for loan ([% AuthorisedValues.GetByCode( 'NOT_LOAN', itemloo.notforloan ) | html %]) [% END %] + + [% itemloo.pickup_locations | html %] + [% END # / UNLESS itemloo.hide %] [% END # /FOREACH itemloo %] diff --git a/reserve/request.pl b/reserve/request.pl index 4f80b8d5b9..6b6b99e20e 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -298,7 +298,7 @@ foreach my $biblionumber (@biblionumbers) { my $force_hold_level; if ( $patron ) { { # CanBookBeReserved - my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber, $pickup ); + my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber ); if ( $canReserve->{status} eq 'OK' ) { #All is OK and we can continue @@ -548,8 +548,8 @@ foreach my $biblionumber (@biblionumbers) { $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; - my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $pickup )->{status}; - $item->{not_holdable} = $can_item_be_reserved unless $can_item_be_reserved eq 'OK'; + my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber )->{status}; + $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved->{status} eq 'OK' ); $item->{item_level_holds} = Koha::IssuingRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); @@ -562,6 +562,11 @@ foreach my $biblionumber (@biblionumbers) { { $item->{available} = 1; $num_available++; + if($branchitemrule->{'hold_fulfillment_policy'} eq 'any' ) { + $item->{pickup_locations} = 'Any library'; + } else { + $item->{pickup_locations} = join (', ', map { $_->{branchname} } Koha::Items->find($itemnumber)->pickup_locations()); + } push( @available_itemtypes, $item->{itype} ); } -- 2.39.5