Bugzilla – Attachment 31927 Details for
Bug 9530
Allow separate 'Reply To' and 'From' email address for notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 9530: Adding a new Koha::Email module
PASSED-QA-Bug-9530-Adding-a-new-KohaEmail-module.patch (text/plain), 3.42 KB, created by
Martin Renvoize (ashimema)
on 2014-09-30 06:31:23 UTC
(
hide
)
Description:
[PASSED QA] Bug 9530: Adding a new Koha::Email module
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2014-09-30 06:31:23 UTC
Size:
3.42 KB
patch
obsolete
>From 9b7d2a5b86cce54d5f47abf9c5306e4c1fe47ad3 Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chrisc@catalyst.net.nz> >Date: Tue, 12 Aug 2014 09:53:44 +1200 >Subject: [PATCH] [PASSED QA] Bug 9530: Adding a new Koha::Email module > >To test > >1/ Apply patch >2/ run t/Koha_Email.t > >No changes to behaviour have been implemented yet > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Email.pm | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > t/Koha_Email.t | 11 ++++++++++ > 2 files changed, 76 insertions(+) > create mode 100644 Koha/Email.pm > create mode 100755 t/Koha_Email.t > >diff --git a/Koha/Email.pm b/Koha/Email.pm >new file mode 100644 >index 0000000..fc392a3 >--- /dev/null >+++ b/Koha/Email.pm >@@ -0,0 +1,65 @@ >+# Copyright 2014 Catalyst >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+package Koha::Email; >+ >+use Modern::Perl; >+ >+use base qw(Class::Accessor); >+use C4::Context; >+ >+__PACKAGE__->mk_accessors(qw( )); >+ >+=head1 NAME >+ >+Koha::Email >+ >+=head1 SYNOPSIS >+ >+ use Koha::Email; >+ my $email = Koha::Email->new(); >+ my %mail = $email->create_message_headers({ to => $to_address, from => $from_address, >+ replyto => $replyto }); >+ >+=head1 FUNCTIONS >+ >+=cut >+ >+sub create_message_headers { >+ my $self = shift; >+ my $params = shift; >+ $params->{from} ||= C4::Context->preference('KohaAdminEmailAddress'); >+ $params->{charset} ||= 'utf8'; >+ my %mail = ( >+ To => $params->{to}, >+ From => $params->{from}, >+ charset => $params->{charset} >+ ); >+ if ( C4::Context->preference('ReplytoDefault') ) { >+ $params->{replyto} ||= C4::Context->preference('ReplytoDefault'); >+ } >+ if ( C4::Context->preference('ReturnpathDefault') ) { >+ $params->{sender} ||= C4::Context->preference('ReturnpathDefault'); >+ } >+ $mail{'Reply-to'} = $params->{replyto} if $params->{replyto}; >+ $mail{'Sender'} = $params->{sender} if $params->{sender}; >+ $mail{'Message'} = $params->{message} if $params->{message}; >+ $mail{'Subject'} = $params->{subject} if $params->{subject}; >+ $mail{'Content-Type'} = $params->{contenttype} if $params->{contenttype}; >+ return %mail; >+} >+1; >diff --git a/t/Koha_Email.t b/t/Koha_Email.t >new file mode 100755 >index 0000000..764f5c1 >--- /dev/null >+++ b/t/Koha_Email.t >@@ -0,0 +1,11 @@ >+use Modern::Perl; >+ >+use Test::More tests => 4; # last test to print >+ >+use_ok('Koha::Email'); >+ >+my $from = 'chrisc@catalyst.net.nz'; >+ >+ok( my $email = Koha::Email->new(), 'Create a Koha::Email Object'); >+ok( my %mail = $email->create_message_headers({from => $from}),'Set headers'); >+is ($mail{'From'}, $from, 'Set correctly'); >-- >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 9530
:
30717
|
30718
|
30719
|
30720
|
30721
|
30722
|
30723
|
30724
|
30725
|
30740
|
30741
|
30742
|
30743
|
30760
|
30761
|
30762
|
30763
|
31169
|
31196
|
31926
| 31927 |
31928
|
31929
|
31930
|
31931
|
31932
|
31933
|
31934
|
31935
|
32799