aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm23
-rw-r--r--perllib/FixMyStreet/App/Controller/Tokens.pm4
-rw-r--r--templates/web/zurich/admin/report_edit-sdm.html2
-rw-r--r--templates/web/zurich/admin/report_edit.html10
-rw-r--r--templates/web/zurich/report/_item.html2
-rw-r--r--templates/web/zurich/report/_main.html4
6 files changed, 33 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 02bf97f00..21d955366 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -661,6 +661,11 @@ sub report_edit : Path('report_edit') : Args(1) {
my $flagged = $c->req->param('flagged') ? 1 : 0;
my $non_public = $c->req->param('non_public') ? 1 : 0;
+ # Predefine the hash so it's there for lookups
+ # Shallow copy so that the database actually sees any changes? :-/
+ my $extra = { %{ $problem->extra || {} } };
+ $extra->{internal_notes} ||= '';
+
# do this here so before we update the values in problem
if ( $c->req->param('anonymous') ne $problem->anonymous
|| $c->req->param('name') ne $problem->name
@@ -668,7 +673,7 @@ sub report_edit : Path('report_edit') : Args(1) {
|| $c->req->param('title') ne $problem->title
|| $c->req->param('detail') ne $problem->detail
|| ($c->req->param('body') && $c->req->param('body') ne $problem->bodies_str)
- || ($c->req->param('extra') && $c->req->param('extra') ne $problem->extra)
+ || ($c->req->param('internal_notes') && $c->req->param('internal_notes') ne $extra->{internal_notes})
|| $flagged != $problem->flagged
|| $non_public != $problem->non_public )
{
@@ -681,7 +686,19 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->state( $new_state );
$problem->name( $c->req->param('name') );
$problem->bodies_str( $c->req->param('body') ) if $c->req->param('body');
- $problem->extra( $c->req->param('extra') ) if $c->req->param('extra');
+ if ($c->req->param('internal_notes')) {
+ $extra->{internal_notes} = $c->req->param('internal_notes');
+ $problem->extra( $extra );
+ }
+
+ # Zurich have photos being published or not; can't just check as with
+ # e.g. internal_notes as it's a checkbox and won't be set if it's not
+ # ticked
+ if ($c->cobrand->moniker eq 'zurich') {
+ $extra->{publish_photo} = $c->req->params->{publish_photo} || 0;
+ $problem->extra( $extra );
+ }
+
$problem->flagged( $flagged );
$problem->non_public( $non_public );
@@ -726,7 +743,7 @@ sub report_edit : Path('report_edit') : Args(1) {
if ( $c->cobrand->moniker eq 'zurich' && $c->req->param('body') ) {
my $problem_body = $c->req->param('body');
my $admin_body = $c->stash->{body};
- if ($admin_body ne $problem_body) {
+ if ($admin_body->id ne $problem_body) {
$c->detach('index');
}
}
diff --git a/perllib/FixMyStreet/App/Controller/Tokens.pm b/perllib/FixMyStreet/App/Controller/Tokens.pm
index b726ad825..740822876 100644
--- a/perllib/FixMyStreet/App/Controller/Tokens.pm
+++ b/perllib/FixMyStreet/App/Controller/Tokens.pm
@@ -56,8 +56,10 @@ sub confirm_problem : Path('/P') {
# For Zurich, email confirmation simply sets a flag, it does not change the
# problem state, log in, or anything else
if ($c->cobrand->moniker eq 'zurich') {
+ my $extra = { %{ $problem->extra || {} } };
+ $extra->{email_confirmed} = 1;
$problem->update( {
- anonymous => 0,
+ extra => $extra,
confirmed => \'ms_current_timestamp()',
} );
diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html
index dd9144e14..5bfab360a 100644
--- a/templates/web/zurich/admin/report_edit-sdm.html
+++ b/templates/web/zurich/admin/report_edit-sdm.html
@@ -19,7 +19,7 @@
<li>[% loc('Category:') %] [% problem.category | html %] </li>
<li>[% loc('Name:') %] [% problem.name | html %]
<li>[% loc('Email:') %] [% problem.user.email | html %]
-[% IF NOT problem.anonymous %][% loc('Confirmed') %][% END %]
+[% IF problem.extra.email_confirmed %][% loc('Confirmed') %][% END %]
<li>[% loc('Phone:') %] [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li>
<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li>
diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html
index 4c74a5d64..2a1b54416 100644
--- a/templates/web/zurich/admin/report_edit.html
+++ b/templates/web/zurich/admin/report_edit.html
@@ -35,14 +35,14 @@
[% END %]
</select></li>
-<li><label for="extra">[% loc('Internal notes:') %]</label>
-<textarea name='extra' id='extra' cols=60 rows=5>[% problem.extra | html %]</textarea></li>
+<li><label for="internal_notes">[% loc('Internal notes:') %]</label>
+<textarea name='internal_notes' id='internal_notes' cols=60 rows=5>[% problem.extra.internal_notes | html %]</textarea></li>
<li>[% loc('Category:') %] [% problem.category | html %] </li>
<input type="hidden" name="anonymous" value="[% problem.anonymous %]">
<li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% problem.name | html %]'></li>
<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% problem.user.email | html %]'>
-[% IF NOT problem.anonymous %][% loc('Confirmed') %][% END %]
+[% IF problem.extra.email_confirmed %][% loc('Confirmed') %][% END %]
</li>
<li>[% loc('Phone:') %] [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li>
<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li>
@@ -57,8 +57,8 @@
<input type="submit" name="rotate_photo" value="Rotate Left" />
<input type="submit" name="rotate_photo" value="Rotate Right" />
<br>
-<input type="checkbox" id="remove_photo" name="remove_photo" value="1">
-<label class="inline" for="remove_photo">[% loc("Remove photo (can't be undone!)") %]</label></li>
+<input type="checkbox" id="publish_photo" name="publish_photo" value="1">
+<label class="inline" for="publish_photo">[% loc("Publish photo") %]</label></li>
[% END %]
</ul>
<input type="submit" name="Submit changes" value="[% loc('Submit changes') %]" ></form>
diff --git a/templates/web/zurich/report/_item.html b/templates/web/zurich/report/_item.html
index 7de8aca29..4286eae1b 100644
--- a/templates/web/zurich/report/_item.html
+++ b/templates/web/zurich/report/_item.html
@@ -1,6 +1,6 @@
<li>
<a class="text" href="[% c.uri_for('/report', problem.id ) %]">
- [% IF problem.state != 'unconfirmed' AND problem.photo %]
+ [% IF problem.state != 'unconfirmed' AND problem.photo AND problem.extra.publish_photo %]
<img class="img" height="60" width="90" src="/photo/[% problem.id %].fp.jpeg" alt="">
[% END %]
[% IF problem.state != 'unconfirmed' %]
diff --git a/templates/web/zurich/report/_main.html b/templates/web/zurich/report/_main.html
index 395737474..32da47423 100644
--- a/templates/web/zurich/report/_main.html
+++ b/templates/web/zurich/report/_main.html
@@ -15,7 +15,9 @@
</em></p>
[% IF problem.state != 'unconfirmed' %]
- [% INCLUDE 'report/photo.html' object=problem %]
+ [% IF problem.extra.publish_photo %]
+ [% INCLUDE 'report/photo.html' object=problem %]
+ [% END %]
[% add_links( problem.detail ) | html_para %]
[% ELSE %]
[% loc('This report is awaiting moderation.') %]