From 2c598a55d4f4c498622747748880b1981afca417 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 19 Jul 2019 19:42:37 +0000 Subject: [PATCH] Bug 16219: (follow-up) Nicer message if params missing and note that they are not combined Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize (cherry picked from commit 52587b4319d5d22436733f296021648d846f6359) Signed-off-by: Fridolin Somers --- misc/cronjobs/runreport.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl index 869ede8168..89ef2154c1 100755 --- a/misc/cronjobs/runreport.pl +++ b/misc/cronjobs/runreport.pl @@ -67,7 +67,7 @@ runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ] --to=s e-mail address to send report to --from=s e-mail address to send report from --subject=s subject for the e-mail - --params=s parameters for the report + --param=s parameters for the report --store-results store the result of the report --csv-header add column names as first line of csv output @@ -123,9 +123,11 @@ E-mail address to send report from. Defaults to KohaAdminEmailAddress. Subject for the e-mail message. Defaults to "Koha Saved Report" -=item B<--params> +=item B<--param> -Repeatable, should provide one param per param requested for the report +Repeatable, should provide one param per param requested for the report. +Report params are not combined as on the staff side, so you may need to repeat +params. =item B<--store-results> @@ -263,7 +265,8 @@ foreach my $report_id (@ARGV) { } # convert SQL parameters to placeholders - $sql =~ s/(<<.*?>>)/\?/g; + my $params_needed = ( $sql =~ s/(<<.*?>>)/\?/g ); + die("You supplied ". scalar @params . " parameter(s) and $params_needed are required by the report") if scalar @params != $params_needed; my ($sth) = execute_query( $sql, undef, undef, \@params, $report_id ); my $count = scalar($sth->rows); -- 2.39.5