From b2b7983b9940ebd838ab991a30069551b7aa77a2 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 Jan 2016 17:27:23 +0000 Subject: [PATCH] Bug 15561 - Add ability to charge cancelation fee from "Holds over" tab The fee set in ExpireReservesMaxPickUpDelayCharge can only be charged by the automatic expiration cron script. Some libraries would prefer to manually cancel holds via the "Holds over" tab of the "Holds awaiting pickup" page but still be able to charge the cancellation fee. Test Plan: 1) Apply this patch 2) Set ExpireReservesMaxPickUpDelayCharge to some number 3) Go to the Holds awaiting pickup page 4) Go to the Holds over tab 5) Note the new checkbox for charging the fee 6) Test canceling a single hold with the checkbox checked 7) Note a fee is charged 8) Test canceling a single hold with the checkbox unchecked 9) Note a fee is not charged 10) Test canceling all holds with the checkbox checked 11) Note the patrons are charged fees 12) Test canceling all holds without the checkbox checked 13) Note the patrons are not charged fees --- C4/Reserves.pm | 4 ++-- circ/waitingreserves.pl | 21 +++++++++++---------- .../prog/en/modules/circ/waitingreserves.tt | 11 ++++++++++- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 7bb5d69..c47cc7a 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1356,10 +1356,10 @@ function to cancel reserv,check other reserves, and transfer document if it's ne sub ModReserveCancelAll { my $messages; my $nextreservinfo; - my ( $itemnumber, $borrowernumber ) = @_; + my ( $itemnumber, $borrowernumber, $charge_cancel_fee ) = @_; #step 1 : cancel the reservation - my $CancelReserve = CancelReserve({ itemnumber => $itemnumber, borrowernumber => $borrowernumber }); + my $CancelReserve = CancelReserve({ itemnumber => $itemnumber, borrowernumber => $borrowernumber, charge_cancel_fee => $charge_cancel_fee }); #step 2 launch the subroutine of the others reserves ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber); diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 268213a..67e9f29 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -40,13 +40,14 @@ use C4::Koha; my $input = new CGI; -my $item = $input->param('itemnumber'); -my $borrowernumber = $input->param('borrowernumber'); -my $fbr = $input->param('fbr') || ''; -my $tbr = $input->param('tbr') || ''; -my $all_branches = $input->param('allbranches') || ''; -my $cancelall = $input->param('cancelall'); -my $tab = $input->param('tab'); +my $item = $input->param('itemnumber'); +my $borrowernumber = $input->param('borrowernumber'); +my $fbr = $input->param('fbr') || ''; +my $tbr = $input->param('tbr') || ''; +my $all_branches = $input->param('allbranches') || ''; +my $cancelall = $input->param('cancelall'); +my $tab = $input->param('tab'); +my $charge_cancel_fee = $input->param('charge_cancel_fee'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -67,7 +68,7 @@ $template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_can my @cancel_result; # if we have a return from the form we launch the subroutine CancelReserve if ($item) { - my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); + my $res = cancel( $item, $borrowernumber, $fbr, $tbr, undef, $charge_cancel_fee ); push @cancel_result, $res if $res; } @@ -171,13 +172,13 @@ if ($item && $tab eq 'holdsover') { exit; sub cancel { - my ($item, $borrowernumber, $fbr, $tbr, $skip_transfers ) = @_; + my ($item, $borrowernumber, $fbr, $tbr, $skip_transfers, $charge_cancel_fee ) = @_; my $transfer = $fbr ne $tbr; # XXX && !$nextreservinfo; return if $transfer && $skip_transfers; - my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber ); + my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber, $charge_cancel_fee ); # if the document is not in his homebranch location and there is not reservation after, we transfer it if ($transfer && !$nextreservinfo) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt index 1028033..30bc149 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] @@ -109,7 +110,7 @@ - + [% IF ( reserveloo.dotransfer ) %] [% ELSE %] @@ -133,6 +134,9 @@ + [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %] +

Charge cancelation fee

+ [% END %] [% UNLESS TransferWhenCancelAllWaitingHolds %] Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds sypref) @@ -170,6 +174,11 @@ + + [% IF Koha.Preference('ExpireReservesMaxPickUpDelayCharge') %] +

Charge cancelation fee

+ [% END %] + [% IF ( overloo.dotransfer ) %] [% ELSE %] -- 2.1.4