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

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>
This commit is contained in:
Martin Renvoize 2019-10-10 16:31:17 +01:00
parent 11bc809228
commit 56b38464bd
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
4 changed files with 17 additions and 17 deletions

View File

@ -444,8 +444,8 @@ my $debit_line = Koha::Account->new({ patron_id => $patron_id })->add_debit(
);
$debit_type can be any of:
- account
- account_renew
- ACCOUNT
- ACCOUNT_RENEW
- hold_expired
- lost_item
- sundry
@ -709,8 +709,8 @@ our $offset_type = {
'lost_item_return' => 'Lost Item',
'payment' => 'Payment',
'writeoff' => 'Writeoff',
'account' => 'Account Fee',
'account_renew' => 'Account Fee',
'ACCOUNT' => 'Account Fee',
'ACCOUNT_RENEW' => 'Account Fee',
'RESERVE' => 'Reserve Fee',
'PROCESSING' => 'Processing Fee',
'lost_item' => 'Lost Item',
@ -740,8 +740,8 @@ our $account_type_credit = {
=cut
our $account_type_debit = {
'account' => 'ACCOUNT',
'account_renew' => 'ACCOUNT_RENEW',
'ACCOUNT' => 'ACCOUNT',
'ACCOUNT_RENEW' => 'ACCOUNT_RENEW',
'hold_expired' => 'HE',
'lost_item' => 'LOST',
'sundry' => 'M',

View File

@ -887,7 +887,7 @@ sub add_enrolment_fee_if_needed {
my ($self, $renewal) = @_;
my $enrolment_fee = $self->category->enrolmentfee;
if ( $enrolment_fee && $enrolment_fee > 0 ) {
my $type = $renewal ? 'account_renew' : 'account';
my $type = $renewal ? 'ACCOUNT_RENEW' : 'ACCOUNT';
$self->account->add_debit(
{
amount => $enrolment_fee,

View File

@ -183,8 +183,8 @@ subtest "Koha::Account::pay tests" => sub {
my $account = Koha::Account->new({ patron_id => $borrower->id });
my $line1 = $account->add_debit({ type => 'account', amount => 100, interface => 'commandline' });
my $line2 = $account->add_debit({ type => 'account', amount => 200, interface => 'commandline' });
my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 100, interface => 'commandline' });
my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 200, interface => 'commandline' });
$sth = $dbh->prepare("SELECT count(*) FROM accountlines");
$sth->execute;
@ -283,7 +283,7 @@ subtest "Koha::Account::pay tests" => sub {
$note = $sth->fetchrow_array;
is($note,'$200.00 payment note', '$200.00 payment note is registered');
my $line3 = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' });
my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
my $payment_id = $account->pay( { lines => [$line3], amount => 42 } );
my $payment = Koha::Account::Lines->find( $payment_id );
is( $payment->amount(), '-42.000000', "Payment paid the specified fine" );
@ -311,10 +311,10 @@ subtest "Koha::Account::pay particular line tests" => sub {
my $account = Koha::Account->new({ patron_id => $borrower->id });
my $line1 = $account->add_debit({ type => 'account', amount => 1, interface => 'commandline' });
my $line2 = $account->add_debit({ type => 'account', amount => 2, interface => 'commandline' });
my $line3 = $account->add_debit({ type => 'account', amount => 3, interface => 'commandline' });
my $line4 = $account->add_debit({ type => 'account', amount => 4, interface => 'commandline' });
my $line1 = $account->add_debit({ type => 'ACCOUNT', amount => 1, interface => 'commandline' });
my $line2 = $account->add_debit({ type => 'ACCOUNT', amount => 2, interface => 'commandline' });
my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 3, interface => 'commandline' });
my $line4 = $account->add_debit({ type => 'ACCOUNT', amount => 4, interface => 'commandline' });
is( $account->balance(), 10, "Account balance is 10" );
@ -356,7 +356,7 @@ subtest "Koha::Account::pay writeoff tests" => sub {
my $account = Koha::Account->new({ patron_id => $borrower->id });
my $line = $account->add_debit({ type => 'account', amount => 42, interface => 'commandline' });
my $line = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
is( $account->balance(), 42, "Account balance is 42" );

View File

@ -106,9 +106,9 @@ subtest "FeePayment->pay tests" => sub {
my $account =
Koha::Account->new( { patron_id => $patron->{borrowernumber} } );
my $debt1 = $account->add_debit(
{ type => 'account', amount => 100, interface => 'commandline' } );
{ type => 'ACCOUNT', amount => 100, interface => 'commandline' } );
my $debt2 = $account->add_debit(
{ type => 'account', amount => 200, interface => 'commandline' } );
{ type => 'ACCOUNT', amount => 200, interface => 'commandline' } );
# Instantiate a new FeePayment transaction object
my $trans = C4::SIP::ILS::Transaction::FeePayment->new();