From 638c5d3be601c3949f1d1ce7ecae5d8b77ad8f7c Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Tue, 30 Aug 2016 18:48:07 +0100 Subject: =?UTF-8?q?Add=20=E2=80=98Inspection=20required=E2=80=99=20field?= =?UTF-8?q?=20to=20categories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- perllib/FixMyStreet/App/Controller/Admin.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm') diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 66b46877f..c853827d0 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -362,13 +362,19 @@ sub update_contacts : Private { $contact->api_key( $c->get_param('api_key') ); $contact->send_method( $c->get_param('send_method') ); - # Set the photo_required flag in extra to the appropriate value + # Set flags in extra to the appropriate values if ( $c->get_param('photo_required') ) { $contact->set_extra_metadata_if_undefined( photo_required => 1 ); } else { $contact->unset_extra_metadata( 'photo_required' ); } + if ( $c->get_param('inspection_required') ) { + $contact->set_extra_metadata( inspection_required => 1 ); + } + else { + $contact->unset_extra_metadata( 'inspection_required' ); + } if ( %errors ) { $c->stash->{updated} = _('Please correct the errors below'); -- cgit v1.2.3