Skip to content

Commit

Permalink
Allow through a 0 extra question value.
Browse files Browse the repository at this point in the history
If an extra question had 0 as a key, it
was considered false and not given.
  • Loading branch information
dracos committed Nov 9, 2024
1 parent a020eb8 commit b4e02cb
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 233 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- Fix CSV export of reports with only hidden/unconfirmed updates. #5119
- Fix displaying category page if over 1,000 history entries.
- Stop wrapping category notices in a label.
- Allow through a "0" extra question value.
- Admin improvements:
- Rename emergency message to site message.
- Added a category control for overriding the text of the new report details field.
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/App/Controller/Report/New.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ sub set_report_extras : Private {
my ($metas, $param_prefix) = @$item;
foreach my $field ( @$metas ) {
if ( lc( $field->{required} || '' ) eq 'true' && !$c->cobrand->category_extra_hidden($field)) {
unless ( $c->get_param($param_prefix . $field->{code}) ) {
unless ( length $c->get_param($param_prefix . $field->{code}) ) { # Length to allow through "0" as an accepted answer
$c->stash->{field_errors}->{ 'x' . $field->{code} } = _('This information is required');
}
}
Expand Down
Loading

0 comments on commit b4e02cb

Please sign in to comment.