From c2026b6624f0f12e012be81741b3752444de3c14 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 17 Mar 2021 14:12:37 +0000 Subject: [PATCH] Bug 24300: (QA follow-up) Update payout_amount to use internal methods Tomas pointed out that we could, and probably should, use the internal 'add_debit' method within this function. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- Koha/Account.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index bbf2c69ab8..a90877a8a1 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -692,20 +692,18 @@ sub payout_amount { sub { # A 'payout' is a 'debit' - $payout = Koha::Account::Line->new( + $payout = $self->add_debit( { - date => \'NOW()', - amount => $amount, - debit_type_code => 'PAYOUT', + amount => $params->{amount}, + type => 'PAYOUT', payment_type => $params->{payout_type}, - amountoutstanding => $amount, + amountoutstanding => $params->{amount}, manager_id => $params->{staff_id}, - borrowernumber => $self->{patron_id}, interface => $params->{interface}, branchcode => $params->{branch}, register_id => $params->{cash_register} } - )->store(); + ); # Offset against credits for my $credit ( @{$outstanding_credits} ) { -- 2.39.5