Browse Source

Bug 23049: Capitalise type passed to add_debit for `rent`

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 3 years ago
parent
commit
c97705d190
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 8
      C4/Circulation.pm
  2. 24
      Koha/Account.pm
  3. 2
      t/db_dependent/Accounts.t
  4. 2
      t/db_dependent/Circulation/issue.t
  5. 12
      t/db_dependent/Koha/Account.t

8
C4/Circulation.pm

@ -1468,14 +1468,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 ) {
AddIssuingCharge( $issue, $charge, 'rent' );
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, 'rent_daily' ) if $accumulate_charge > 0;
AddIssuingCharge( $issue, $accumulate_charge, 'RENT_DAILY' ) if $accumulate_charge > 0;
$charge += $accumulate_charge;
$item_unblessed->{charge} = $charge;
}
@ -2911,7 +2911,7 @@ sub AddRenewal {
# Charge a new rental fee, if applicable
my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber );
if ( $charge > 0 ) {
AddIssuingCharge($issue, $charge, 'rent_renew');
AddIssuingCharge($issue, $charge, 'RENT_RENEW');
}
# Charge a new accumulate rental fee, if applicable
@ -2919,7 +2919,7 @@ sub AddRenewal {
if ( $itemtype_object ) {
my $accumulate_charge = $fees->accumulate_rentalcharge();
if ( $accumulate_charge > 0 ) {
AddIssuingCharge( $issue, $accumulate_charge, 'rent_daily_renew' )
AddIssuingCharge( $issue, $accumulate_charge, 'RENT_DAILY_RENEW' )
}
$charge += $accumulate_charge;
}

24
Koha/Account.pm

@ -452,10 +452,10 @@ $debit_type can be any of:
- new_card
- overdue
- processing
- rent
- rent_daily
- rent_renew
- rent_daily_renew
- RENT
- RENT_DAILY
- RENT_RENEW
- RENT_DAILY_RENEW
- RESERVE
- manual_debit
@ -714,10 +714,10 @@ our $offset_type = {
'RESERVE' => 'Reserve Fee',
'processing' => 'Processing Fee',
'lost_item' => 'Lost Item',
'rent' => 'Rental Fee',
'rent_daily' => 'Rental Fee',
'rent_renew' => 'Rental Fee',
'rent_daily_renew' => 'Rental Fee',
'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'
@ -748,10 +748,10 @@ our $account_type_debit = {
'new_card' => 'N',
'overdue' => 'OVERDUE',
'processing' => 'PF',
'rent' => 'RENT',
'rent_daily' => 'RENT_DAILY',
'rent_renew' => 'RENT_RENEW',
'rent_daily_renew' => 'RENT_DAILY_RENEW',
'RENT' => 'RENT',
'RENT_DAILY' => 'RENT_DAILY',
'RENT_RENEW' => 'RENT_RENEW',
'RENT_DAILY_RENEW' => 'RENT_DAILY_RENEW',
'RESERVE' => 'RESERVE',
'manual_debit' => 'M'
};

2
t/db_dependent/Accounts.t

@ -782,7 +782,7 @@ subtest "Koha::Account::non_issues_charges tests" => sub {
$account->add_debit(
{
description => 'a Rental fee',
type => 'rent',
type => 'RENT',
amount => $rent,
interface => 'commandline'
}

2
t/db_dependent/Circulation/issue.t

@ -211,7 +211,7 @@ $sth->execute;
my $countaccount = $sth->fetchrow_array;
is ($countaccount,0,"0 accountline exists");
my $checkout = Koha::Checkouts->find( $issue_id1 );
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10, 'rent' );
my $charge = C4::Circulation::AddIssuingCharge( $checkout, 10, 'RENT' );
is( ref( $charge ), 'Koha::Account::Line', "An issuing charge has been added" );
is( $charge->issue_id, $issue_id1, 'Issue id is set correctly for issuing charge' );
my $offset = Koha::Account::Offsets->find( { debit_id => $charge->id } );

12
t/db_dependent/Koha/Account.t

@ -290,7 +290,7 @@ subtest 'add_debit() tests' => sub {
description => 'amount validation failure',
library_id => $patron->branchcode,
note => 'this should fail anyway',
type => 'rent',
type => 'RENT',
user_id => $patron->id,
interface => 'commandline'
}
@ -316,7 +316,7 @@ subtest 'add_debit() tests' => sub {
description => 'Rental charge of 25',
library_id => $patron->branchcode,
note => 'not really important',
type => 'rent',
type => 'RENT',
user_id => $patron->id
}
); } 'Koha::Exceptions::MissingParameter', 'Exception thrown if interface parameter missing';
@ -330,7 +330,7 @@ subtest 'add_debit() tests' => sub {
description => 'Rental charge of 25',
library_id => $patron->branchcode,
note => 'not really important',
type => 'rent',
type => 'RENT',
user_id => $patron->id,
interface => 'commandline'
}
@ -344,7 +344,7 @@ subtest 'add_debit() tests' => sub {
);
is(
$line_1->debit_type_code,
$Koha::Account::account_type_debit->{'rent'},
$Koha::Account::account_type_debit->{'RENT'},
'Account type is correctly set'
);
@ -357,7 +357,7 @@ subtest 'add_debit() tests' => sub {
description => 'Rental charge of 37',
library_id => $patron->branchcode,
note => 'not really important',
type => 'rent',
type => 'RENT',
user_id => $patron->id,
interface => 'commandline'
}
@ -371,7 +371,7 @@ subtest 'add_debit() tests' => sub {
);
is(
$line_2->debit_type_code,
$Koha::Account::account_type_debit->{'rent'},
$Koha::Account::account_type_debit->{'RENT'},
'Account type is correctly set'
);

Loading…
Cancel
Save