From 49e3422906dba68151fb060771bcf41ef3fa5953 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::Patron 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`. --- Koha/Hold.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 23d5d447a5..f8975feb7f 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -351,7 +351,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) ) @@ -386,8 +396,8 @@ sub _type { =head1 AUTHORS Kyle M Hall - Jonathan Druart +Martin Renvoize =cut -- 2.19.2