diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-06-15 12:43:54 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-06-15 13:47:53 +0100 |
commit | 8d428f9c8fd9e25821560a20d00d444d9fb67e08 (patch) | |
tree | 52b75a1f922b589a151acccc0ee38c2ac9a90f59 /perllib/FixMyStreet/App/Controller/Report/New.pm | |
parent | 96c72fa72e547a2ce5b435db3cae8c3c45efafc1 (diff) |
Tidy up Open311 XML handling.
Parse the XML in such a way other parts of the code do not have to worry
about single-value folding or the like.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 696234d32..b60f7ee78 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -641,8 +641,14 @@ sub setup_categories_and_bodies : Private { push @category_options, $contact->category; my $metas = $contact->get_extra_fields; - $category_extras{ $contact->category } = $metas - if scalar @$metas; + if (scalar @$metas) { + foreach (@$metas) { + if ($_->{values} && $_->{values}->{value}) { + $_->{values} = [ map { { name => $_->{name}[0], key => $_->{key}[0] } } @{$_->{values}->{value}} ]; + } + } + $category_extras{ $contact->category } = $metas; + } my $body_send_method = $bodies{$contact->body_id}->send_method || ''; $c->stash->{unresponsive}{$contact->category} = $contact->body_id |