From 859217c1f5c8513bc0bdb8d31b7421e86ad3b355 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 23 Apr 2019 18:05:05 +0100 Subject: [PATCH] Bug 11573: Make rental accountlines translatable To test: 1. Set up an item type with a rental charge 2. Issue an item with that item type 3. Check fines, a charge of type 'Rent' will be visible with a description of 'Rental'. 4. Renew the item 5. Check fines, a charge of type 'Rent' will be visible with a description of 'Renewal of Rental Item TITLE BARCODE' where TITLE and BARCODE are the items title and barcode. 5. Apply the patch 6. Repeat steps 1-4, charge descriptions should now be empty and charge types should display 'Rental fee' and 'Renewal of rental item'. 7. Repeat steps 1-6 for an item type with a daily rental charge and note the charge types are now 'Daily rental fee' and 'Renewal of daily rental item' Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- C4/Circulation.pm | 18 +++----- Koha/Account.pm | 29 +++++++----- .../prog/en/includes/accounts.inc | 43 +++++++++--------- .../bootstrap/en/includes/account-table.inc | 45 ++++++++++--------- 4 files changed, 73 insertions(+), 62 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index de4dc99ed3..9961d38077 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1470,15 +1470,14 @@ sub AddIssue { # If it costs to borrow this book, charge it to the patron's account. my ( $charge, $itemtype ) = GetIssuingCharges( $item_object->itemnumber, $borrower->{'borrowernumber'} ); if ( $charge > 0 ) { - my $description = "Rental"; - AddIssuingCharge( $issue, $charge, $description ); + AddIssuingCharge( $issue, $charge, 'rent' ); } my $itemtype_object = Koha::ItemTypes->find( $item_object->effective_itemtype ); if ( $itemtype_object ) { my $accumulate_charge = $fees->accumulate_rentalcharge(); if ( $accumulate_charge > 0 ) { - AddIssuingCharge( $issue, $accumulate_charge, 'Daily rental' ) if $accumulate_charge > 0; + AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily' ) if $accumulate_charge > 0; $charge += $accumulate_charge; $item_unblessed->{charge} = $charge; } @@ -2912,8 +2911,7 @@ sub AddRenewal { # Charge a new rental fee, if applicable my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); if ( $charge > 0 ) { - my $description = "Renewal of Rental Item " . $biblio->title . " " .$item_object->barcode; - AddIssuingCharge($issue, $charge, $description); + AddIssuingCharge($issue, $charge, 'rent_renew'); } # Charge a new accumulate rental fee, if applicable @@ -2921,8 +2919,7 @@ sub AddRenewal { if ( $itemtype_object ) { my $accumulate_charge = $fees->accumulate_rentalcharge(); if ( $accumulate_charge > 0 ) { - my $type_desc = "Renewal of Daily Rental Item " . $biblio->title . " $item_unblessed->{'barcode'}"; - AddIssuingCharge( $issue, $accumulate_charge, $type_desc ) + AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renew' ) } $charge += $accumulate_charge; } @@ -3244,12 +3241,12 @@ sub _get_discount_from_rule { =head2 AddIssuingCharge - &AddIssuingCharge( $checkout, $charge, [$description] ) + &AddIssuingCharge( $checkout, $charge, $type ) =cut sub AddIssuingCharge { - my ( $checkout, $charge, $description ) = @_; + my ( $checkout, $charge, $type ) = @_; # FIXME What if checkout does not exist? @@ -3257,12 +3254,11 @@ sub AddIssuingCharge { my $accountline = $account->add_debit( { amount => $charge, - description => $description, note => undef, user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, interface => C4::Context->interface, - type => 'rent', + type => $type, item_id => $checkout->itemnumber, issue_id => $checkout->issue_id, } diff --git a/Koha/Account.pm b/Koha/Account.pm index ddee843390..453a1e4db2 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -444,6 +444,9 @@ $debit_type can be any of: - sundry - processing - rent + - rent_daily + - rent_renewal + - rent_daily_renewal - reserve - manual @@ -709,6 +712,9 @@ our $offset_type = { 'processing' => 'Processing Fee', 'lost_item' => 'Lost Item', 'rent' => 'Rental Fee', + 'rent_daily' => 'Rental Fee', + 'rent_renew' => 'Rental Fee', + 'rent_daily_renew' => 'Rental Fee', 'overdue' => 'OVERDUE', 'manual_debit' => 'Manual Debit', 'hold_expired' => 'Hold Expired' @@ -731,16 +737,19 @@ our $account_type_credit = { =cut our $account_type_debit = { - 'account' => 'A', - 'overdue' => 'OVERDUE', - 'lost_item' => 'LOST', - 'new_card' => 'N', - 'sundry' => 'M', - 'processing' => 'PF', - 'rent' => 'Rent', - 'reserve' => 'Res', - 'manual_debit' => 'M', - 'hold_expired' => 'HE' + 'account' => 'A', + 'overdue' => 'OVERDUE', + 'lost_item' => 'LOST', + 'new_card' => 'N', + 'sundry' => 'M', + 'processing' => 'PF', + 'rent' => 'RENT', + 'rent_daily' => 'RENT_DAILY', + 'rent_renew' => 'RENT_RENEW', + 'rent_daily_renew' => 'RENT_DAILY_RENEW', + 'reserve' => 'Res', + 'manual_debit' => 'M', + 'hold_expired' => 'HE' }; =head1 AUTHORS diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index e221af6525..fb8dabda89 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -1,25 +1,28 @@ [%- BLOCK account_type_description -%] [%- SWITCH account.accounttype -%] - [%- CASE 'Pay' -%]Payment - [%- CASE 'Pay00' -%]Payment (cash via SIP2) - [%- CASE 'Pay01' -%]Payment (VISA via SIP2) - [%- CASE 'Pay02' -%]Payment (credit card via SIP2) - [%- CASE 'N' -%]New card - [%- CASE 'OVERDUE' -%]Fine - [%- CASE 'A' -%]Account management fee - [%- CASE 'M' -%]Sundry - [%- CASE 'LOST' -%]Lost item - [%- CASE 'W' -%]Writeoff - [%- CASE 'HE' -%]Hold waiting too long - [%- CASE 'Rent' -%]Rental fee - [%- CASE 'FOR' -%]Forgiven - [%- CASE 'PF' -%]Lost item processing fee - [%- CASE 'PAY' -%]Payment - [%- CASE 'WO' -%]Writeoff - [%- CASE 'C' -%]Credit - [%- CASE 'LOST_RETURN' -%]Lost item fee refund - [%- CASE 'Res' -%]Hold fee - [%- CASE -%][% account.accounttype | html %] + [%- CASE 'Pay' -%]Payment + [%- CASE 'Pay00' -%]Payment (cash via SIP2) + [%- CASE 'Pay01' -%]Payment (VISA via SIP2) + [%- CASE 'Pay02' -%]Payment (credit card via SIP2) + [%- CASE 'N' -%]New card + [%- CASE 'OVERDUE' -%]Fine + [%- CASE 'A' -%]Account management fee + [%- CASE 'M' -%]Sundry + [%- CASE 'LOST' -%]Lost item + [%- CASE 'W' -%]Writeoff + [%- CASE 'HE' -%]Hold waiting too long + [%- CASE 'RENT' -%]Rental fee + [%- CASE 'RENT_DAILY' -%]Daily rental fee + [%- CASE 'RENT_RENEW' -%]Renewal of rental item + [%- CASE 'RENT_DAILY_RENEW' -%]Rewewal of daily rental item + [%- CASE 'FOR' -%]Forgiven + [%- CASE 'PF' -%]Lost item processing fee + [%- CASE 'PAY' -%]Payment + [%- CASE 'WO' -%]Writeoff + [%- CASE 'C' -%]Credit + [%- CASE 'LOST_RETURN' -%]Lost item fee refund + [%- CASE 'Res' -%]Hold fee + [%- CASE -%][% account.accounttype | html %] [%- END -%] [%- PROCESS account_status_description account=account -%] [%- END -%] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc index 230ff9c435..6a0546bca7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc @@ -118,27 +118,30 @@ [%- BLOCK account_type_description -%] [%- SWITCH account.accounttype -%] - [%- CASE 'Pay' -%]Payment - [%- CASE 'Pay00' -%]Payment (cash via SIP2) - [%- CASE 'Pay01' -%]Payment (VISA via SIP2) - [%- CASE 'Pay02' -%]Payment (credit card via SIP2) - [%- CASE 'N' -%]New card - [%- CASE 'OVERDUE' -%]Fine - [%- CASE 'A' -%]Account management fee - [%- CASE 'M' -%]Sundry - [%- CASE 'LOST' -%]Lost item - [%- CASE 'W' -%]Writeoff - [%- CASE 'HE' -%]Hold waiting too long - [%- CASE 'Rent' -%]Rental fee - [%- CASE 'FOR' -%]Forgiven - [%- CASE 'LR' -%]Lost item fee refund - [%- CASE 'PF' -%]Lost item processing fee - [%- CASE 'PAY' -%]Payment - [%- CASE 'WO' -%]Writeoff - [%- CASE 'C' -%]Credit - [%- CASE 'CR' -%]Credit - [%- CASE 'Res' -%]Hold fee - [%- CASE -%][% account.accounttype | html %] + [%- CASE 'Pay' -%]Payment + [%- CASE 'Pay00' -%]Payment (cash via SIP2) + [%- CASE 'Pay01' -%]Payment (VISA via SIP2) + [%- CASE 'Pay02' -%]Payment (credit card via SIP2) + [%- CASE 'VOID' -%]Voided + [%- CASE 'N' -%]New card + [%- CASE 'OVERDUE' -%]Fine + [%- CASE 'A' -%]Account management fee + [%- CASE 'M' -%]Sundry + [%- CASE 'LOST' -%]Lost item + [%- CASE 'W' -%]Writeoff + [%- CASE 'HE' -%]Hold waiting too long + [%- CASE 'RENT' -%]Rental fee + [%- CASE 'RENT_DAILY' -%]Daily rental fee + [%- CASE 'RENT_RENEW' -%]Renewal of rental item + [%- CASE 'RENT_DAILT_RENEW' -%]Renewal of dailt rental item + [%- CASE 'FOR' -%]Forgiven + [%- CASE 'PF' -%]Lost item processing fee + [%- CASE 'PAY' -%]Payment + [%- CASE 'WO' -%]Writeoff + [%- CASE 'C' -%]Credit + [%- CASE 'LOST_RETURN' -%]Lost item fee refund + [%- CASE 'Res' -%]Hold fee + [%- CASE -%][% account.accounttype | html %] [%- END -%] [%- PROCESS account_status_description account=account -%] [%- END -%] -- 2.39.5