From e3c5892f52d3d59d9aa03667d990110e3587ca6b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 22 Mar 2019 15:25:16 +0000 Subject: [PATCH] Bug 22563: Be more descriptive with accountypes Convert 'L' to 'LOST' to become more descriptive in it's use. Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- C4/Accounts.pm | 2 +- C4/Circulation.pm | 2 +- Koha/Account.pm | 12 ++++-- Koha/Account/Line.pm | 2 +- .../prog/en/includes/accounts.inc | 2 +- .../prog/en/modules/members/maninvoice.tt | 2 +- .../bootstrap/en/includes/account-table.inc | 2 +- opac/opac-user.pl | 2 +- t/db_dependent/Accounts.t | 40 +++++++++---------- t/db_dependent/Circulation.t | 10 ++--- 10 files changed, 41 insertions(+), 35 deletions(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index f7950e102a..4c01194c97 100644 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -91,7 +91,7 @@ sub chargelostitem{ my $existing_charges = $account->lines->search( { itemnumber => $itemnumber, - accounttype => 'L', + accounttype => 'LOST', } )->count(); diff --git a/C4/Circulation.pm b/C4/Circulation.pm index a622049310..3f9e392c25 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2407,7 +2407,7 @@ sub _FixAccountForLostAndReturned { my $accountlines = Koha::Account::Lines->search( { itemnumber => $itemnumber, - accounttype => 'L', + accounttype => 'LOST', }, { order_by => { -desc => [ 'date', 'accountlines_id' ] } diff --git a/Koha/Account.pm b/Koha/Account.pm index 4607fc2acb..a041600988 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -109,7 +109,10 @@ sub pay { $balance_remaining = $balance_remaining - $amount_to_pay; # Same logic exists in Koha::Account::Line::apply - if ( $new_amountoutstanding == 0 && $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) ) + if ( $new_amountoutstanding == 0 + && $fine->itemnumber + && $fine->accounttype + && ( $fine->accounttype eq 'LOST' ) ) { C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); } @@ -165,7 +168,10 @@ sub pay { $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); $fine->store(); - if ( $fine->amountoutstanding == 0 && $fine->itemnumber && $fine->accounttype && ( $fine->accounttype eq 'L' ) ) + if ( $fine->amountoutstanding == 0 + && $fine->itemnumber + && $fine->accounttype + && ( $fine->accounttype eq 'LOST' ) ) { C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); } @@ -727,7 +733,7 @@ our $account_type_credit = { our $account_type_debit = { 'account' => 'A', 'overdue' => 'OVERDUE', - 'lost_item' => 'L', + 'lost_item' => 'LOST', 'new_card' => 'N', 'sundry' => 'M', 'processing' => 'PF', diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 0df5a7e3c2..80582f3c17 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -226,7 +226,7 @@ sub apply { if ( $debit->amountoutstanding == 0 && $debit->itemnumber && $debit->accounttype - && $debit->accounttype eq 'L' ) + && $debit->accounttype eq 'LOST' ) { C4::Circulation::ReturnLostItem( $self->borrowernumber, $debit->itemnumber ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index 9b1be90c05..9b17ba0c4c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -8,7 +8,7 @@ [%- CASE 'OVERDUE' -%]Fine [%- CASE 'A' -%]Account management fee [%- CASE 'M' -%]Sundry - [%- CASE 'L' -%]Lost item + [%- CASE 'LOST' -%]Lost item [%- CASE 'W' -%]Writeoff [%- CASE 'HE' -%]Hold waiting too long [%- CASE 'Rent' -%]Rental fee diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt index 213641047a..7ce2a42997 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt @@ -79,7 +79,7 @@ [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %]