diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-03-14 10:37:41 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-03-14 10:37:41 +0000 |
commit | 85ed45239a70f41afc8446cfc0f53acaffdeee3f (patch) | |
tree | 0a30d8db5d46628d37e3728eea15394245592c52 /perllib/FixMyStreet/SendReport | |
parent | 1d2bf7c4c9d00ac25b715a3797c9a7f5bd9c170c (diff) | |
parent | e7036ce558eebb9bde980aa1206cb4d67683ae3d (diff) |
Merge branch 'zurich'
Conflicts:
locale/FixMyStreet.po
locale/cy_GB.UTF-8/LC_MESSAGES/EmptyHomes.po
locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po
locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po
locale/nn_NO.UTF-8/LC_MESSAGES/FixMyStreet.po
Diffstat (limited to 'perllib/FixMyStreet/SendReport')
-rw-r--r-- | perllib/FixMyStreet/SendReport/Zurich.pm | 15 |
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') ]; } |