diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 17 |
2 files changed, 18 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index dedd447ee..b2413d9e5 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -922,11 +922,7 @@ sub check_for_errors : Private { # let the model check for errors $c->stash->{field_errors} ||= {}; - my %field_errors = ( - %{ $c->stash->{field_errors} }, - %{ $c->stash->{report}->user->check_for_errors }, - %{ $c->stash->{report}->check_for_errors }, - ); + my %field_errors = $c->cobrand->report_check_for_errors( $c ); # FIXME: need to check for required bromley fields here diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index cc8f6c526..0401f58c3 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -739,5 +739,22 @@ until the contacts/area/body handling is rewritten to be better. sub reports_by_body { 0; } +=head2 report_check_for_errors + +Perform validation for new reports. Takes Catalyst context object as an argument + +=cut + +sub report_check_for_errors { + my $self = shift; + my $c = shift; + + return ( + %{ $c->stash->{field_errors} }, + %{ $c->stash->{report}->user->check_for_errors }, + %{ $c->stash->{report}->check_for_errors }, + ); +} + 1; |