Bugzilla – Attachment 22315 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 - Override emails of every message sent from Koha
Bug-8000---Override-emails-of-every-message-sent-f.patch (text/plain), 5.92 KB, created by
Blou
on 2013-10-23 14:03:59 UTC
(
hide
)
Description:
Bug 8000 - Override emails of every message sent from Koha
Filename:
MIME Type:
Creator:
Blou
Created:
2013-10-23 14:03:59 UTC
Size:
5.92 KB
patch
obsolete
>From 49069e0437b0403327a43378e67bedbf2b5f8bec Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Wed, 23 Oct 2013 09:58:18 -0400 >Subject: [PATCH] Bug 8000 - Override emails of every message sent from Koha > >Following Jonathan Druart's comments, I fixed every single sendmail occurence: > >C4/Letters.pm (fixed SendAlerts() in addition to the previous standard method) >basket/sendbasket.pl >misc/cronjobs/runreport.pl >opac/opac-sendbasket.pl >opac/opac-sendshelf.pl >virtualshelves/sendshelf.pl >--- > C4/Letters.pm | 17 ++++++++++++++--- > basket/sendbasket.pl | 2 ++ > misc/cronjobs/runreport.pl | 2 ++ > opac/opac-sendbasket.pl | 2 ++ > opac/opac-sendshelf.pl | 2 ++ > virtualshelves/sendshelf.pl | 2 ++ > 6 files changed, 24 insertions(+), 3 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 9a48cd2..6c492a4 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -284,7 +284,11 @@ sub SendAlerts { > foreach (@$alerts) { > > my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); >- my $email = $borinfo->{email} or next; >+ my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); >+ my $email = $sendAllEmailsTo; >+ if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation. This could be improved. >+ $email = $borinfo->{email} or next; >+ } > > # warn "sending issues..."; > my $userenv = C4::Context->userenv; >@@ -368,9 +372,12 @@ sub SendAlerts { > want_librarian => 1, > ) or return; > >+ my $allemails = join( ',', @email); >+ my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); >+ $allemails = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > # ... then send mail > my %mail = ( >- To => join( ',', @email), >+ To => $allemails, > From => $userenv->{emailaddress}, > Subject => Encode::encode( "utf8", "" . $letter->{title} ), > Message => Encode::encode( "utf8", "" . $letter->{content} ), >@@ -406,8 +413,12 @@ sub SendAlerts { > ) or return; > > return { error => "no_email" } unless $externalid->{'emailaddr'}; >+ my $emailaddr = $externalid->{'emailaddr'}; >+ my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); >+ $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. >+ # ... then send mail > my %mail = ( >- To => $externalid->{'emailaddr'}, >+ To => $emailaddr, > From => $branchdetails->{'branchemail'} || C4::Context->preference("KohaAdminEmailAddress"), > Subject => Encode::encode( "utf8", $letter->{'title'} ), > Message => Encode::encode( "utf8", $letter->{'content'} ), >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index 66f73fa..d172fc0 100755 >--- a/basket/sendbasket.pl >+++ b/basket/sendbasket.pl >@@ -44,7 +44,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > ); > > my $bib_list = $query->param('bib_list'); >+my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); > my $email_add = $query->param('email_add'); >+$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > my $email_sender = $query->param('email_sender'); > > my $dbh = C4::Context->dbh; >diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl >index 2357ed8..a269fd2 100755 >--- a/misc/cronjobs/runreport.pl >+++ b/misc/cronjobs/runreport.pl >@@ -179,6 +179,8 @@ if ($to or $from or $email) { > $from or $from = C4::Context->preference('KohaAdminEmailAddress'); > $to or $to = C4::Context->preference('KohaAdminEmailAddress'); > } >+my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); >+$to = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > > unless (scalar(@ARGV)) { > print STDERR "ERROR: No reportID(s) specified\n"; >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index da74745..6639e05 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -47,7 +47,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > ); > > my $bib_list = $query->param('bib_list'); >+my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); > my $email_add = $query->param('email_add'); >+$email_add = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > my $email_sender = $query->param('email_sender'); > > my $dbh = C4::Context->dbh; >diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl >index 80b54e2..6f2ec7c 100755 >--- a/opac/opac-sendshelf.pl >+++ b/opac/opac-sendshelf.pl >@@ -47,7 +47,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > ); > > my $shelfid = $query->param('shelfid'); >+my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); > my $email = $query->param('email'); >+$email = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > > my $dbh = C4::Context->dbh; > >diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl >index 37a98ec..37db8c4 100755 >--- a/virtualshelves/sendshelf.pl >+++ b/virtualshelves/sendshelf.pl >@@ -46,7 +46,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > ); > > my $shelfid = $query->param('shelfid'); >+my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); > my $email = $query->param('email'); >+$email = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation. This could be improved. > > my $dbh = C4::Context->dbh; > >-- >1.7.10.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