|
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 |
my $is_valid = Koha::Email->is_valid($email); |
| 84 |
if ( !$is_valid ) { |
| 85 |
$email = undef; |
| 86 |
} |
| 87 |
} |
| 88 |
if ( $report && $format && $email ){ |
| 89 |
#NOTE: Escape any single quotes in email since we're wrapping it in single quotes in bash |
| 90 |
($email) =~ s/'/'"'"'/g; |
| 91 |
my $command = |
| 92 |
"export KOHA_CONF=\"$CONFIG_NAME\"; " . |
| 93 |
"$base/cronjobs/runreport.pl $report --format=$format --to='$email'"; |
| 68 |
|
94 |
|
| 69 |
#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined) |
95 |
#FIXME commit ea899bc55933cd74e4665d70b1c48cab82cd1257 added recurring parameter (it is not in template) and call to add_cron_job (undefined) |
| 70 |
# my $recurring = $input->param('recurring'); |
96 |
# my $recurring = $input->param('recurring'); |
|
Lines 76-82
if ( $mode eq 'job_add' ) {
Link Here
|
| 76 |
# #here was the the unless ( add_at_job |
102 |
# #here was the the unless ( add_at_job |
| 77 |
# } |
103 |
# } |
| 78 |
|
104 |
|
| 79 |
unless ( add_at_job( $start, $command ) ) { |
105 |
unless ( add_at_job( $start, $command ) ) { |
|
|
106 |
$template->param( job_add_failed => 1 ); |
| 107 |
} |
| 108 |
} |
| 109 |
else { |
| 80 |
$template->param( job_add_failed => 1 ); |
110 |
$template->param( job_add_failed => 1 ); |
| 81 |
} |
111 |
} |
| 82 |
} |
112 |
} |
| 83 |
- |
|
|