aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-09-19 15:44:32 +0100
committerStruan Donald <struan@exo.org.uk>2017-09-27 14:01:02 +0100
commit93895ef28331f60201565b83e674a1ec1365ed55 (patch)
tree5c9eadffe69ddcddc43a47e8397a7f9d4d2f192f /perllib/FixMyStreet/App/Controller/Report.pm
parentaf3c5e24b651b90fe061fd41453c0b4031a263c1 (diff)
limit detailed_information to 172 characters
RDI files have a 180 character limit for the description so limit the description to 172 to allow for the ID which is also included in this field. Fixes mysociety/fixmystreetforcouncils#228
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index e37e08698..60f7ac903 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -335,8 +335,18 @@ sub inspect : Private {
my %update_params = ();
if ($permissions->{report_inspect}) {
- foreach (qw/detailed_information traffic_information/) {
- $problem->set_extra_metadata( $_ => $c->get_param($_) );
+ $problem->set_extra_metadata( traffic_information => $c->get_param('traffic_information') );
+
+ if ( my $info = $c->get_param('detailed_information') ) {
+ $problem->set_extra_metadata( detailed_information => $info );
+ if (length($info) > 172) {
+ $valid = 0;
+ push @{ $c->stash->{errors} },
+ sprintf(
+ _('Detailed information is limited to %d characters.'),
+ $c->cobrand->max_detailed_info_length
+ );
+ }
}
if ( $c->get_param('defect_type') ) {