Bugzilla – Attachment 74111 Details for
Bug 8000
Test mode for notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8000: Make all branches use Koha::Email in C4::Letters
Bug-8000-Make-all-branches-use-KohaEmail-in-C4Lett.patch (text/plain), 3.77 KB, created by
David Bourgault
on 2018-04-12 15:55:58 UTC
(
hide
)
Description:
Bug 8000: Make all branches use Koha::Email in C4::Letters
Filename:
MIME Type:
Creator:
David Bourgault
Created:
2018-04-12 15:55:58 UTC
Size:
3.77 KB
patch
obsolete
>From 6cb811c3bb1a5445e23035b4c9f74d8fdbed7e0a Mon Sep 17 00:00:00 2001 >From: David Bourgault <dav.bour@gmail.com> >Date: Thu, 12 Apr 2018 11:43:49 -0400 >Subject: [PATCH] Bug 8000: Make all branches use Koha::Email in C4::Letters > >Corrects the unique branch in C4::Letters that didn't use Koha::Email to build the %mail hash. From a search in all pl/pm files, all %mail now built with Koha::Email. >Addresses CC and BCC fields (CC and BCC fields are ignored, except for NoticeBCC which is overriden by SendAllEmailsTo) >--- > C4/Letters.pm | 21 ++++++++++++--------- > Koha/Email.pm | 3 +++ > 2 files changed, 15 insertions(+), 9 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index d4664d0..a08a71d 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -580,18 +580,21 @@ sub SendAlerts { > > # ... then send mail > my $library = Koha::Libraries->find( $userenv->{branch} ); >- my %mail = ( >- To => join( ',', @email), >- Cc => join( ',', @cc), >- From => $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'), >- Subject => Encode::encode( "UTF-8", "" . $letter->{title} ), >- Message => $letter->{'is_html'} >+ my $email = Koha::Email->new(); >+ my %mail = $email->create_message_headers( >+ { >+ to => join( ',', @email), >+ cc => join( ',', @cc), >+ from => $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'), >+ subject => Encode::encode( "UTF-8", "" . $letter->{title} ), >+ message => $letter->{'is_html'} > ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ), > Encode::encode( "UTF-8", "" . $letter->{'title'} )) > : Encode::encode( "UTF-8", "" . $letter->{'content'} ), >- 'Content-Type' => $letter->{'is_html'} >+ contenttype => $letter->{'is_html'} > ? 'text/html; charset="utf-8"' > : 'text/plain; charset="utf-8"', >+ } > ); > > if ($type eq 'claimacquisition' || $type eq 'claimissues' ) { >@@ -600,7 +603,7 @@ sub SendAlerts { > $mail{'Sender'} = C4::Context->preference('ReturnpathDefault') > if C4::Context->preference('ReturnpathDefault'); > $mail{'Bcc'} = $userenv->{emailaddress} >- if C4::Context->preference("ClaimsBccCopy"); >+ if C4::Context->preference("ClaimsBccCopy") and not C4::Context->preference("SendAllEmailsTo"); > } > > unless ( Mail::Sendmail::sendmail(%mail) ) { >@@ -1396,7 +1399,7 @@ sub _send_message_by_email { > > $sendmail_params{'Auth'} = {user => $username, pass => $password, method => $method} if $username; > if ( my $bcc = C4::Context->preference('NoticeBcc') ) { >- $sendmail_params{ Bcc } = $bcc; >+ $sendmail_params{ Bcc } = C4::Context->preference("SendAllEmailsTo") || $bcc; > } > > _update_message_to_address($message->{'message_id'},$to_address) unless $message->{to_address}; #if initial message address was empty, coming here means that a to address was found and queue should be updated >diff --git a/Koha/Email.pm b/Koha/Email.pm >index 9f63e39..b9e3241 100644 >--- a/Koha/Email.pm >+++ b/Koha/Email.pm >@@ -54,6 +54,9 @@ sub create_message_headers { > if (C4::Context->preference('SendAllEmailsTo') && Email::Valid->address(C4::Context->preference('SendAllEmailsTo'))) { > $mail{'To'} = C4::Context->preference('SendAllEmailsTo'); > } >+ else { >+ $mail{'Cc'} = $params->{cc}; >+ } > > if ( C4::Context->preference('ReplytoDefault') ) { > $params->{replyto} ||= C4::Context->preference('ReplytoDefault'); >-- >2.7.4
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 8000
:
21976
|
22315
|
24784
|
25917
|
25919
|
25920
|
25923
|
25924
|
25925
|
25926
|
25927
|
25928
|
25939
|
25950
|
25951
|
26446
|
37463
|
37464
|
37465
|
37466
|
37467
|
37468
|
37469
|
37472
|
37473
|
37474
|
37475
|
37476
|
37477
|
37478
|
37481
|
37482
|
37483
|
37484
|
37485
|
37486
|
37487
|
39985
|
39986
|
39987
|
39988
|
39989
|
39990
|
39991
|
39992
|
40215
|
40216
|
40217
|
40218
|
40219
|
40220
|
40221
|
40222
|
40223
|
40224
|
40225
|
40226
|
40227
|
40228
|
40229
|
40230
|
46354
|
46355
|
46356
|
46357
|
46358
|
46359
|
46360
|
46361
|
46362
|
49991
|
49992
|
49993
|
49998
|
49999
|
50000
|
55940
|
58434
|
62863
|
67155
|
70086
|
70087
|
70484
|
74110
|
74111
|
74848
|
80370
|
81487
|
81488
|
81589
|
81590
|
81591
|
84801
|
84802
|
84803
|
84804
|
84805
|
86861
|
86862
|
86863
|
86864
|
86865
|
88874
|
88875
|
88876
|
88877
|
88878
|
88879