diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Peterborough.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Roles/ConfirmValidation.pm | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm index fcdf44859..0de626c35 100644 --- a/perllib/FixMyStreet/Cobrand/Peterborough.pm +++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm @@ -16,6 +16,8 @@ sub map_type { 'MasterMap' } sub send_questionnaires { 0 } +sub max_title_length { 50 } + sub disambiguate_location { my $self = shift; my $string = shift; diff --git a/perllib/FixMyStreet/Roles/ConfirmValidation.pm b/perllib/FixMyStreet/Roles/ConfirmValidation.pm index 6474c94d1..27592b33c 100644 --- a/perllib/FixMyStreet/Roles/ConfirmValidation.pm +++ b/perllib/FixMyStreet/Roles/ConfirmValidation.pm @@ -17,6 +17,8 @@ Confirm field lengths. has max_report_length => ( is => 'ro', default => 2000 ); +has max_title_length => ( is => 'ro', default => 0 ); + sub report_validation { my ($self, $report, $errors) = @_; @@ -28,6 +30,10 @@ sub report_validation { $errors->{phone} = sprintf( _('Phone numbers are limited to %s characters in length.'), 20 ); } + if ( $self->max_title_length > 0 && length( $report->title ) > $self->max_title_length ) { + $errors->{title} = sprintf( _('Summaries are limited to %d characters in length. Please shorten your summary'), 50 ); + } + if ( length( $report->detail ) > $self->max_report_length ) { $errors->{detail} = sprintf( _('Reports are limited to %s characters in length. Please shorten your report'), $self->max_report_length ); } |