diff options
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 22 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/Update.pm | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index f3cefb701..604a58d37 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -31,27 +31,27 @@ sub check_questionnaire : Private { my $questionnaire = $c->stash->{questionnaire}; - my $problem_id = $questionnaire->problem_id; + my $problem = $questionnaire->problem; if ( $questionnaire->whenanswered ) { - my $problem_url = $c->uri_for( "/report/$problem_id" ); + my $problem_url = $c->cobrand->base_url_for_report( $problem ) . $problem->url; my $contact_url = $c->uri_for( "/contact" ); $c->stash->{message} = sprintf(_("You have already answered this questionnaire. If you have a question, please <a href='%s'>get in touch</a>, or <a href='%s'>view your problem</a>.\n"), $contact_url, $problem_url); $c->stash->{template} = 'errors/generic.html'; $c->detach; } - unless ( $questionnaire->problem->is_visible ) { + unless ( $problem->is_visible ) { $c->detach('missing_problem'); } - $c->stash->{problem} = $questionnaire->problem; - $c->stash->{answered_ever_reported} = $questionnaire->problem->user->answered_ever_reported; + $c->stash->{problem} = $problem; + $c->stash->{answered_ever_reported} = $problem->user->answered_ever_reported; # EHA needs to know how many to alter display, and whether to send another or not if ($c->cobrand->moniker eq 'emptyhomes') { $c->stash->{num_questionnaire} = $c->model('DB::Questionnaire')->count( - { problem_id => $c->stash->{problem}->id } + { problem_id => $problem->id } ); } @@ -96,15 +96,16 @@ sub submit_creator_fixed : Private { my @errors; - map { $c->stash->{$_} = $c->req->params->{$_} || '' } qw(reported problem); + $c->stash->{reported} = $c->req->params->{reported}; + $c->stash->{problem_id} = $c->req->params->{problem}; # should only be able to get to here if we are logged and we have a # problem - unless ( $c->user && $c->stash->{problem} ) { + unless ( $c->user && $c->stash->{problem_id} ) { $c->detach('missing_problem'); } - my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem} } ); + my $problem = $c->cobrand->problems->find( { id => $c->stash->{problem_id} } ); # you should not be able to answer questionnaires about problems # that you've not submitted @@ -114,13 +115,12 @@ sub submit_creator_fixed : Private { push @errors, _('Please say whether you\'ve ever reported a problem to your council before') unless $c->stash->{reported}; - $c->stash->{problem_id} = $c->stash->{problem}; $c->stash->{errors} = \@errors; $c->detach( 'creator_fixed' ) if scalar @errors; my $questionnaire = $c->model( 'DB::Questionnaire' )->find_or_new( { - problem_id => $c->stash->{problem}, + problem_id => $c->stash->{problem_id}, # we want to look for any previous questionnaire here rather than one for # this specific open state -> fixed transistion old_state => [ FixMyStreet::DB::Result::Problem->open_states() ], diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 3a2b40c2c..298824f3b 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -348,7 +348,7 @@ sub redirect_or_confirm_creation : Private { if ( $update->confirmed ) { $c->forward( 'update_problem' ); $c->forward( 'signup_for_alerts' ); - my $report_uri = $c->uri_for( '/report', $update->problem_id ); + my $report_uri = $c->cobrand->base_url_for_report( $update->problem ) . $update->problem->url; $c->res->redirect($report_uri); $c->detach; } |