aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Contact.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-09-09 15:00:37 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-09-09 15:55:07 +0100
commit61a9a61baa45040c7479a316118cc28ecb85934e (patch)
treea613a04d5f8ac4441375ee874094a1b708d4a6e5 /perllib/FixMyStreet/DB/Result/Contact.pm
parent2acf9eb59867c299da568bf77c9019fe6c3eb9ff (diff)
Improve display of category extra data in admin.
Allow get_extra_metadata to return all the data with no argument.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Contact.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Contact.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm
index b37734e7a..0c9a7c0d8 100644
--- a/perllib/FixMyStreet/DB/Result/Contact.pm
+++ b/perllib/FixMyStreet/DB/Result/Contact.pm
@@ -86,7 +86,15 @@ __PACKAGE__->many_to_many( response_priorities => 'contact_response_priorities',
sub get_metadata_for_input {
my $self = shift;
my $id_field = $self->id_field;
- return [ grep { $_->{code} !~ /^(easting|northing|$id_field)$/ } @{$self->get_extra_fields} ];
+ my @metadata = grep { $_->{code} !~ /^(easting|northing|$id_field)$/ } @{$self->get_extra_fields};
+
+ # Just in case the extra data is in an old parsed format
+ foreach (@metadata) {
+ if (ref $_->{values} eq 'HASH') {
+ $_->{values} = [ map { { name => $_->{name}[0], key => $_->{key}[0] } } @{$_->{values}->{value}} ];
+ }
+ }
+ return \@metadata;
}
sub id_field {