diff options
author | Struan Donald <struan@exo.org.uk> | 2012-08-22 10:57:10 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-08-22 10:57:10 +0100 |
commit | 2e0a4e8ec45579e4e5c9cf8aa123d5ab215b9703 (patch) | |
tree | c13e3c59b686e01460dc7960547f7e9c53c288bd /perllib/FixMyStreet/App/Controller/Questionnaire.pm | |
parent | b99c5ff97b29a27eeba52ed24385ac30388e875c (diff) | |
parent | 88a7d38dffa3dabdf0f85573b254cea9c8ab232b (diff) |
Merge remote-tracking branch 'origin/master' into fmb-read-only
Conflicts:
.gitignore
bin/make_css
conf/general.yml-example
perllib/FixMyStreet/App/Controller/Council.pm
perllib/FixMyStreet/App/Controller/Report/New.pm
perllib/FixMyStreet/Cobrand/Default.pm
templates/web/default/around/around_index.html
templates/web/default/index.html
templates/web/emptyhomes/index.html
templates/web/fixmystreet/around/around_index.html
templates/web/fixmystreet/index.html
web/fixmystreet_app_cgi.cgi
web/fixmystreet_app_fastcgi.cgi
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 6aa4f7604..f0cc72e07 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() ], @@ -199,7 +199,7 @@ sub submit_standard : Private { mark_open => $new_state eq 'confirmed' ? 1 : 0, lang => $c->stash->{lang_code}, cobrand => $c->cobrand->moniker, - cobrand_data => $c->cobrand->extra_update_data, + cobrand_data => '', confirmed => \'ms_current_timestamp()', anonymous => $problem->anonymous, } @@ -281,10 +281,10 @@ sub display : Private { map { Utils::truncate_coordinate($_) } ( $problem->latitude, $problem->longitude ); - $c->stash->{updates} = $c->model('DB::Comment')->search( + $c->stash->{updates} = [ $c->model('DB::Comment')->search( { problem_id => $problem->id, state => 'confirmed' }, { order_by => 'confirmed' } - ); + )->all ]; $c->stash->{page} = 'questionnaire'; FixMyStreet::Map::display_map( |