Lines 25-30
use C4::Auth qw( get_template_and_user );
Link Here
|
25 |
use CGI qw ( -utf8 ); |
25 |
use CGI qw ( -utf8 ); |
26 |
use C4::Output qw( output_html_with_http_headers ); |
26 |
use C4::Output qw( output_html_with_http_headers ); |
27 |
use Koha::DateUtils qw( dt_from_string );; |
27 |
use Koha::DateUtils qw( dt_from_string );; |
|
|
28 |
use Koha::Reports; |
29 |
use Koha::Email; |
28 |
|
30 |
|
29 |
my $input = CGI->new; |
31 |
my $input = CGI->new; |
30 |
my $base; |
32 |
my $base; |
Lines 60-70
if ( $mode eq 'job_add' ) {
Link Here
|
60 |
$starttime =~ s/\://g; |
62 |
$starttime =~ s/\://g; |
61 |
my $start = $startdate . $starttime; |
63 |
my $start = $startdate . $starttime; |
62 |
my $report = $input->param('report'); |
64 |
my $report = $input->param('report'); |
|
|
65 |
if ($report) { |
66 |
my $saved_report; |
67 |
my $report_id = int($report); |
68 |
if ($report_id) { |
69 |
$saved_report = Koha::Reports->find($report_id); |
70 |
} |
71 |
if ( !$saved_report ) { |
72 |
$report = undef; |
73 |
} |
74 |
} |
63 |
my $format = $input->param('format'); |
75 |
my $format = $input->param('format'); |
64 |
my $email = $input->param('email'); |
76 |
if ($format) { |
65 |
my $command = |
77 |
unless ( $format eq 'text' || $format eq 'csv' || $format eq 'html' ) { |
66 |
"export KOHA_CONF=\"$CONFIG_NAME\"; " . |
78 |
$format = undef; |
67 |
"$base/cronjobs/runreport.pl $report --format=$format --to=$email"; |
79 |
} |
|
|
80 |
} |
81 |
my $email = $input->param('email'); |
82 |
if ($email) { |
83 |
#FIXME: A valid email address can still be a malicious payload |
84 |
my $is_valid = Koha::Email->is_valid($email); |
85 |
if ( !$is_valid ) { |
86 |
$email = undef; |
87 |
} |
88 |
} |
89 |
if ( $report && $format && $email ){ |
90 |
my $command = |
91 |
"export KOHA_CONF=\"$CONFIG_NAME\"; " . |
92 |
"$base/cronjobs/runreport.pl $report --format=$format --to=$email"; |
68 |
|
93 |
|
69 |
#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined) |
94 |
#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined) |
70 |
# my $recurring = $input->param('recurring'); |
95 |
# my $recurring = $input->param('recurring'); |
Lines 76-82
if ( $mode eq 'job_add' ) {
Link Here
|
76 |
# #here was the the unless ( add_at_job |
101 |
# #here was the the unless ( add_at_job |
77 |
# } |
102 |
# } |
78 |
|
103 |
|
79 |
unless ( add_at_job( $start, $command ) ) { |
104 |
unless ( add_at_job( $start, $command ) ) { |
|
|
105 |
$template->param( job_add_failed => 1 ); |
106 |
} |
107 |
} |
108 |
else { |
80 |
$template->param( job_add_failed => 1 ); |
109 |
$template->param( job_add_failed => 1 ); |
81 |
} |
110 |
} |
82 |
} |
111 |
} |
83 |
- |
|
|