Lines 15-20
use C4::Log qw( cronlogaction );
Link Here
|
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::Email; |
17 |
use Koha::Util::OpenDocument qw( generate_ods ); |
17 |
use Koha::Util::OpenDocument qw( generate_ods ); |
|
|
18 |
use Koha::SMTP::Servers; |
18 |
|
19 |
|
19 |
my ( |
20 |
my ( |
20 |
$help, |
21 |
$help, |
Lines 125-137
if ( @emails ) {
Link Here
|
125 |
csv => $csv_filenames, |
126 |
csv => $csv_filenames, |
126 |
ods => $ods_filenames, |
127 |
ods => $ods_filenames, |
127 |
}; |
128 |
}; |
|
|
129 |
|
130 |
my $transport = Koha::SMTP::Servers->get_default->transport; |
131 |
|
128 |
for my $email ( @emails ) { |
132 |
for my $email ( @emails ) { |
129 |
send_files({ |
133 |
send_files( |
130 |
directory => $output_directory, |
134 |
{ |
131 |
files => $files, |
135 |
directory => $output_directory, |
132 |
to => $email, |
136 |
files => $files, |
133 |
from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed |
137 |
from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed |
134 |
}); |
138 |
to => $email, |
|
|
139 |
transport => $transport, |
140 |
} |
141 |
); |
135 |
} |
142 |
} |
136 |
} |
143 |
} |
137 |
|
144 |
|
Lines 144-150
sub print_notices {
Link Here
|
144 |
my $format = $params->{format} // 'html'; |
151 |
my $format = $params->{format} // 'html'; |
145 |
|
152 |
|
146 |
die "Format $format is not known" |
153 |
die "Format $format is not known" |
147 |
unless $format =~ m[^html$|^csv$|^ods$]; |
154 |
unless $format =~ m/^html$|^csv$|^ods$/; |
148 |
|
155 |
|
149 |
my ( @filenames, $messages_by_branch ); |
156 |
my ( @filenames, $messages_by_branch ); |
150 |
|
157 |
|
Lines 275-284
sub _generate_ods {
Link Here
|
275 |
sub send_files { |
282 |
sub send_files { |
276 |
my ( $params ) = @_; |
283 |
my ( $params ) = @_; |
277 |
my $directory = $params->{directory}; |
284 |
my $directory = $params->{directory}; |
278 |
my $files = $params->{files}; |
285 |
my $files = $params->{files}; |
279 |
my $to = $params->{to}; |
286 |
my $to = $params->{to}; |
280 |
my $from = $params->{from}; |
287 |
my $from = $params->{from}; |
281 |
return unless $to and $from; |
288 |
my $transport = $params->{transport}; |
|
|
289 |
|
290 |
return unless $to and $from and $transport; |
282 |
|
291 |
|
283 |
my $email = Koha::Email->create( |
292 |
my $email = Koha::Email->create( |
284 |
{ |
293 |
{ |
Lines 313-319
sub send_files {
Link Here
|
313 |
} |
322 |
} |
314 |
} |
323 |
} |
315 |
|
324 |
|
316 |
$email->send_or_die; |
325 |
$email->send_or_die( { transport => $transport } ); |
|
|
326 |
|
317 |
} |
327 |
} |
318 |
|
328 |
|
319 |
=head1 NAME |
329 |
=head1 NAME |
320 |
- |
|
|