diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 3 | ||||
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index f7334c115..e4e82f091 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1003,7 +1003,7 @@ sub set_report_extras : Private { foreach my $contact (@$contacts) { my $metas = $contact->get_metadata_for_input; foreach my $field ( @$metas ) { - if ( lc( $field->{required} ) eq 'true' && !$c->cobrand->category_extra_hidden($field->{code})) { + if ( lc( $field->{required} ) eq 'true' && !$c->cobrand->category_extra_hidden($field)) { unless ( $c->get_param($param_prefix . $field->{code}) ) { $c->stash->{field_errors}->{ $field->{code} } = _('This information is required'); } @@ -1020,7 +1020,7 @@ sub set_report_extras : Private { my $metas = $extra_fields->get_extra_fields; $param_prefix = "extra[" . $extra_fields->id . "]"; foreach my $field ( @$metas ) { - if ( lc( $field->{required} ) eq 'true' && !$c->cobrand->category_extra_hidden($field->{code})) { + if ( lc( $field->{required} ) eq 'true' && !$c->cobrand->category_extra_hidden($field)) { unless ( $c->get_param($param_prefix . $field->{code}) ) { $c->stash->{field_errors}->{ $field->{code} } = _('This information is required'); } diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 03a6c1a83..8c4d8be53 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -1178,7 +1178,7 @@ Return true if an Open311 service attribute should be a hidden field. sub category_extra_hidden { my ($self, $meta) = @_; - return 0; + return 0; } =item reputation_increment_states/reputation_decrement_states diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index e1f5e565f..0ecb6a7c6 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -396,7 +396,8 @@ sub lookup_by_ref_regex { sub category_extra_hidden { my ($self, $meta) = @_; - return 1 if $meta eq 'usrn' || $meta eq 'asset_id'; + return 1 if $meta->{code} eq 'usrn' || $meta->{code} eq 'asset_id'; + return 1 if $meta->{automated} eq 'hidden_field'; return 0; } diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index 30d888eb4..af89e3169 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -267,6 +267,8 @@ sub _add_meta_to_contact { @meta = grep { ! $ignore{ $_->{ code } } } @meta; } + @meta = grep { !defined $_->{automated} || $_->{ automated } eq 'hidden_field' } @meta; + $contact->set_extra_fields(@meta); $contact->update; } |