aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-03-11 20:11:44 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-03-11 20:11:44 +0000
commitf0b72ef84af77e96dcca3236ed649745cba94ff8 (patch)
tree8c7bbaeee761c88a38158f885cb974d25082c9c4 /perllib/FixMyStreet
parenta97afd505735a9ac44482f10d44eefe855c75970 (diff)
Reports to third party have from email of division/category.
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/SendReport/Zurich.pm15
1 files changed, 14 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/SendReport/Zurich.pm b/perllib/FixMyStreet/SendReport/Zurich.pm
index 4930ff61e..d46561e9e 100644
--- a/perllib/FixMyStreet/SendReport/Zurich.pm
+++ b/perllib/FixMyStreet/SendReport/Zurich.pm
@@ -51,9 +51,22 @@ sub get_template {
return $template;
}
-# Zurich emails come from the site itself
+# Zurich emails come from the site itself, unless it's to an external body,
+# in which case it's from the category/body
sub send_from {
my ( $self, $row ) = @_;
+
+ if ( $row->external_body ) {
+ my $body = @{ $self->bodies }[0];
+ my $body_email = $body->endpoint;
+ my $contact = FixMyStreet::App->model("DB::Contact")->find( {
+ body_id => $body->id,
+ category => $row->category
+ } );
+ $body_email = $contact->email if $contact && $contact->email;
+ return [ $body_email, FixMyStreet->config('CONTACT_NAME') ];
+ }
+
return [ FixMyStreet->config('CONTACT_EMAIL'), FixMyStreet->config('CONTACT_NAME') ];
}