blob: 32ac0ef8d1679fd759ce1a7f5068a918a50dca0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
package FixMyStreet::Cobrand::FixMyStreet;
use base 'FixMyStreet::Cobrand::Default';
# FixMyStreet should return all cobrands
sub restriction {
return {};
}
sub get_council_sender {
my ( $self, $area_id, $area_info ) = @_;
my $send_method;
my $council_config = FixMyStreet::App->model("DB::Open311conf")->search( { area_id => $area_id } )->first;
$send_method = $council_config->send_method if $council_config;
return $send_method if $send_method;
return 'London' if $area_info->{type} eq 'LBO';
return 'Email';
}
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;
my $fields = shift || [];
if ( $contacts->[0]->area_id == 2482 ) {
my @fields = ( 'fms_extra_title', @$fields );
for my $field ( @fields ) {
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;
|