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 <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2018-12-15 15:58:46 +00:00 committed by Nick Clemens
parent c0df2d0e86
commit 3fb6cf0289

View file

@ -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 <kyle@bywatersolutions.com>
Alex Sassmannshausen <alex.sassmannshausen@ptfs-europe.com>
Martin Renvoize <martin.renvoize@ptfs-europe.com>
=cut