aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-10-20 23:00:35 +0100
committerStruan Donald <struan@exo.org.uk>2011-10-20 23:00:35 +0100
commit1dac169f7e758f842f344d5e324e8872b1aff092 (patch)
treee017780e64e7c8110d61ab339a207d04d09b67cc /perllib/FixMyStreet/App/Controller/Report/New.pm
parentba84d377dc19fe2b2c90e01ce6782d2ef6d79d14 (diff)
actually make the fetching of open311 extra info fields work
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm20
1 files changed, 8 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 0b46992e1..4419ecd92 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -131,21 +131,17 @@ sub report_form_ajax : Path('ajax') : Args(0) {
sub category_extras_ajax : Path('category_extras') : Args(0) {
my ( $self, $c ) = @_;
- my $contacts
- = $c
- ->model('DB::Contact')
- ->not_deleted
- ->search( { area_id => $c->req->param('area_id'), category => $c->req->param('category') } );
+ $c->forward('initialize_report');
+ $c->forward('determine_location') or return 0;
+ $c->forward('setup_categories_and_councils');
my $category_extra = '';
- if ( my $contact = $contacts->first ) {
- if ( $contact->extra ) {
- $c->stash->{report_meta} = {};
- $c->stash->{report} = { category => $c->req->param('category') };
- $c->stash->{category_extras} = { $c->req->param('category' ) => $contact->extra };
+ if ( $c->stash->{category_extras}->{ $c->req->param('category') } ) {
+ $c->stash->{report_meta} = {};
+ $c->stash->{report} = { category => $c->req->param('category') };
+ $c->stash->{category_extras} = { $c->req->param('category' ) => $c->stash->{category_extras}->{ $c->req->param('category') } };
- $category_extra= $c->view('Web')->render( $c, 'report/new/category_extras.html');
- }
+ $category_extra= $c->view('Web')->render( $c, 'report/new/category_extras.html');
}
my $body = JSON->new->utf8(1)->encode(