aboutsummaryrefslogtreecommitdiffstats
path: root/bin/send-reports
diff options
context:
space:
mode:
authorlouise <louise>2010-01-05 15:21:10 +0000
committerlouise <louise>2010-01-05 15:21:10 +0000
commit6072be00dec51b22282a0a32c7e9bb670822db0d (patch)
treebfc8f22ffb7826e582fd9de39f8e2375023b2c2c /bin/send-reports
parent0eea8b4349e317158f4a9b94ca77369a43fabefd (diff)
Allow cobrand to rewrite URLs in email
Diffstat (limited to 'bin/send-reports')
-rwxr-xr-xbin/send-reports9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 84ac98713..04ba57b91 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -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-reports,v 1.77 2009-11-30 13:42:14 louise Exp $
+# $Id: send-reports,v 1.78 2010-01-05 15:21:10 louise Exp $
use strict;
require 5.8.0;
@@ -58,9 +58,11 @@ my $unsent = dbh()->selectall_arrayref($query, { Slice => {} });
my (%notgot, %note);
my $cobrand;
+my $cobrand_data;
foreach my $row (@$unsent) {
$cobrand = $row->{cobrand};
+ $cobrand_data = $row->{cobrand_data};
# Cobranded and non-cobranded messages can share a database. In this case, the conf file
# should specify a vhost to send the reports for each cobrand, so that they don't get sent
# more than once if there are multiple vhosts running off the same database. The email_host
@@ -79,12 +81,13 @@ foreach my $row (@$unsent) {
mySociety::Locale::change($row->{lang});
# Template variables for the email
+ my $email_base_url = Cobrand::base_url_for_emails($cobrand, $cobrand_data);
my %h = map { $_ => $row->{$_} } qw/title detail name email phone category easting northing/;
- $h{url} = $base_url . '/report/' . $row->{id};
+ $h{url} = $email_base_url . '/report/' . $row->{id};
$h{phone_line} = $h{phone} ? _('Phone:') . " $h{phone}\n\n" : '';
if ($row->{has_photo}) {
$h{has_photo} = _("This web page also contains a photo of the problem, provided by the user.") . "\n\n";
- $h{image_url} = $base_url . '/photo?id=' . $row->{id};
+ $h{image_url} = $email_base_url . '/photo?id=' . $row->{id};
} else {
$h{has_photo} = '';
$h{image_url} = '';