Bug 37775: Spelling and tidy

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2024-08-30 12:51:37 +00:00 committed by Martin Renvoize
parent dba9dd4053
commit d785fb1c1e
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -52,7 +52,7 @@ my $incremental = 0;
my $progress = 100; my $progress = 100;
my $unit; my $unit;
my $command_line_options = join(" ",@ARGV); my $command_line_options = join( " ", @ARGV );
my $result = GetOptions( my $result = GetOptions(
'v|verbose' => \$verbose, 'v|verbose' => \$verbose,
@ -74,8 +74,7 @@ if ( defined $since && defined $interval ) {
} }
if ( $useitems && $incremental ) { if ( $useitems && $incremental ) {
print print "The --use-items and --incremental options are mutually exclusive.\n\n";
"The --use-items and --incremental options are mutually exclusive.\n\n";
$want_help = 1; $want_help = 1;
} }
@ -90,7 +89,7 @@ unless ( $usestats || $useitems ) {
usage() if $want_help; usage() if $want_help;
cronlogaction({ info => $command_line_options }); cronlogaction( { info => $command_line_options } );
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
@ -105,13 +104,12 @@ process_stats() if $usestats;
report(); report();
cronlogaction({ action => 'End', info => "COMPLETED" }); cronlogaction( { action => 'End', info => "COMPLETED" } );
exit 0; exit 0;
sub process_items { sub process_items {
my $query = my $query = "SELECT items.biblionumber, SUM(items.issues) FROM items GROUP BY items.biblionumber;";
"SELECT items.biblionumber, SUM(items.issues) FROM items GROUP BY items.biblionumber;";
process_query($query); process_query($query);
} }
@ -129,14 +127,12 @@ sub process_stats {
$interval =~ m/([0-9]*)([hdwmy]?)$/; $interval =~ m/([0-9]*)([hdwmy]?)$/;
$unit = $2 || 'd'; $unit = $2 || 'd';
$since = DateTime::Format::MySQL->format_datetime( $since = DateTime::Format::MySQL->format_datetime( $dt->subtract( $units{$unit} => $1 ) );
$dt->subtract( $units{$unit} => $1 ) );
} }
my $limit = ''; my $limit = '';
$limit = " WHERE statistics.datetime >= ?" if ( $interval || $since ); $limit = " WHERE statistics.datetime >= ?" if ( $interval || $since );
my $query = my $query = "SELECT biblio.biblionumber, COUNT(statistics.itemnumber) FROM biblio\
"SELECT biblio.biblionumber, COUNT(statistics.itemnumber) FROM biblio\
LEFT JOIN items ON (biblio.biblionumber=items.biblionumber)\ LEFT JOIN items ON (biblio.biblionumber=items.biblionumber)\
LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber AND statistics.type = 'issue') LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber AND statistics.type = 'issue')
$limit\ $limit\
@ -152,8 +148,7 @@ sub process_query {
if ( $since && $uselimit ) { if ( $since && $uselimit ) {
$sth->execute($since); $sth->execute($since);
} } else {
else {
$sth->execute(); $sth->execute();
} }
@ -269,7 +264,7 @@ processing the last twenty-four hours.
=item B<--progress=N> =item B<--progress=N>
Print the progress to standart output after every N records are processed. Print the progress to standard output after every N records are processed.
=item B<--test> =item B<--test>