aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport/Zurich.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-06-06 10:30:52 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-06-20 13:37:49 +0100
commite03c068ecd1b752f68eaa3904a3f4755884078fb (patch)
tree3f5d82a7a050ab148b34f9eea48a13289eb42636 /perllib/FixMyStreet/SendReport/Zurich.pm
parent1aeca7c6130aa6de377c8e00e8d22ae05943e919 (diff)
better error if category for report does not exist
It is possible that the category of a report no longer exists and in that case the Open311 send process was falling over. This checks that we've found a contact and if not sets the error and skips the report.
Diffstat (limited to 'perllib/FixMyStreet/SendReport/Zurich.pm')
-rw-r--r--perllib/FixMyStreet/SendReport/Zurich.pm5
1 files changed, 1 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/SendReport/Zurich.pm b/perllib/FixMyStreet/SendReport/Zurich.pm
index 59adfd688..7416c64f9 100644
--- a/perllib/FixMyStreet/SendReport/Zurich.pm
+++ b/perllib/FixMyStreet/SendReport/Zurich.pm
@@ -29,10 +29,7 @@ sub build_recipient_list {
my $parent = $body->parent;
if ($parent && !$parent->parent) {
# Division, might have an individual contact email address
- my $contact = $row->result_source->schema->resultset("Contact")->find( {
- body_id => $body->id,
- category => $row->category
- } );
+ my $contact = $self->fetch_category($body, $row);
$body_email = $contact->email if $contact && $contact->email;
}