Bugzilla – Attachment 149233 Details for
Bug 12532
Copy guarantee email to guarantor (or redirect if guarantee has no email set)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12532: Send email to guarantee and guarantor;
Bug-12532-Send-email-to-guarantee-and-guarantor.patch (text/plain), 4.05 KB, created by
Marius
on 2023-04-06 13:32:37 UTC
(
hide
)
Description:
Bug 12532: Send email to guarantee and guarantor;
Filename:
MIME Type:
Creator:
Marius
Created:
2023-04-06 13:32:37 UTC
Size:
4.05 KB
patch
obsolete
>From c1e5e0fb8426f1bacb32f1e650cb64d57542e1f2 Mon Sep 17 00:00:00 2001 >From: theminh <theminh@inlibro.com> >Date: Thu, 24 Feb 2022 15:48:04 -0500 >Subject: [PATCH] Bug 12532: Send email to guarantee and guarantor; > >This patch allows guarantors to receive emails sended to their >guarentees. This patch is a rebase of the previous patches. >NOTE: Attachment "Rebase and correction of the patch by adding the possibility of sending emails to several guarantors" generate an sha1 error. >I had to took its content and put it in another commit. > >TO TEST: > >Before applying: >1) Search, or create, a patron with guarantor. >2) Enable checkout emails for both guarantors and guarantees. >3) Checkout an item. An email should be sent only to the guarantee. >4) Apply the patch. >5) Run updatedatabase.pl >6) Enable 'RedirectGuaranteeEmail' >7) Run misc/cronjobs/process_message_queue.pl >8) Notice that the email should be sended to both the guarantee AND the >guarantor. > >Everything works fine. > >Signed-off-by: Marius Mandrescu <marius.mandrescu@inLibro.com> >--- > C4/Letters.pm | 5 +++++ > Koha/Email.pm | 17 ++++++++++++----- > Koha/Patron.pm | 22 ++++++++++++---------- > 3 files changed, 29 insertions(+), 15 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 902610cce3..4f15c0900c 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1447,6 +1447,11 @@ sub _send_message_by_email { > if !$message->{to_address} > || $message->{to_address} ne $email->email->header('To'); > >+ _update_message_from_address($message->{'message_id'},$email->email->header('From') ) >+ if !$message->{from_address} >+ || $message->{from_address} ne $email->email->header('From'); >+ >+ > try { > $email->send_or_die({ transport => $smtp_server->transport }); > >diff --git a/Koha/Email.pm b/Koha/Email.pm >index 090f475938..6f6b69f979 100644 >--- a/Koha/Email.pm >+++ b/Koha/Email.pm >@@ -118,11 +118,18 @@ sub create { > $args->{to} = $params->{to}; > } > >- Koha::Exceptions::BadParameter->throw( >- error => "Invalid 'to' parameter: " . $args->{to}, >- parameter => 'to' >- ) unless Koha::Email->is_valid( $args->{to} ); # to is mandatory >- >+ # Koha::Exceptions::BadParameter->throw( >+ # error => "Invalid 'to' parameter: " . $args->{to}, >+ # parameter => 'to' >+ # ) unless Koha::Email->is_valid( $args->{to} ); # to is mandatory >+ my @emails = split(',', $args->{to}); >+ foreach my $email (@emails) { >+ $email =~ s/ //g; >+ Koha::Exceptions::BadParameter->throw( >+ error => "Invalid 'to' parameter: ".$email, >+ parameter => 'to' >+ ) unless Koha::Email->is_valid($email); >+ } > my $addresses = {}; > $addresses->{reply_to} = $params->{reply_to}; > $addresses->{reply_to} ||= C4::Context->preference('ReplytoDefault') >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 4bc6bdad41..08bb692ea7 100755 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1412,17 +1412,19 @@ sub notice_email_address{ > > my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail'); > if ($use_guarantor) { >- my $guarantor = $self->guarantor; >- if ($guarantor) { >- if ( $which_address eq 'OFF' ) { >- $guarantor_address = $guarantor->first_valid_email_address; >- } else { >- $guarantor_address = $guarantor->$which_address || ''; >- } >- if ($address){ >- $address .= ', '; >- } >+ my @guarantors = map { $_->guarantors->as_list } $self->guarantor_relationships(); >+ if (@guarantors) { >+ foreach my $guarantor (@guarantors) { >+ if ( $which_address eq 'OFF' ) { >+ $guarantor_address = $guarantor->first_valid_email_address; >+ } else { >+ $guarantor_address = $guarantor->$which_address || ''; >+ } >+ if ($address){ >+ $address .= ', '; >+ } > $address .= $guarantor_address if $guarantor_address; >+ } > } > } > return $address; >-- >2.34.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 12532
:
29510
|
30747
|
35313
|
36752
|
39787
|
39925
|
48645
|
53649
|
53689
|
53690
|
53699
|
53700
|
55985
|
56052
|
56053
|
59445
|
59446
|
59447
|
63197
|
64802
|
64824
|
67115
|
68340
|
70865
|
72064
|
72617
|
75099
|
77606
|
80313
|
85134
|
85135
|
87815
|
87816
|
88208
|
88209
|
88210
|
88211
|
88212
|
88213
|
88295
|
88296
|
114455
|
114456
|
114457
|
114458
|
114459
|
114460
|
114461
|
131091
|
131092
|
131093
|
131094
|
149233
|
150071
|
150208
|
150217
|
150240
|
150256
|
151028
|
151029
|
154854
|
154855
|
154856
|
154857
|
155036
|
155037
|
155828
|
155829
|
155830
|
155831
|
155832
|
155833
|
155834
|
155835
|
155836
|
155837
|
155873
|
155874
|
155875
|
155876
|
155877
|
155878
|
155879
|
155880
|
155881
|
155882
|
155883
|
155886
|
155934
|
155935
|
155936
|
155937
|
155938
|
155939
|
155940
|
155941
|
155942
|
155943
|
155944
|
155945
|
155946