View | Details | Raw Unified | Return to bug 16219
Collapse All | Expand All

(-)a/misc/cronjobs/runreport.pl (-2 / +12 lines)
Lines 66-71 runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ] Link Here
66
   --to=s          e-mail address to send report to
66
   --to=s          e-mail address to send report to
67
   --from=s        e-mail address to send report from
67
   --from=s        e-mail address to send report from
68
   --subject=s     subject for the e-mail
68
   --subject=s     subject for the e-mail
69
   --params=s      parameters for the report
69
   --store-results store the result of the report
70
   --store-results store the result of the report
70
   --csv-header    add column names as first line of csv output
71
   --csv-header    add column names as first line of csv output
71
72
Lines 121-126 E-mail address to send report from. Defaults to KohaAdminEmailAddress. Link Here
121
122
122
Subject for the e-mail message. Defaults to "Koha Saved Report"
123
Subject for the e-mail message. Defaults to "Koha Saved Report"
123
124
125
=item B<--params>
126
127
Repeatable, should provide one param per param requested for the report
128
124
=item B<--store-results>
129
=item B<--store-results>
125
130
126
Store the result of the report into the saved_reports DB table.
131
Store the result of the report into the saved_reports DB table.
Lines 174-179 my $format = "text"; Link Here
174
my $to      = "";
179
my $to      = "";
175
my $from    = "";
180
my $from    = "";
176
my $subject = "";
181
my $subject = "";
182
my @params = ();
177
my $separator = ',';
183
my $separator = ',';
178
my $quote = '"';
184
my $quote = '"';
179
my $store_results = 0;
185
my $store_results = 0;
Lines 191-196 GetOptions( Link Here
191
    'to=s'              => \$to,
197
    'to=s'              => \$to,
192
    'from=s'            => \$from,
198
    'from=s'            => \$from,
193
    'subject=s'         => \$subject,
199
    'subject=s'         => \$subject,
200
    'param=s'           => \@params,
194
    'email'             => \$email,
201
    'email'             => \$email,
195
    'a|attachment'      => \$attachment,
202
    'a|attachment'      => \$attachment,
196
    'username:s'        => \$username,
203
    'username:s'        => \$username,
Lines 253-259 foreach my $report_id (@ARGV) { Link Here
253
            $subject = 'Koha Saved Report';
260
            $subject = 'Koha Saved Report';
254
        }
261
        }
255
    }
262
    }
256
    my ($sth) = execute_query( $sql, undef, undef, undef, $report_id );
263
264
    # convert SQL parameters to placeholders
265
    $sql =~ s/(<<.*?>>)/\?/g;
266
267
    my ($sth) = execute_query( $sql, undef, undef, \@params, $report_id );
257
    my $count = scalar($sth->rows);
268
    my $count = scalar($sth->rows);
258
    unless ($count) {
269
    unless ($count) {
259
        print "NO OUTPUT: 0 results from execute_query\n";
270
        print "NO OUTPUT: 0 results from execute_query\n";
260
- 

Return to bug 16219