diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-05-18 11:43:35 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-05-18 11:43:35 +0100 |
commit | e9475bd7f2af04aacc40e44fde7394092a2731ae (patch) | |
tree | 7d2a6a4cc044094692104963bdb2af3617ddb8c3 /perllib/FixMyStreet | |
parent | 2ef89c84b5e418e0967a518893197dfd537dc70e (diff) |
Remove some duplicate code.
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 58 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 2 |
2 files changed, 3 insertions, 57 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 90e71a36e..f65c2c258 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -1,5 +1,6 @@ package FixMyStreet::Cobrand::Bromley; -use base 'FixMyStreet::Cobrand::UKCouncils'; +use parent 'FixMyStreet::Cobrand::FixMyStreet'; +use parent 'FixMyStreet::Cobrand::UKCouncils'; use strict; use warnings; @@ -53,60 +54,5 @@ sub pin_colour { return 'yellow'; } -# Copy of function from FixMyStreet.pm cobrand as it's not inherited currently -sub generate_problem_banner { - my ( $self, $problem ) = @_; - - my $banner = {}; - if ( $problem->is_open && time() - $problem->lastupdate_local->epoch > 8 * 7 * 24 * 60 * 60 ) - { - $banner->{id} = 'unknown'; - $banner->{text} = _('Unknown'); - } - if ($problem->is_fixed) { - $banner->{id} = 'fixed'; - $banner->{text} = _('Fixed'); - } - if ($problem->is_closed) { - $banner->{id} = 'closed'; - $banner->{text} = _('Closed'); - } - - if ( grep { $problem->state eq $_ } ( 'investigating', 'in progress', 'planned' ) ) { - $banner->{id} = 'progress'; - $banner->{text} = _('In progress'); - } - - return $banner; -} - -sub process_extras { - my $self = shift; - my $ctx = shift; - my $contacts = shift; - my $extra = shift; - - for my $field (qw/ fms_extra_title first_name last_name /) { - my $value = $ctx->request->param($field); - - if ( !$value ) { - $ctx->stash->{field_errors}->{$field} = - _('This information is required'); - } - push @$extra, - { - name => $field, - description => uc($field), - value => $value || '', - }; - } - - if ( $ctx->request->param('fms_extra_title') ) { - $ctx->stash->{fms_extra_title} = - $ctx->request->param('fms_extra_title'); - $ctx->stash->{extra_name_info} = 1; - } -} - 1; diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 774723420..bd7c708a8 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -54,7 +54,7 @@ sub process_extras { my $extra = shift; if ( $contacts->[0]->area_id == 2482 ) { - for my $field ( qw/ fms_extra_title / ) { + for my $field ( qw/ fms_extra_title first_name last_name / ) { my $value = $ctx->request->param( $field ); if ( !$value ) { |