From 6278316ec79874118b54a75ab2420a02ad0f7e96 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 15 Mar 2019 08:38:17 +0000 Subject: [PATCH] Bug 22516: Remove remaining calls to lastincrement A few places still set lastincrement and the tests still checked for correct values. But nowhere in the code still uses lastincrement for anything meaningful. Signed-off-by: Martin Renvoize --- Koha/Account.pm | 2 -- Koha/Account/Line.pm | 3 +-- misc/cronjobs/staticfines.pl | 4 ++-- t/db_dependent/Circulation.t | 4 +--- t/db_dependent/Koha/Account/Lines.t | 6 +----- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 2bcd062d7d..6c9d35207f 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -363,7 +363,6 @@ sub add_credit { manager_id => $user_id, branchcode => $library_id, itemnumber => $item_id, - lastincrement => undef, } )->store(); @@ -495,7 +494,6 @@ sub add_debit { itemnumber => $item_id, issue_id => $issue_id, branchcode => $library_id, - ( $type eq 'fine' ? ( lastincrement => $amount ) : ()), } )->store(); diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 5029c4ba34..f57b0b823f 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -297,8 +297,7 @@ sub adjust { { date => \'NOW()', amount => $amount, - amountoutstanding => $new_outstanding, - ( $update_type eq 'fine_update' ? ( lastincrement => $difference ) : ()), + amountoutstanding => $new_outstanding } )->store(); diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl index bee1172482..590c9284fd 100755 --- a/misc/cronjobs/staticfines.pl +++ b/misc/cronjobs/staticfines.pl @@ -229,10 +229,10 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); my $desc = "staticfine"; my $query = "INSERT INTO accountlines - (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno) + (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,accountno) VALUES (?,?,now(),?,?,'F',?,?,?)"; my $sth2 = $dbh->prepare($query); - $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount, $amount, $nextaccntno\n"; + $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount, $nextaccntno\n"; $sth2->execute( $borrowernumber, $itemnumber, $amount, $desc, $amount, $amount, $nextaccntno ); } diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index c478a42f47..75d860f0b6 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -18,7 +18,7 @@ use Modern::Perl; use utf8; -use Test::More tests => 126; +use Test::More tests => 125; use Test::MockModule; use Data::Dumper; @@ -827,7 +827,6 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 ); my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next(); is( $line->accounttype, 'FU', 'Account line type is FU' ); - is( $line->lastincrement, '15.000000', 'Account line last increment is 15.00' ); is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' ); is( $line->amount, '15.000000', 'Account line amount is 15.00' ); is( $line->issue_id, $issue->id, 'Account line issue id matches' ); @@ -2356,7 +2355,6 @@ subtest '_FixOverduesOnReturn' => sub { itemnumber => $item->itemnumber, amount => 99.00, amountoutstanding => 99.00, - lastincrement => 9.00, } )->store(); diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t index e5b5d9fe0b..4095d0f707 100755 --- a/t/db_dependent/Koha/Account/Lines.t +++ b/t/db_dependent/Koha/Account/Lines.t @@ -303,7 +303,7 @@ subtest 'Keep account info when a patron is deleted' => sub { subtest 'adjust() tests' => sub { - plan tests => 33; + plan tests => 29; $schema->storage->txn_begin; @@ -347,7 +347,6 @@ subtest 'adjust() tests' => sub { is( $debit_2->amount * 1, 150, 'Fine amount was updated in full' ); is( $debit_2->amountoutstanding * 1, 150, 'Fine amountoutstanding was update in full' ); isnt( $debit_2->date, undef, 'Date has been set' ); - is( $debit_2->lastincrement * 1, 50, 'lastincrement is the to the right value' ); my $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); is( $offsets->count, 1, 'An offset is generated for the increment' ); @@ -373,7 +372,6 @@ subtest 'adjust() tests' => sub { is( $debit_2->amount * 1, 160, 'Fine amount was updated in full' ); is( $debit_2->amountoutstanding * 1, 120, 'Fine amountoutstanding was updated by difference' ); - is( $debit_2->lastincrement * 1, 10, 'lastincrement is the to the right value' ); $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); is( $offsets->count, 3, 'An offset is generated for the increment' ); @@ -388,7 +386,6 @@ subtest 'adjust() tests' => sub { is( $debit_2->amount * 1, 50, 'Fine amount was updated in full' ); is( $debit_2->amountoutstanding * 1, 10, 'Fine amountoutstanding was updated by difference' ); - is( $debit_2->lastincrement * 1, -110, 'lastincrement is the to the right value' ); $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); is( $offsets->count, 4, 'An offset is generated for the decrement' ); @@ -400,7 +397,6 @@ subtest 'adjust() tests' => sub { $debit_2->adjust( { amount => 30, type => 'fine_update' } )->discard_changes; is( $debit_2->amount * 1, 30, 'Fine amount was updated in full' ); is( $debit_2->amountoutstanding * 1, 0, 'Fine amountoutstanding was zeroed (payment was 40)' ); - is( $debit_2->lastincrement * 1, -20, 'lastincrement is the to the right value' ); $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); is( $offsets->count, 5, 'An offset is generated for the decrement' ); -- 2.20.1