aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-08 13:49:41 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-08 13:49:41 +0000
commitd41b500e09fcc5ca348e9f4f6886bfc1b1e50d8b (patch)
treefe2a7713683d4ac387c17e8536e369052344a837 /perllib/FixMyStreet
parente3bce6312ed59ccd462cae69d214efdb1c19cbbc (diff)
Allow Zurich admin to change location of pin, with confirmation (fixes a1).
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm12
2 files changed, 12 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 2ade99450..0f072b9a2 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -622,6 +622,7 @@ sub report_edit : Path('report_edit') : Args(1) {
$c->forward('get_token');
if ( $c->cobrand->moniker eq 'zurich' ) {
+ $c->stash->{page} = 'admin';
FixMyStreet::Map::display_map(
$c,
latitude => $problem->latitude,
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 9732e5329..daf52c151 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -340,6 +340,8 @@ sub admin_report_edit {
$problem->title( $c->req->param('title') );
$problem->detail( $c->req->param('detail') );
+ $problem->latitude( $c->req->param('latitude') );
+ $problem->longitude( $c->req->param('longitude') );
# Final, public, Update from DM
if (my $update = $c->req->param('status_update')) {
@@ -389,14 +391,22 @@ sub admin_report_edit {
} elsif ($c->req->param('submit')) {
$c->forward('check_token');
+ my $db_update = 0;
+ if ( $c->req->param('latitude') != $problem->latitude || $c->req->param('longitude') != $problem->longitude ) {
+ $problem->latitude( $c->req->param('latitude') );
+ $problem->longitude( $c->req->param('longitude') );
+ $db_update = 1;
+ }
+
my $extra = $problem->extra || {};
$extra->{internal_notes} ||= '';
if ($c->req->param('internal_notes') && $c->req->param('internal_notes') ne $extra->{internal_notes}) {
$extra->{internal_notes} = $c->req->param('internal_notes');
$problem->extra( { %$extra } );
- $problem->update;
}
+ $problem->update if $db_update;
+
# Add new update from status_update
if (my $update = $c->req->param('status_update')) {
FixMyStreet::App->model('DB::Comment')->create( {