diff options
author | Dave Arter <davea@mysociety.org> | 2016-08-30 18:48:07 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-09 12:01:45 +0100 |
commit | 638c5d3be601c3949f1d1ce7ecae5d8b77ad8f7c (patch) | |
tree | 064a223fdcc62298dfb3f88858ddbd53084d2e65 /perllib/FixMyStreet/Cobrand | |
parent | 3f55b249eb6dfe46fa3f6855d90510ff2d4900e9 (diff) |
Add ‘Inspection required’ field to categories
Categories can now require reports to be marked as 'inspected' via the frontend
before they're sent by send-reports.
A side-effect here is that send-reports will perform an extra n queries for each
report, where n is the number of bodies that report is being sent to, but
hopefully in practice this won't matter as it's an offline cronjob.
See mysociety/fixmystreetforcouncils#50
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index a58f50b18..b5487ea5b 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -860,25 +860,25 @@ sub get_report_stats { return 0; } sub get_body_sender { my ( $self, $body, $category ) = @_; + # look up via category + my $contact = $body->contacts->search( { category => $category } )->first; if ( $body->can_be_devolved ) { - # look up via category - my $config = $body->result_source->schema->resultset("Contact")->search( { body_id => $body->id, category => $category } )->first; - if ( $config->send_method ) { - return { method => $config->send_method, config => $config }; + if ( $contact->send_method ) { + return { method => $contact->send_method, config => $contact, contact => $contact }; } else { - return { method => $body->send_method, config => $body }; + return { method => $body->send_method, config => $body, contact => $contact }; } } elsif ( $body->send_method ) { - return { method => $body->send_method, config => $body }; + return { method => $body->send_method, config => $body, contact => $contact }; } - return $self->_fallback_body_sender( $body, $category ); + return $self->_fallback_body_sender( $body, $category, $contact ); } sub _fallback_body_sender { - my ( $self, $body, $category ) = @_; + my ( $self, $body, $category, $contact ) = @_; - return { method => 'Email' }; + return { method => 'Email', contact => $contact }; }; sub example_places { |