Bug 19454: (follow-up) Add a total line when updating
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 16 Oct 2017 11:08:22 +0000 (13:08 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 23 Mar 2018 14:45:38 +0000 (11:45 -0300)
Test plan:
[1] Run the script with -doit and -cat [some_category] and verify that
    the printed total is correct.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
misc/maintenance/borrowers-force-messaging-defaults.pl

index 897f5df..e327834 100755 (executable)
@@ -60,6 +60,7 @@ WHERE bo.dateenrolled >= ?|;
     $sql .= " AND categorycode = ?" if $category;
     my $sth = $dbh->prepare($sql);
     $sth->execute($since, $category || () );
+    my $cnt = 0;
     while ( my ($borrowernumber, $categorycode) = $sth->fetchrow ) {
         print "$borrowernumber: $categorycode\n";
         next unless $doit;
@@ -67,8 +68,10 @@ WHERE bo.dateenrolled >= ?|;
             borrowernumber => $borrowernumber,
             categorycode   => $categorycode,
         } );
+        $cnt++;
     }
     $dbh->commit();
+    print "Total borrowers updated: $cnt\n" if $doit;
 }