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

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

Return to bug 16219