From 55459d7a149a9a7e2ccfba8e0e3d8eb46818b071 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 7 Aug 2017 15:13:17 -0300 Subject: [PATCH] [SIGNED-OFF] Bug 19059: Remove CancelReserve It's done! Signed-off-by: Owen Leonard --- C4/Reserves.pm | 61 ---------------------------------------------------------- 1 file changed, 61 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 697dd66..079fb39 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -837,67 +837,6 @@ sub AutoUnsuspendReserves { map { $_->suspend(0)->suspend_until(undef)->store() } @holds; } -=head2 CancelReserve - - CancelReserve({ reserve_id => $reserve_id, [ biblionumber => $biblionumber, borrowernumber => $borrrowernumber, itemnumber => $itemnumber, ] [ charge_cancel_fee => 1 ] }); - -Cancels a reserve. If C is passed and the C syspref is set, charge that fee to the patron's account. - -=cut - -sub CancelReserve { - my ( $params ) = @_; - - my $reserve_id = $params->{'reserve_id'}; - my $hold; - if ( $reserve_id ) { - $hold = Koha::Holds->find( $reserve_id ); - } else { - $hold = Koha::Holds->search( $params ); # biblionumber, borrowernumber, itemnumber - } - - return unless $hold; - - logaction( 'HOLDS', 'CANCEL', $hold->reserve_id, Dumper($hold->unblessed) ) - if C4::Context->preference('HoldsLog'); - - my $query = " - UPDATE reserves - SET cancellationdate = now(), - priority = 0 - WHERE reserve_id = ? - "; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare($query); - $sth->execute( $reserve_id ); - - $query = " - INSERT INTO old_reserves - SELECT * FROM reserves - WHERE reserve_id = ? - "; - $sth = $dbh->prepare($query); - $sth->execute( $reserve_id ); - - $query = " - DELETE FROM reserves - WHERE reserve_id = ? - "; - $sth = $dbh->prepare($query); - $sth->execute( $reserve_id ); - - # now fix the priority on the others.... - _FixPriority({ biblionumber => $hold->biblionumber }); - - # and, if desired, charge a cancel fee - my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); - if ( $charge && $params->{'charge_cancel_fee'} ) { - manualinvoice($hold->borrowernumber, $hold->itemnumber, '', 'HE', $charge); - } - - return $hold->unblessed; -} - =head2 ModReserve ModReserve({ rank => $rank, -- 2.1.4