From 81e7ee15632a017e049c3c6fdb56d6c1a0372682 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 5831034bdc..ea52179e2b 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -25,7 +25,6 @@ use List::MoreUtils qw( uniq ); use JSON qw( to_json ); use Text::Unaccent qw( unac_string ); -use C4::Accounts; use C4::Context; use C4::Log; use Koha::AuthUtils; @@ -886,8 +885,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; } @@ -1333,10 +1338,11 @@ sub _type { return 'Borrower'; } -=head1 AUTHOR +=head1 AUTHORS Kyle M Hall Alex Sassmannshausen +Martin Renvoize =cut -- 2.19.2