diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-03-08 17:26:04 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-03-09 15:31:40 +0000 |
commit | a5636fc2acd3e03b853f3644fedc054e3eb8b905 (patch) | |
tree | d4e60f0e25c27574045fd069df9904f55dc3a1fb /perllib/FixMyStreet/Cobrand | |
parent | b3c925c1b76b93e7c952f1925a959346fae72bef (diff) |
Add cobrand-specific custom reporting fields.
This adds a new cobrand variable, report_form_extras, which contains a
list of extra fields that will be saved in the 'extra' metadata of the
report. Fields may optionally be marked as required.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 12 |
2 files changed, 13 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index a8e967ba7..b3b830f06 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -754,6 +754,17 @@ If set to an arrayref, will plot those area ID(s) from mapit on all the /around sub areas_on_around { []; } +=head2 + +A list of extra fields we wish to save to the database in the 'extra' column of +problems based on variables passed in by the form. Return a list of hashrefs +of values we wish to save, e.g. +( { name => 'address', required => 1 }, { name => 'passport', required => 0 } ) + +=cut + +sub report_form_extras {} + sub process_open311_extras {} =head 2 pin_colour diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm index 1a18bfa1b..995c39c85 100644 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm @@ -132,16 +132,8 @@ sub council_rss_alert_options { return ( \@options, @reported_to_options ? \@reported_to_options : undef ); } -sub process_open311_extras { - my $self = shift; - my $ctx = shift; - my $body_id = shift; - my $extra = shift; - - my $value = $ctx->get_param('address') || ''; - $ctx->stash->{field_errors}->{address} = _('This information is required') - unless $value; - $extra->{address} = $value; +sub report_form_extras { + ( { name => 'address', required => 1 } ) } sub front_stats_data { |