diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Reports.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 24 |
2 files changed, 23 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm index 91b086637..c57b207e2 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm @@ -255,7 +255,7 @@ sub edit : Path('/admin/report_edit') : Args(1) { $c->detach('edit_display') if $done; } - if ( $c->get_param('resend') && !$c->cobrand->call_hook('disable_resend') ) { + if ( $c->get_param('resend') && !$c->cobrand->call_hook('disable_resend_button') ) { $c->forward('/auth/check_csrf_token'); $problem->resend; @@ -382,7 +382,7 @@ sub edit_category : Private { my ($self, $c, $problem, $no_comment) = @_; if ((my $category = $c->get_param('category')) ne $problem->category) { - my $force_resend = $c->cobrand->call_hook('category_change_force_resend'); + my $force_resend = $c->cobrand->call_hook('category_change_force_resend', $problem->category, $category); my $disable_resend = $c->cobrand->call_hook('disable_resend'); my $category_old = $problem->category; $problem->category($category); diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index db469f130..cbbf8971a 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -697,6 +697,8 @@ sub setup_categories_and_bodies : Private { my %category_extras = (); # extra fields to fill in for open311 my %category_extras_hidden = (); # whether all of a category's fields are hidden + my %category_extras_notices = + (); # whether all of a category's fields are simple notices and not inputs my %non_public_categories = (); # categories for which the reports are not public $c->stash->{unresponsive} = {}; @@ -729,6 +731,16 @@ sub setup_categories_and_bodies : Private { } else { $category_extras_hidden{$contact->category} = $all_hidden; } + + my $all_notices = (grep { + ( $_->{variable} || '' ) ne 'false' + && !$c->cobrand->category_extra_hidden($_) + } @$metas) ? 0 : 1; + if (exists($category_extras_notices{$contact->category})) { + $category_extras_notices{$contact->category} &&= $all_notices; + } else { + $category_extras_notices{$contact->category} = $all_notices; + } } $non_public_categories{ $contact->category } = 1 if $contact->non_public; @@ -760,6 +772,7 @@ sub setup_categories_and_bodies : Private { $c->stash->{category_options} = \@category_options; $c->stash->{category_extras} = \%category_extras; $c->stash->{category_extras_hidden} = \%category_extras_hidden; + $c->stash->{category_extras_notices} = \%category_extras_notices; $c->stash->{non_public_categories} = \%non_public_categories; $c->stash->{extra_name_info} = $first_area->{id} == COUNCIL_ID_BROMLEY ? 1 : 0; @@ -838,9 +851,11 @@ sub process_user : Private { my $user = $c->user->obj; if ($c->stash->{contributing_as_another_user}) { - # Act as if not logged in (and it will be auto-confirmed later on) - $report->user(undef); - last; + if ($params{username} || $params{phone}) { + # Act as if not logged in (and it will be auto-confirmed later on) + $report->user(undef); + last; + } } $report->user( $user ); @@ -854,6 +869,8 @@ sub process_user : Private { $report->name($name); $user->name($name) unless $user->name; $c->stash->{no_reporter_alert} = 1; + } elsif ($c->stash->{contributing_as_another_user}) { + $c->stash->{no_reporter_alert} = 1; } return 1; @@ -1595,6 +1612,7 @@ sub redirect_or_confirm_creation : Private { # Subscribe problem reporter to email updates $c->forward( 'create_reporter_alert' ); if ($c->stash->{contributing_as_another_user} && $report->user->email + && $report->user->id != $c->user->id && !$c->cobrand->report_sent_confirmation_email) { $c->send_email( 'other-reported.txt', { to => [ [ $report->user->email, $report->name ] ], |