Don't display Acquisitions and Serials links if the user
[koha.git] / tools / runreport.pl
blobd2d85a2393336d4955cc41af343f6f1162bd6415
1 #!/usr/bin/perl
3 # fix this line
4 use C4::Reports;
5 use C4::Context;
7 use Mail::Sendmail;
10 my ($report,$format,$email) = @ARGV;
12 my ($sql,$type) = get_saved_report($report);
13 my $results = execute_query($sql,$type,$format,$report);
14 my $message;
15 if ($format eq 'text'){
16 $message="<table>$results</table>";
18 if ($format eq 'url'){
19 $message="$results";
22 if ($email){
23 my $to = $email;
24 # should be koha admin email
25 my $from = C4::Context->preference('KohaAdminEmailAddress');
26 my $subject = 'Automated job run';
27 my %mail = (
28 To => $to,
29 From => $from,
30 Subject => $subject,
31 Message => $message
35 if (not(sendmail %mail)) {
36 warn "mail not sent";