Bug 19454: (follow-up) Add a total line when updating

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>
This commit is contained in:
Marcel de Rooy 2017-10-16 13:08:22 +02:00 committed by Jonathan Druart
parent d2610f39c7
commit 906c9166a7

View file

@ -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;
}