diff options
author | Struan Donald <struan@exo.org.uk> | 2019-06-06 10:30:52 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-06-20 13:37:49 +0100 |
commit | e03c068ecd1b752f68eaa3904a3f4755884078fb (patch) | |
tree | 3f5d82a7a050ab148b34f9eea48a13289eb42636 /perllib/FixMyStreet/SendReport/Open311.pm | |
parent | 1aeca7c6130aa6de377c8e00e8d22ae05943e919 (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/Open311.pm')
-rw-r--r-- | perllib/FixMyStreet/SendReport/Open311.pm | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index 8a6b992fd..45b056dc2 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -36,13 +36,9 @@ sub send { my $cobrand = $body->get_cobrand_handler || $row->get_cobrand_logged; $cobrand->call_hook(open311_config => $row, $h, \%open311_params); - # Try and fill in some ones that we've been asked for, but not asked the user for - - my $contact = $row->result_source->schema->resultset("Contact")->not_deleted->find( { - body_id => $body->id, - category => $row->category - } ); + my $contact = $self->fetch_category($body, $row) or next; + # Try and fill in some ones that we've been asked for, but not asked the user for my $extra = $row->get_extra_fields(); my $id_field = $contact->id_field; |