From ef36cbc541bcb85901d8b67bd2afdefc8c1b5e80 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Tue, 24 Oct 2017 15:23:09 +0100 Subject: [PATCH] Add setting of is_local to organisations --- .../LocalLoop/Controller/Admin/Organisations.pm | 4 ++++ templates/admin/organisations/list.html.ep | 7 +++++++ .../admin/organisations/valid_read.html.ep | 17 +++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm index 78d8460..2cb3660 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm @@ -35,6 +35,7 @@ sub add_org_submit { $validation->optional('sector'); $validation->optional('postcode')->postcode; $validation->optional('pending'); + $validation->optional('is_local'); if ( $validation->has_error ) { $c->flash( error => 'The validation has failed' ); @@ -53,6 +54,7 @@ sub add_org_submit { postcode => $validation->param('postcode'), submitted_by_id => $c->current_user->id, pending => defined $validation->param('pending') ? 0 : 1, + is_local => $validation->param('is_local'), }, type => 'organisation', }); @@ -94,6 +96,7 @@ sub valid_edit { $validation->optional('sector'); $validation->required('postcode')->postcode; $validation->optional('pending'); + $validation->optional('is_local'); if ( $validation->has_error ) { $c->flash( error => 'The validation has failed' ); @@ -111,6 +114,7 @@ sub valid_edit { sector => $validation->param('sector'), postcode => $validation->param('postcode'), pending => defined $validation->param('pending') ? 0 : 1, + is_local => $validation->param('is_local'), }); } ); } finally { diff --git a/templates/admin/organisations/list.html.ep b/templates/admin/organisations/list.html.ep index ac9b90e..0203c5d 100644 --- a/templates/admin/organisations/list.html.ep +++ b/templates/admin/organisations/list.html.ep @@ -28,6 +28,13 @@ % if ( $org_result->pending ) { Unvalidated % } + % if ( !defined $org_result->is_local ) { + Locality Not Set + % } elsif ( $org_result->is_local ) { + Local Org + % } else { + Non Local Org + % } % } diff --git a/templates/admin/organisations/valid_read.html.ep b/templates/admin/organisations/valid_read.html.ep index ce24858..db6bd95 100644 --- a/templates/admin/organisations/valid_read.html.ep +++ b/templates/admin/organisations/valid_read.html.ep @@ -57,25 +57,34 @@ function initMap() {
- +
- %= include 'partials/sector_options', selected_sector => $valid_org->sector || '';
- +
- +
pending ? '' : ' checked' %>>
+
+ +
+ +
+