aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouise <louise>2009-11-19 15:10:28 +0000
committerlouise <louise>2009-11-19 15:10:28 +0000
commit5e0cf9c59796ef6b8bc03498a6dd5a3599d98782 (patch)
tree156e105c2a44165aeb2a3ae0f0aff8c719b2552d
parent3b10175c1edc6568d0608c345c95998c1b9f5c79 (diff)
Allow cobrands to customize sender name on questionnaire emails
-rwxr-xr-xbin/send-questionnaires7
-rw-r--r--perllib/Cobrand.pm15
2 files changed, 17 insertions, 5 deletions
diff --git a/bin/send-questionnaires b/bin/send-questionnaires
index d6072981e..a3943c2cc 100755
--- a/bin/send-questionnaires
+++ b/bin/send-questionnaires
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: send-questionnaires,v 1.18 2009-10-21 14:59:00 louise Exp $
+# $Id: send-questionnaires,v 1.19 2009-11-19 15:10:28 louise Exp $
use strict;
require 5.8.0;
@@ -46,7 +46,7 @@ CronFns::language($site);
# Select all problems that need a questionnaire email sending
my $unsent = select_all(
- "select id, council, category, title, detail, name, email, cobrand, lang,
+ "select id, council, category, title, detail, name, email, cobrand, cobrand_data, lang,
extract(epoch from ms_current_timestamp()-created) as created
from problem
where state in ('confirmed','fixed')
@@ -81,13 +81,14 @@ foreach my $row (@$unsent) {
$h{url} = Cobrand::base_url_for_emails($cobrand, $row->{cobrand_data}) . '/Q/' . $token;
my $sender = Cobrand::contact_email($cobrand);
+ my $sender_name = _(Cobrand::contact_name($cobrand));
$sender =~ s/team/fms-DO-NOT-REPLY/;
$template = _($template);
my $email = mySociety::Locale::in_gb_locale { mySociety::Email::construct_email({
_template_ => $template,
_parameters_ => \%h,
To => [ [ $row->{email}, $row->{name} ] ],
- From => [ $sender, _(mySociety::Config::get('CONTACT_NAME')) ],
+ From => [ $sender, $sender_name ],
'Message-ID' => sprintf('<ques-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5, 1))),
}) };
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index d0f15947a..fbfbfbe9a 100644
--- a/perllib/Cobrand.pm
+++ b/perllib/Cobrand.pm
@@ -7,7 +7,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: Cobrand.pm,v 1.41 2009-11-19 09:56:11 louise Exp $
+# $Id: Cobrand.pm,v 1.42 2009-11-19 15:10:28 louise Exp $
package Cobrand;
use strict;
@@ -148,6 +148,17 @@ sub admin_base_url {
}
+=item contact_name COBRAND
+
+Return the contact name for the cobranded version of the site
+(to be used in emails).
+
+=cut
+sub contact_name {
+ my $cobrand = shift;
+ return get_cobrand_conf($cobrand, 'CONTACT_NAME');
+}
+
=item contact_email COBRAND
Return the contact email for the cobranded version of the site
@@ -155,9 +166,9 @@ Return the contact email for the cobranded version of the site
=cut
sub contact_email {
my $cobrand = shift;
-
return get_cobrand_conf($cobrand, 'CONTACT_EMAIL');
}
+
=item get_cobrand_conf COBRAND KEY
Get the value for KEY from the config file for COBRAND