aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index cd943070d..5cf634e14 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -692,7 +692,7 @@ sub process_report : Private {
my @extra = ();
my $metas = $contacts[0]->extra;
- foreach my $field ( @{ $metas->{attribute} } ) {
+ foreach my $field ( sort { $a->{order} <=> $b->{order} } values %$metas ) {
if ( lc( $field->{required} ) eq 'true' ) {
unless ( $c->request->param( $field->{code} ) ) {
$c->stash->{field_errors}->{ $field->{code} } = _('This information is required');
@@ -705,8 +705,10 @@ sub process_report : Private {
};
}
- $c->stash->{report_meta} = \@extra if @extra;
- $report->extra( \@extra ) if @extra;
+ if ( @extra ) {
+ $c->stash->{report_meta} = \@extra;
+ $report->extra( \@extra );
+ }
} elsif ( @{ $c->stash->{area_ids_to_list} } ) {
# There was an area with categories, but we've not been given one. Bail.