Browse Source

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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Martin Renvoize 5 years ago
committed by Nick Clemens
parent
commit
f68fec12df
  1. 2
      Koha/Account.pm
  2. 3
      Koha/Account/Line.pm
  3. 8
      misc/cronjobs/staticfines.pl
  4. 4
      t/db_dependent/Circulation.t
  5. 6
      t/db_dependent/Koha/Account/Lines.t

2
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();

3
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();

8
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 );
}
}

4
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();

6
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' );

Loading…
Cancel
Save