Bugzilla – Attachment 108140 Details for
Bug 22343
Add configuration options for SMTP servers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22343: Adapt Koha::Illrequest
Bug-22343-Adapt-KohaIllrequest.patch (text/plain), 3.80 KB, created by
Martin Renvoize (ashimema)
on 2020-08-12 16:08:04 UTC
(
hide
)
Description:
Bug 22343: Adapt Koha::Illrequest
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-08-12 16:08:04 UTC
Size:
3.80 KB
patch
obsolete
>From 9c2baa7c6f6cf56d33cd2511932b1b3fea47d9db Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 6 Aug 2020 15:06:48 -0300 >Subject: [PATCH] Bug 22343: Adapt Koha::Illrequest > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Illrequest.pm | 33 +++++++++++++++++++-------------- > 1 file changed, 19 insertions(+), 14 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 5ab0adc210..9598cfc46e 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -21,8 +21,8 @@ use Modern::Perl; > > use Clone 'clone'; > use File::Basename qw( basename ); >+use Email::Sender::Simple qw(sendmail); > use Encode qw( encode ); >-use Mail::Sendmail; > use Try::Tiny; > use DateTime; > >@@ -40,6 +40,8 @@ use Koha::Biblios; > use Koha::Items; > use Koha::ItemTypes; > use Koha::Libraries; >+use Koha::SMTP::Server; >+ > use C4::Circulation qw( CanBookBeIssued AddIssue ); > > use base qw(Koha::Object); >@@ -1284,7 +1286,7 @@ attempts to submit the email. > > sub generic_confirm { > my ( $self, $params ) = @_; >- my $branch = Koha::Libraries->find($params->{current_branchcode}) >+ my $library = Koha::Libraries->find($params->{current_branchcode}) > || die "Invalid current branchcode. Are you logged in as the database user?"; > if ( !$params->{stage}|| $params->{stage} eq 'init' ) { > my $draft->{subject} = "ILL Request"; >@@ -1309,7 +1311,7 @@ Kind Regards > > EOF > >- my @address = map { $branch->$_ } >+ my @address = map { $library->$_ } > qw/ branchname branchaddress1 branchaddress2 branchaddress3 > branchzip branchcity branchstate branchcountry branchphone > branchemail /; >@@ -1346,27 +1348,29 @@ EOF > "No target email addresses found. Either select at least one partner or check your ILL partner library records.") > if ( !$to ); > # Create the from, replyto and sender headers >- my $from = $branch->branchemail; >- my $replyto = $branch->branchreplyto || $from; >+ my $from = $library->branchemail; >+ my $replyto = $library->branchreplyto || $from; > Koha::Exceptions::Ill::NoLibraryEmail->throw( > "Your library has no usable email address. Please set it.") > if ( !$from ); > > # Create the email >- my $message = Koha::Email->new; >- my %mail = $message->create_message_headers( >+ my $email = Koha::Email->create( > { > to => $to, > from => $from, > replyto => $replyto, > subject => Encode::encode( "utf8", $params->{subject} ), >- message => Encode::encode( "utf8", $params->{body} ), >- contenttype => 'text/plain', >+ text_body => Encode::encode( "utf8", $params->{body} ), > } > ); >+ > # Send it >- my $result = sendmail(%mail); >- if ( $result ) { >+ try { >+ >+ my $smtp_server = Koha::SMTP::Servers->get_effective_server({ library => $library }); >+ Email::Sender::Simple::sendmail( $email, { transport => $smtp_server->transport } ); >+ > $self->status("GENREQ")->store; > $self->_backend_capability( > 'set_requested_partners', >@@ -1383,15 +1387,16 @@ EOF > stage => 'commit', > next => 'illview', > }; >- } else { >+ } >+ catch { > return { > error => 1, > status => 'email_failed', >- message => $Mail::Sendmail::error, >+ message => "$_", > method => 'generic_confirm', > stage => 'draft', > }; >- } >+ }; > } else { > die "Unknown stage, should not have happened." > } >-- >2.20.1
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 22343
:
107598
|
107599
|
107600
|
107601
|
107602
|
107603
|
107604
|
107605
|
107987
|
107988
|
107989
|
107990
|
107991
|
107992
|
107993
|
107994
|
107995
|
107996
|
107997
|
107998
|
107999
|
108009
|
108107
|
108108
|
108109
|
108110
|
108111
|
108112
|
108113
|
108114
|
108115
|
108116
|
108117
|
108118
|
108119
|
108131
|
108132
|
108133
|
108134
|
108135
|
108136
|
108137
|
108138
|
108139
|
108140
|
108141
|
108142
|
108143
|
108529
|
108537
|
108538
|
108539
|
108540
|
108541
|
108542
|
108543
|
108544
|
108545
|
108546
|
108547
|
108548
|
108549
|
108609
|
108638
|
108642
|
108643
|
108644
|
108645
|
108646
|
108647
|
108648
|
108649
|
108650
|
108651
|
108652
|
108653
|
108654
|
108655
|
108656
|
108715
|
108716
|
109003
|
109004
|
109005
|
109006
|
109007
|
109008
|
109009
|
109010
|
109011
|
109012
|
109013
|
109014
|
109015
|
109016
|
109017
|
109018
|
109155
|
109156
|
109157
|
109158
|
109159
|
109160
|
109161
|
109162
|
109163
|
109164
|
109165
|
109166
|
109167
|
109168
|
109169
|
109170
|
109601
|
109602
|
109603
|
109604
|
109605
|
109606
|
109607
|
109608
|
109609
|
109610
|
109611
|
109612
|
109613
|
109614
|
109615
|
109616
|
109723
|
109724
|
109725
|
109726
|
109727
|
109728
|
109729
|
109730
|
109731
|
109732
|
109733
|
109734
|
109735
|
109736
|
109737
|
109738
|
109739
|
109740
|
109787
|
109788
|
111048
|
111087
|
111088
|
111089
|
111090
|
111154
|
111165
|
111166
|
111175
|
111176
|
111213
|
111215
|
111216
|
111442
|
111482
|
113240
|
113827
|
113847