|
Lines 13-20
use Getopt::Long qw( GetOptions );
Link Here
|
| 13 |
use C4::Log qw( cronlogaction ); |
13 |
use C4::Log qw( cronlogaction ); |
| 14 |
|
14 |
|
| 15 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
15 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
|
|
16 |
use Koha::Email; |
| 16 |
use Koha::Util::OpenDocument qw( generate_ods ); |
17 |
use Koha::Util::OpenDocument qw( generate_ods ); |
| 17 |
use MIME::Lite; |
|
|
| 18 |
|
18 |
|
| 19 |
my ( |
19 |
my ( |
| 20 |
$help, |
20 |
$help, |
|
Lines 280-290
sub send_files {
Link Here
|
| 280 |
my $from = $params->{from}; |
280 |
my $from = $params->{from}; |
| 281 |
return unless $to and $from; |
281 |
return unless $to and $from; |
| 282 |
|
282 |
|
| 283 |
my $mail = MIME::Lite->new( |
283 |
my $email = Koha::Email->create( |
| 284 |
From => $from, |
284 |
{ |
| 285 |
To => $to, |
285 |
from => $from, |
| 286 |
Subject => 'Print notices for ' . $today_syspref, |
286 |
to => $to, |
| 287 |
Type => 'multipart/mixed', |
287 |
subject => 'Print notices for ' . $today_syspref, |
|
|
288 |
} |
| 288 |
); |
289 |
); |
| 289 |
|
290 |
|
| 290 |
while ( my ( $type, $filenames ) = each %$files ) { |
291 |
while ( my ( $type, $filenames ) = each %$files ) { |
|
Lines 299-318
sub send_files {
Link Here
|
| 299 |
|
300 |
|
| 300 |
next unless $mimetype; |
301 |
next unless $mimetype; |
| 301 |
|
302 |
|
| 302 |
my $filepath = File::Spec->catdir( $directory, $filename ); |
303 |
my $filepath = File::Spec->catfile( $directory, $filename ); |
| 303 |
|
304 |
|
| 304 |
next unless $filepath or -f $filepath; |
305 |
next unless $filepath or -f $filepath; |
| 305 |
|
306 |
|
| 306 |
$mail->attach( |
307 |
$email->attach_file( |
| 307 |
Type => $mimetype, |
308 |
$filepath, |
| 308 |
Path => $filepath, |
309 |
content_type => $mimetype, |
| 309 |
Filename => $filename, |
310 |
name => $filename, |
| 310 |
Encoding => 'base64', |
311 |
disposition => 'attachment', |
| 311 |
); |
312 |
); |
| 312 |
} |
313 |
} |
| 313 |
} |
314 |
} |
| 314 |
|
315 |
|
| 315 |
$mail->send; |
316 |
$email->send_or_die; |
| 316 |
} |
317 |
} |
| 317 |
|
318 |
|
| 318 |
=head1 NAME |
319 |
=head1 NAME |
| 319 |
- |
|
|