Bug 21683: (follow-up) Polish the change - based on feedback
authorJosef Moravec <josef.moravec@gmail.com>
Fri, 22 Feb 2019 14:33:17 +0000 (14:33 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 21 Mar 2019 18:19:22 +0000 (18:19 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Circulation.pm
misc/maintenance/fix_accountlines_rmdupfines_bug8253.pl
t/db_dependent/Stats.t

index e01ddd9..7ab1db7 100644 (file)
@@ -2385,7 +2385,7 @@ sub _FixAccountForLostAndReturned {
             accounttype => { -in => [ 'L', 'Rep', 'W' ] },
         },
         {
-            order_by => { -desc => [ 'date' ] }
+            order_by => { -desc => [ 'date', 'accountlines_id' ] }
         }
     );
 
index b637547..96ec288 100755 (executable)
@@ -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'}
index 7e2e6f7..2c6cdbc 100644 (file)
@@ -4,7 +4,7 @@ use Modern::Perl;
 use C4::Stats;
 use Koha::Database;
 
-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 = {