From ef7410cfb82d51db1a73da69c7f0f849e8c5a608 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Sat, 15 Dec 2018 15:58:46 +0000 Subject: [PATCH] Bug 21756: Remove use of manualinvoice from Koha::Patron Known Side Effect: Prior to this patch enrolment fees were not recorded in the FinesLog. After this patch, if the FinesLog is enabled then the 'action' will be recorded as `create_account`. --- Koha/Patron.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 8d76de2c57..93f6f89b88 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -25,7 +25,6 @@ use List::MoreUtils qw( any uniq ); use JSON qw( to_json ); use Text::Unaccent qw( unac_string ); -use C4::Accounts; use C4::Context; use C4::Log; use Koha::AuthUtils; @@ -849,8 +848,14 @@ sub add_enrolment_fee_if_needed { my ($self) = @_; my $enrolment_fee = $self->category->enrolmentfee; if ( $enrolment_fee && $enrolment_fee > 0 ) { - # insert fee in patron debts - C4::Accounts::manualinvoice( $self->borrowernumber, '', '', 'A', $enrolment_fee ); + $self->account->add_debit( + { + amount => $enrolment_fee, + user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, + library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, + type => 'account' + } + ); } return $enrolment_fee || 0; } @@ -1297,10 +1302,11 @@ sub _type { return 'Borrower'; } -=head1 AUTHOR +=head1 AUTHORS Kyle M Hall Alex Sassmannshausen +Martin Renvoize =cut -- 2.20.1