From 880acbd3d79fd9009768413f130d718b4bdab712 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: Tomas Cohen Arazi Signed-off-by: Josef Moravec --- .../intranet-tmpl/prog/en/modules/reserve/request.tt | 12 +++++++++++- reserve/request.pl | 9 +++++++-- 2 files changed, 18 insertions(+), 3 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 91e4ebb6b5..e8b12593a9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -227,7 +227,11 @@
  • @@ -341,6 +345,7 @@ Vol no. [% END %] Information + Allowed pickup locations @@ -377,6 +382,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' %] @@ -474,6 +481,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 49ea545826..06a49ceb7b 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -227,7 +227,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 @@ -477,7 +477,7 @@ foreach my $biblionumber (@biblionumbers) { $item->{'holdallowed'} = $branchitemrule->{'holdallowed'}; - my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber, $pickup ); + my $can_item_be_reserved = CanItemBeReserved( $patron->borrowernumber, $itemnumber ); $item->{not_holdable} = $can_item_be_reserved->{status} unless ( $can_item_be_reserved->{status} eq 'OK' ); $item->{item_level_holds} = Koha::IssuingRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } ); @@ -491,6 +491,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.17.1