From 5d8f9244cc5b6a48d1a1f03b8d194e403ef3cbef Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 16 Mar 2021 17:12:07 +0000 Subject: [PATCH] Bug 22435: Use 'CREATE' offset type in Koha::Account This patch updates the Koha::Account methods for adding debits and credits to use the 'CREATE' offset type for the creation record. --- Koha/Account.pm | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 94bf73511a..a558a531df 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -64,7 +64,6 @@ Koha::Account->new( { patron_id => $borrowernumber } )->pay( library_id => $branchcode, lines => $lines, # Arrayref of Koha::Account::Line objects to pay credit_type => $type, # credit_type_code code - offset_type => $offset_type, # offset type code item_id => $itemnumber, # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND) } ); @@ -82,7 +81,6 @@ sub pay { my $type = $params->{type} || 'PAYMENT'; my $payment_type = $params->{payment_type} || undef; my $credit_type = $params->{credit_type}; - my $offset_type = $params->{offset_type} || $type eq 'WRITEOFF' ? 'Writeoff' : 'Payment'; my $cash_register = $params->{cash_register}; my $item_id = $params->{item_id}; @@ -152,7 +150,7 @@ sub pay { my $account_offset = Koha::Account::Offset->new( { debit_id => $fine->id, - type => $offset_type, + type => 'CREATE', amount => $amount_to_pay * -1, } ); @@ -223,7 +221,7 @@ sub pay { my $account_offset = Koha::Account::Offset->new( { debit_id => $fine->id, - type => $offset_type, + type => 'CREATE', amount => $amount_to_pay * -1, } ); @@ -432,8 +430,8 @@ sub add_credit { my $account_offset = Koha::Account::Offset->new( { credit_id => $line->id, - type => $Koha::Account::offset_type->{$credit_type} // $Koha::Account::offset_type->{CREDIT}, - amount => $amount + type => 'CREATE', + amount => $amount } )->store(); @@ -640,7 +638,6 @@ sub add_debit { my $debit_type = $params->{type}; my $item_id = $params->{item_id}; my $issue_id = $params->{issue_id}; - my $offset_type = $Koha::Account::offset_type->{$debit_type} // 'Manual Debit'; my $line; my $schema = Koha::Database->new->schema; @@ -676,7 +673,7 @@ sub add_debit { my $account_offset = Koha::Account::Offset->new( { debit_id => $line->id, - type => $offset_type, + type => 'CREATE', amount => $amount } )->store(); @@ -955,32 +952,6 @@ sub reconcile_balance { 1; -=head2 Name mappings - -=head3 $offset_type - -=cut - -our $offset_type = { - 'CREDIT' => 'Manual Credit', - 'FORGIVEN' => 'Writeoff', - 'LOST_FOUND' => 'Lost Item Found', - 'OVERPAYMENT' => 'Overpayment', - 'PAYMENT' => 'Payment', - 'WRITEOFF' => 'Writeoff', - 'ACCOUNT' => 'Account Fee', - 'ACCOUNT_RENEW' => 'Account Fee', - 'RESERVE' => 'Reserve Fee', - 'PROCESSING' => 'Processing Fee', - 'LOST' => 'Lost Item', - 'RENT' => 'Rental Fee', - 'RENT_DAILY' => 'Rental Fee', - 'RENT_RENEW' => 'Rental Fee', - 'RENT_DAILY_RENEW' => 'Rental Fee', - 'OVERDUE' => 'OVERDUE', - 'RESERVE_EXPIRED' => 'Hold Expired' -}; - =head1 AUTHORS =encoding utf8 -- 2.20.1