aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Questionnaire.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-07-18 16:59:27 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-07-18 16:59:27 +0100
commit0bc2183e1d3b8cca7fab6ff87016c1ada63522a3 (patch)
treee4bb4f15a7142d0900406d63cc461a13f05d90ff /perllib/FixMyStreet/App/Controller/Questionnaire.pm
parent799b23f0fe03d58116a6ebcd1fa26f5ae77338d4 (diff)
Couple more URLs to right site (e.g. already answered questionnaire).
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm22
1 files changed, 11 insertions, 11 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() ],