51ad3c371a
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
34 lines
801 B
Perl
Executable file
34 lines
801 B
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# fix this line
|
|
use C4::Reports;
|
|
|
|
use Mail::Sendmail;
|
|
|
|
|
|
my ($report,$format,$email) = @ARGV;
|
|
|
|
my ($sql,$type) = get_saved_report($report);
|
|
my $results = execute_query($sql,$type,$format);
|
|
my $message;
|
|
if ($format eq 'text'){
|
|
$message="<table>$results</table>";
|
|
}
|
|
|
|
if ($email){
|
|
my $to = $email;
|
|
# should be koha admin email
|
|
my $from = 'crc@liblime.com';
|
|
my $subject = 'Automated job run';
|
|
my %mail = (
|
|
To => $to,
|
|
From => $from,
|
|
Subject => $subject,
|
|
Message => $message
|
|
);
|
|
|
|
|
|
if (not(sendmail %mail)) {
|
|
warn "mail not sent";
|
|
}
|
|
}
|