From b99180bcaa0b508c3e41c54f4de26399feb35e49 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 15 Dec 2018 16:16:33 +0000 Subject: [PATCH] Bug 21756: Remove use of manualinvoice from Koha::Hold Known Side Effect: Prior to this patch hold cancellation fees were not recorded in the FinesLog. After this patch, if the FinesLog is enabled then the 'action' will be recorded as `create_hold_expiration`. Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens --- Koha/Hold.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index a1ef5aafa5..3b3aba8b26 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -365,7 +365,17 @@ sub cancel { # and, if desired, charge a cancel fee my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); if ( $charge && $params->{'charge_cancel_fee'} ) { - C4::Accounts::manualinvoice($self->borrowernumber, $self->itemnumber, '', 'HE', $charge); + my $account = + Koha::Account->new( { patron_id => $self->borrowernumber } ); + $account->add_debit( + { + amount => $charge, + user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, + library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, + type => 'hold_expired', + item_id => $self->itemnumber + } + ); } C4::Log::logaction( 'HOLDS', 'CANCEL', $self->reserve_id, Dumper($self->unblessed) ) @@ -400,8 +410,8 @@ sub _type { =head1 AUTHORS Kyle M Hall - Jonathan Druart +Martin Renvoize =cut -- 2.39.5