diff options
author | Dave Arter <davea@mysociety.org> | 2015-02-05 15:09:49 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2015-10-06 09:09:22 +0100 |
commit | e9961ee495ab87cbe67cf37e53edbae0794541d2 (patch) | |
tree | 79596f3b3cad4325351fb2a92e617c401471d61e /perllib/FixMyStreet/App/Controller/Admin.pm | |
parent | a78bb3fc98dd1851e371c78d9743125d02baf04e (diff) |
[Zurich] 'photo required' functionality
- Save 'photo_required' value in Contact->extra from admin edit form
- Enforce per-category photo requirement on new reports
A new step has been added to the photo upload process that
ensures a photo is present if any of the categories chosen for
the report require it.
If the photo is missing an error is displayed to the user in the
same manner as if the photo upload was invalid.
- Add test of mandatory photo categories
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index d7bca05a7..7ead7db16 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -364,6 +364,14 @@ 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 + if ( $c->req->param('photo_required') ) { + $contact->set_extra_metadata_if_undefined( photo_required => 1 ); + } + else { + $contact->unset_extra_metadata( 'photo_required' ); + } + if ( %errors ) { $c->stash->{updated} = _('Please correct the errors below'); $c->stash->{contact} = $contact; |