aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-questionnaires3
-rwxr-xr-xbin/send-reports10
-rw-r--r--perllib/Cobrand.pm23
3 files changed, 32 insertions, 4 deletions
diff --git a/bin/send-questionnaires b/bin/send-questionnaires
index a3943c2cc..bb096fa22 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.19 2009-11-19 15:10:28 louise Exp $
+# $Id: send-questionnaires,v 1.20 2009-11-23 17:25:43 louise Exp $
use strict;
require 5.8.0;
@@ -63,6 +63,7 @@ foreach my $row (@$unsent) {
my $cobrand = $row->{cobrand};
my $lang = $row->{lang};
Cobrand::set_lang_and_domain($cobrand, $lang);
+ next unless (Cobrand::email_host($cobrand));
my ($councils, $missing) = $row->{council} =~ /^([\d,]+)(?:\|([\d,]+))?/;
my @councils = split /,/, $councils;
my $areas_info = mySociety::MaPit::get_voting_areas_info(\@all_councils);
diff --git a/bin/send-reports b/bin/send-reports
index 852f20987..12aeba5b0 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.74 2009-08-12 13:36:00 matthew Exp $
+# $Id: send-reports,v 1.75 2009-11-23 17:25:43 louise Exp $
use strict;
require 5.8.0;
@@ -21,6 +21,7 @@ use CGI; # Trying awkward kludge
use CronFns;
use EastHantsWSDL;
+use Cobrand;
use mySociety::Config;
use mySociety::DBHandle qw(dbh);
use mySociety::Email;
@@ -50,13 +51,18 @@ my $site = CronFns::site($base_url);
CronFns::language($site);
my $query = "SELECT id, council, category, title, detail, name, email, phone,
- used_map, easting, northing, (photo is not null) as has_photo, lang
+ used_map, easting, northing, (photo is not null) as has_photo, lang,
+ cobrand, cobrand_data
FROM problem WHERE state in ('confirmed','fixed') AND whensent IS NULL
AND council IS NOT NULL";
my $unsent = dbh()->selectall_arrayref($query, { Slice => {} });
my (%notgot, %note);
+my $cobrand;
foreach my $row (@$unsent) {
+
+ $cobrand = $row->{cobrand};
+ next unless (Cobrand::email_host($cobrand));
if (dbh()->selectrow_array('select email from abuse where lower(email)=?', {}, lc($row->{email}))) {
dbh()->do("update problem set state='hidden' where id=?", {}, $row->{id});
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index 99b46ee23..4b630a099 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.43 2009-11-19 16:41:57 louise Exp $
+# $Id: Cobrand.pm,v 1.44 2009-11-23 17:25:43 louise Exp $
package Cobrand;
use strict;
@@ -148,6 +148,27 @@ sub admin_base_url {
}
+=item email_host COBRAND
+
+Return the virtual host that sends email for this cobrand
+
+=cut
+
+sub email_host {
+ my ($cobrand) = @_;
+ my $email_vhost;
+ if ($cobrand eq '') {
+ $email_vhost = mySociety::Config::get('EMAIL_VHOST');
+ } else {
+ $email_vhost = mySociety::Config::get('EMAIL_VHOST_'. uc($cobrand));
+ }
+ if ($email_vhost && 'http://' . $email_vhost eq mySociety::Config::get('BASE_URL')) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
=item contact_name COBRAND
Return the contact name for the cobranded version of the site