@@ -, +, @@ --- C4/Circulation.pm | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3213,33 +3213,19 @@ sub AddIssuingCharge { # FIXME What if checkout does not exist? - my $nextaccntno = C4::Accounts::getnextacctno( $checkout->borrowernumber ); - - my $manager_id = 0; - $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; - - my $accountline = Koha::Account::Line->new( - { - borrowernumber => $checkout->borrowernumber, - itemnumber => $checkout->itemnumber, - issue_id => $checkout->issue_id, - accountno => $nextaccntno, - amount => $charge, - amountoutstanding => $charge, - manager_id => $manager_id, - description => 'Rental', - accounttype => 'Rent', - date => \'NOW()', - } - )->store(); - - Koha::Account::Offset->new( + my $account = Koha::Account->new({ patron_id => $checkout->borrowernumber }); + my $accountline = $account->add_debit( { - debit_id => $accountline->id, - type => 'Rental Fee', - amount => $charge, + amount => $charge, + description => 'Rental', + note => undef, + user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0, + library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, + type => 'rent', + item_id => $checkout->itemnumber, + issue_id => $checkout->issue_id, } - )->store(); + ); } =head2 GetTransfers --