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

(-)a/misc/cronjobs/runreport.pl (-16 / +40 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#
2
#
3
# Copyright 2008 Liblime
3
# Copyright 2008 Liblime
4
# Copyright 2014 Foundations Bible College, Inc.
4
#
5
#
5
# This file is part of Koha.
6
# This file is part of Koha.
6
#
7
#
Lines 57-62 runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ] Link Here
57
   --format=s      selects format. Choice of text, html, csv, or tsv
58
   --format=s      selects format. Choice of text, html, csv, or tsv
58
59
59
   -e --email      whether to use e-mail (implied by --to or --from)
60
   -e --email      whether to use e-mail (implied by --to or --from)
61
   --username      username to pass to the SMTP server for authentication
62
   --password      password to pass to the SMTP server for authentication
63
   --method        method is the type of authentication. Ie. LOGIN, DIGEST-MD5, etc.
60
   --to=s          e-mail address to send report to
64
   --to=s          e-mail address to send report to
61
   --from=s        e-mail address to send report from
65
   --from=s        e-mail address to send report from
62
   --subject=s     subject for the e-mail
66
   --subject=s     subject for the e-mail
Lines 69-79 runreport.pl [ -h | -m ] [ -v ] reportID [ reportID ... ] Link Here
69
73
70
=over
74
=over
71
75
72
=item B<-help>
76
=item B<--help>
73
77
74
Print a brief help message and exits.
78
Print a brief help message and exits.
75
79
76
=item B<-man>
80
=item B<--man>
77
81
78
Prints the manual page and exits.
82
Prints the manual page and exits.
79
83
Lines 81-103 Prints the manual page and exits. Link Here
81
85
82
Verbose. Without this flag set, only fatal errors are reported.
86
Verbose. Without this flag set, only fatal errors are reported.
83
87
84
=item B<-format>
88
=item B<--format>
85
89
86
Current options are text, html, csv, and tsv. At the moment, text and tsv both produce tab-separated tab-separated output.
90
Current options are text, html, csv, and tsv. At the moment, text and tsv both produce tab-separated tab-separated output.
87
91
88
=item B<-email>
92
=item B<--email>
89
93
90
Whether to use e-mail (implied by --to or --from).
94
Whether to use e-mail (implied by --to or --from).
91
95
92
=item B<-to>
96
=item B<--username>
97
98
Username to pass to the SMTP server for authentication
99
100
=item B<--password>
101
102
Password to pass to the SMTP server for authentication
103
104
=item B<--method>
105
106
Method is the type of authentication. Ie. LOGIN, DIGEST-MD5, etc.
107
108
=item B<--to>
93
109
94
E-mail address to send report to. Defaults to KohaAdminEmailAddress.
110
E-mail address to send report to. Defaults to KohaAdminEmailAddress.
95
111
96
=item B<-from>
112
=item B<--from>
97
113
98
E-mail address to send report from. Defaults to KohaAdminEmailAddress.
114
E-mail address to send report from. Defaults to KohaAdminEmailAddress.
99
115
100
=item B<-subject>
116
=item B<--subject>
101
117
102
Subject for the e-mail message. Defaults to "Koha Saved Report"
118
Subject for the e-mail message. Defaults to "Koha Saved Report"
103
119
Lines 150-164 my $subject = 'Koha Saved Report'; Link Here
150
my $separator = ',';
166
my $separator = ',';
151
my $quote = '"';
167
my $quote = '"';
152
168
169
my $username = undef;
170
my $password = undef;
171
my $method = 'LOGIN';
172
153
GetOptions(
173
GetOptions(
154
    'help|?'     => \$help,
174
    'help|?'            => \$help,
155
    'man'        => \$man,
175
    'man'               => \$man,
156
    'verbose'    => \$verbose,
176
    'verbose'           => \$verbose,
157
    'format=s'   => \$format,
177
    'format=s'          => \$format,
158
    'to=s'       => \$to,
178
    'to=s'              => \$to,
159
    'from=s'     => \$from,
179
    'from=s'            => \$from,
160
    'subject=s'  => \$subject,
180
    'subject=s'         => \$subject,
161
    'email'      => \$email,
181
    'email'             => \$email,
182
    'username:s'        => \$username,
183
    'password:s'        => \$password,
184
    'method:s'          => \$method,
185
162
) or pod2usage(2);
186
) or pod2usage(2);
163
pod2usage( -verbose => 2 ) if ($man);
187
pod2usage( -verbose => 2 ) if ($man);
164
pod2usage( -verbose => 2 ) if ($help and $verbose);
188
pod2usage( -verbose => 2 ) if ($help and $verbose);
Lines 260-265 foreach my $report_id (@ARGV) { Link Here
260
              Message => encode('utf8', $message )
284
              Message => encode('utf8', $message )
261
          );
285
          );
262
        }
286
        }
287
        $mail{'Auth'} = {user => $username, pass => $password, method => $method} if $username;
263
        sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error;
288
        sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error;
264
    } else {
289
    } else {
265
        print $message;
290
        print $message;
266
- 

Return to bug 12040