aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm18
2 files changed, 26 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index d2af4949e..c8bae90e6 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -854,6 +854,14 @@ sub prettify_dt {
return Utils::prettify_dt( $dt, 1 );
}
+=head2 extra_contact_validation
+
+Perform any extra validation on the contact form.
+
+=cut
+
+sub extra_contact_validation { (); }
+
sub problem_as_hashref {
my $self = shift;
my $problem = shift;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index c3a1f9d9d..ce62e206e 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -21,5 +21,23 @@ sub title_list {
return undef;
}
+sub extra_contact_validation {
+ my $self = shift;
+ my $c = shift;
+
+ my %errors;
+
+ $c->stash->{dest} = $c->req->param('dest');
+
+ $errors{dest} = "Please enter who your message is for"
+ unless $c->req->param('dest');
+
+ if ( $c->req->param('dest') eq 'council' || $c->req->param('dest') eq 'update' ) {
+ $errors{not_for_us} = 1;
+ }
+
+ return %errors;
+}
+
1;