Bugzilla – Attachment 131992 Details for
Bug 29501
gather_print_notices.pl does not use SMTP servers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29501: Use the default transport
Bug-29501-Use-the-default-transport.patch (text/plain), 2.93 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-03-21 18:23:21 UTC
(
hide
)
Description:
Bug 29501: Use the default transport
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-03-21 18:23:21 UTC
Size:
2.93 KB
patch
obsolete
>From d5eb3a4f0e956ecddf383c1f580f886147b0090e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 21 Mar 2022 13:45:16 -0300 >Subject: [PATCH] Bug 29501: Use the default transport > >This patch makes the script pass the default SMTP transport to the >->send_or_die call. > >The default is picked as this is the current behavior. New enhancements >could add the *library_id* to the message_queue table, and allow using >different transports depending on that. But it is out of the scope of >this bug. > >To test: >1. Verify messages are being sent. >2. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/cronjobs/gather_print_notices.pl | 34 +++++++++++++++++---------- > 1 file changed, 22 insertions(+), 12 deletions(-) > >diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl >index 692b53b2e0..d6b599f635 100755 >--- a/misc/cronjobs/gather_print_notices.pl >+++ b/misc/cronjobs/gather_print_notices.pl >@@ -15,6 +15,7 @@ use C4::Log qw( cronlogaction ); > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Email; > use Koha::Util::OpenDocument qw( generate_ods ); >+use Koha::SMTP::Servers; > > my ( > $help, >@@ -125,13 +126,19 @@ if ( @emails ) { > csv => $csv_filenames, > ods => $ods_filenames, > }; >+ >+ my $transport = Koha::SMTP::Servers->get_default->transport; >+ > for my $email ( @emails ) { >- send_files({ >- directory => $output_directory, >- files => $files, >- to => $email, >- from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed >- }); >+ send_files( >+ { >+ directory => $output_directory, >+ files => $files, >+ from => C4::Context->preference('KohaAdminEmailAddress'), # Should be replaced if bug 8000 is pushed >+ to => $email, >+ transport => $transport, >+ } >+ ); > } > } > >@@ -144,7 +151,7 @@ sub print_notices { > my $format = $params->{format} // 'html'; > > die "Format $format is not known" >- unless $format =~ m[^html$|^csv$|^ods$]; >+ unless $format =~ m/^html$|^csv$|^ods$/; > > my ( @filenames, $messages_by_branch ); > >@@ -275,10 +282,12 @@ sub _generate_ods { > sub send_files { > my ( $params ) = @_; > my $directory = $params->{directory}; >- my $files = $params->{files}; >- my $to = $params->{to}; >- my $from = $params->{from}; >- return unless $to and $from; >+ my $files = $params->{files}; >+ my $to = $params->{to}; >+ my $from = $params->{from}; >+ my $transport = $params->{transport}; >+ >+ return unless $to and $from and $transport; > > my $email = Koha::Email->create( > { >@@ -313,7 +322,8 @@ sub send_files { > } > } > >- $email->send_or_die; >+ $email->send_or_die( { transport => $transport } ); >+ > } > > =head1 NAME >-- >2.32.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29501
:
127789
|
127790
|
127794
|
131446
|
131447
|
131448
|
131989
|
131990
|
131991
|
131992
|
132003
|
132004
|
132005
|
132006