From af6464d05b00656474b7bd0211dd540f48a12bc1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 10 Oct 2019 16:48:41 +0100 Subject: [PATCH] Bug 23049: Capitalise type passed to add_debit for `overdue` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Séverine QUEUNE Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- C4/Overdues.pm | 2 +- Koha/Account.pm | 8 ++--- t/db_dependent/Circulation.t | 8 ++--- t/db_dependent/Koha/Account.t | 48 ++++++++++++++--------------- t/db_dependent/Koha/Account/Lines.t | 2 +- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index d97cde98de..14c5980414 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -587,7 +587,7 @@ sub UpdateFine { user_id => undef, interface => C4::Context->interface, library_id => undef, #FIXME: Should we grab the checkout or circ-control branch here perhaps? - type => 'overdue', + type => 'OVERDUE', item_id => $itemnum, issue_id => $issue_id, } diff --git a/Koha/Account.pm b/Koha/Account.pm index 33b65f5c58..91f5879c1c 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -450,7 +450,7 @@ $debit_type can be any of: - LOST - sundry - new_card - - overdue + - OVERDUE - PROCESSING - RENT - RENT_DAILY @@ -516,7 +516,7 @@ sub add_debit { itemnumber => $item_id, issue_id => $issue_id, branchcode => $library_id, - ( $type eq 'overdue' ? ( status => 'UNRETURNED' ) : () ), + ( $type eq 'OVERDUE' ? ( status => 'UNRETURNED' ) : () ), } )->store(); @@ -717,7 +717,7 @@ our $offset_type = { 'RENT_DAILY' => 'Rental Fee', 'RENT_RENEW' => 'Rental Fee', 'RENT_DAILY_RENEW' => 'Rental Fee', - 'overdue' => 'OVERDUE', + 'OVERDUE' => 'OVERDUE', 'RESERVE_EXPIRED' => 'Hold Expired' }; @@ -743,7 +743,7 @@ our $account_type_debit = { 'RESERVE_EXPIRED' => 'RESERVE_EXPIRED', 'LOST_ITEM' => 'LOST', 'new_card' => 'N', - 'overdue' => 'OVERDUE', + 'OVERDUE' => 'OVERDUE', 'PROCESSING' => 'PROCESSING', 'RENT' => 'RENT', 'RENT_DAILY' => 'RENT_DAILY', diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 4d6f49cb87..f0002c5e0f 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -745,7 +745,7 @@ subtest "CanBookBeRenewed tests" => sub { { amount => $fines_amount, interface => 'test', - type => 'overdue', + type => 'OVERDUE', item_id => $item_to_auto_renew->{itemnumber}, description => "Some fines" } @@ -759,7 +759,7 @@ subtest "CanBookBeRenewed tests" => sub { { amount => $fines_amount, interface => 'test', - type => 'overdue', + type => 'OVERDUE', item_id => $item_to_auto_renew->{itemnumber}, description => "Some fines" } @@ -773,7 +773,7 @@ subtest "CanBookBeRenewed tests" => sub { { amount => $fines_amount, interface => 'test', - type => 'overdue', + type => 'OVERDUE', item_id => $item_to_auto_renew->{itemnumber}, description => "Some fines" } @@ -2450,7 +2450,7 @@ subtest '_FixAccountForLostAndReturned' => sub { ); my $manual_debit_amount = 80; - $account->add_debit( { amount => $manual_debit_amount, type => 'overdue', interface =>'test' } ); + $account->add_debit( { amount => $manual_debit_amount, type => 'OVERDUE', interface =>'test' } ); is( $account->balance, $manual_debit_amount + $replacement_amount - $payment_amount, 'Manual debit applied' ); diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index de949208a4..02efbd1c04 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -60,10 +60,10 @@ subtest 'outstanding_debits() tests' => sub { my $account = $patron->account; my @generated_lines; - push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); - push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); + push @generated_lines, $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + push @generated_lines, $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + push @generated_lines, $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); + push @generated_lines, $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); my $lines = $account->outstanding_debits(); my @lines_arr = $account->outstanding_debits(); @@ -405,10 +405,10 @@ subtest 'lines() tests' => sub { $account->add_credit({ amount => 4, interface => 'commandline' }); # Add Debits - $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); + $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); # Paid Off $account->add_credit( { amount => 1, interface => 'commandline' } ) @@ -441,10 +441,10 @@ subtest 'reconcile_balance' => sub { $account->add_credit({ amount => 5, interface => 'commandline' }); # Add Debits - $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); + $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); # Paid Off Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; @@ -479,10 +479,10 @@ subtest 'reconcile_balance' => sub { $account->add_credit({ amount => 4, interface => 'commandline' }); # Add Debits - $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); + $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); # Paid Off Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; @@ -517,11 +517,11 @@ subtest 'reconcile_balance' => sub { $account->add_credit({ amount => 4, interface => 'commandline' }); # Add Debits - $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 4, interface => 'commandline', type => 'overdue' }); - $account->add_debit({ amount => 5, interface => 'commandline', type => 'overdue' }); + $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 4, interface => 'commandline', type => 'OVERDUE' }); + $account->add_debit({ amount => 5, interface => 'commandline', type => 'OVERDUE' }); # Paid Off Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0, interface => 'commandline' })->store; @@ -554,9 +554,9 @@ subtest 'reconcile_balance' => sub { $account->add_credit({ amount => 3, interface => 'commandline' }); # Add Debits - my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'overdue' }); - my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'overdue' }); - my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'overdue' }); + my $debit_1 = $account->add_debit({ amount => 1, interface => 'commandline', type => 'OVERDUE' }); + my $debit_2 = $account->add_debit({ amount => 2, interface => 'commandline', type => 'OVERDUE' }); + my $debit_3 = $account->add_debit({ amount => 3, interface => 'commandline', type => 'OVERDUE' }); is( $account->balance(), 2, "Account balance is 2" ); is( $account->outstanding_debits->total_outstanding, 6, 'Outstanding debits sum 6' ); diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t index 9a0a101eef..31ff05fd5e 100755 --- a/t/db_dependent/Koha/Account/Lines.t +++ b/t/db_dependent/Koha/Account/Lines.t @@ -497,7 +497,7 @@ subtest 'checkout() tests' => sub { interface => 'commandline', item_id => $item->itemnumber, issue_id => $checkout->issue_id, - type => 'overdue', + type => 'OVERDUE', }); my $line_checkout = $line->checkout; -- 2.39.5