From 2f0677bd636a9ae61b571cde27c20d65a469abe0 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 --- koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt | 14 +++++++++++++- reserve/request.pl | 9 +++++++-- 2 files changed, 20 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 f11f0cffff..df0c24ecd1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -211,7 +211,11 @@
  • @@ -314,6 +318,7 @@ Vol no. [% END %] Information + Allowed pickup locations @@ -350,10 +355,14 @@ 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' %] Cannot be transferred to pickup library + [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %] + Pickup library is not in hold group [% ELSE %] [% itemloo.not_holdable | html %] [% END %] @@ -437,6 +446,9 @@
    Damaged [% END %] + + [% itemloo.pickup_locations | html %] + [% END %] [% END %] diff --git a/reserve/request.pl b/reserve/request.pl index df9cae861d..115b1d4d6d 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 @@ -489,7 +489,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 } ); @@ -503,6 +503,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.11.0