From 3fb6cf02895081adb8c3e259a7e5e4e4d659d269 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`. Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens --- 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.39.5