From f68fec12df1ad2f7a44b905dc24f0306604f521a 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 Signed-off-by: Kyle M Hall Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens --- Koha/Account.pm | 2 -- Koha/Account/Line.pm | 3 +-- misc/cronjobs/staticfines.pl | 8 ++++---- t/db_dependent/Circulation.t | 4 +--- t/db_dependent/Koha/Account/Lines.t | 6 +----- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index ddd60127ef..b57c1e6761 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -346,7 +346,6 @@ sub add_credit { manager_id => $user_id, branchcode => $library_id, itemnumber => $item_id, - lastincrement => undef, } )->store(); @@ -472,7 +471,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 0338a5b6d9..ef9f4f9063 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 5803c89a2a..5fee7f4909 100755 --- a/misc/cronjobs/staticfines.pl +++ b/misc/cronjobs/staticfines.pl @@ -228,11 +228,11 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { my $desc = "staticfine"; my $query = "INSERT INTO accountlines - (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement) - VALUES (?,?,now(),?,?,'F',?,?)"; + (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding) + VALUES (?,?,now(),?,?,'F',?)"; my $sth2 = $dbh->prepare($query); - $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount, $amount\n"; - $sth2->execute( $borrowernumber, $itemnumber, $amount, $desc, $amount, $amount ); + $bigdebug and warn "query: $query\nw/ args: $borrowernumber, $itemnumber, $amount, $desc, $amount\n"; + $sth2->execute( $borrowernumber, $itemnumber, $amount, $desc, $amount ); } } diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index fa4e6342ac..7cd55479c4 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; @@ -849,7 +849,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' ); @@ -2381,7 +2380,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 aafda5f43d..2539754184 100755 --- a/t/db_dependent/Koha/Account/Lines.t +++ b/t/db_dependent/Koha/Account/Lines.t @@ -316,7 +316,7 @@ subtest 'Keep account info when related patron, staff or item is deleted' => sub subtest 'adjust() tests' => sub { - plan tests => 33; + plan tests => 29; $schema->storage->txn_begin; @@ -360,7 +360,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' ); @@ -386,7 +385,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' ); @@ -401,7 +399,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' ); @@ -413,7 +410,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.39.5