From de2a368f6b4ce75a59b1833260bc7dff4ada76ca Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Fri, 9 Nov 2018 17:19:31 +0000 Subject: [PATCH] Bug 21683: (follow-up) Polish the change - based on feedback --- C4/Circulation.pm | 2 +- misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl | 4 ++-- t/db_dependent/Stats.t | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2067fb0954..dabe531279 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2402,7 +2402,7 @@ sub _FixAccountForLostAndReturned { accounttype => { -in => [ 'L', 'Rep', 'W' ] }, }, { - order_by => { -desc => [ 'date' ] } + order_by => { -desc => [ 'date', 'accountlines_id' ] } } ); diff --git a/misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl b/misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl index b637547ef4..96ec288961 100755 --- a/misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl +++ b/misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl @@ -98,13 +98,13 @@ foreach my $keeper (@$results) { } my $sql = - "DELETE FROM accountlines WHERE accountlines_id = ? LIMIT 1"; + "DELETE FROM accountlines WHERE accountlines_id = ?"; $dbh->do( $sql, undef, $f->{'accountlines_id'} ); } if ($has_changed) { my $sql = - "UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ? LIMIT 1"; + "UPDATE accountlines SET amountoutstanding = ? WHERE accountlines_id = ?"; $dbh->do( $sql, undef, $keeper->{'amountoutstanding'}, $keeper->{'accountlines_id'} diff --git a/t/db_dependent/Stats.t b/t/db_dependent/Stats.t index c97efaf274..6b8fd7fb19 100644 --- a/t/db_dependent/Stats.t +++ b/t/db_dependent/Stats.t @@ -3,7 +3,7 @@ use Modern::Perl; use C4::Stats; -use Test::More tests => 18; +use Test::More tests => 19; BEGIN { use_ok('C4::Stats'); @@ -119,6 +119,7 @@ is ($params->{other}, $line->{other}, "UpdateStats save other is ($params->{itemtype}, $line->{itemtype}, "UpdateStats save itemtype param in itemtype field of statistics table"); is ($params->{location}, $line->{location}, "UpdateStats save location param in location field of statistics table"); is ($params->{ccode}, $line->{ccode}, "UpdateStats save ccode param in ccode field of statistics table"); +is (undef, $line->{proccode}, "UpdateStats save no proccode param in proccode field of statistics table"); $dbh->do(q|DELETE FROM statistics|); $params = { -- 2.11.0