blob: 9453b4ca504348afd85fcc0814976e4e867b045e (
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
|
package FixMyStreet::SendReport::EmptyHomes;
use Moose;
use namespace::autoclean;
BEGIN { extends 'FixMyStreet::SendReport::Email'; }
sub build_recipient_list {
my $self = shift;
my $row = shift;
my $areas_info = shift;
my %recips;
my $all_confirmed = 1;
foreach my $council ( keys %{ $self->councils } ) {
my $contact = FixMyStreet::App->model("DB::Contact")->find( {
deleted => 0,
area_id => $council,
category => 'Empty property',
} );
my ($council_email, $confirmed, $note) = ( $contact->email, $contact->confirmed, $contact->note );
$council_email = essex_contact($row->latitude, $row->longitude) if $council == 2225;
$council_email = oxfordshire_contact($row->latitude, $row->longitude) if $council == 2237 && $council_email eq 'SPECIAL';
unless ($confirmed) {
$all_confirmed = 0;
#$note = 'Council ' . $row->council . ' deleted'
#unless $note;
$council_email = 'N/A' unless $council_email;
#$notgot{$council_email}{$row->category}++;
#$note{$council_email}{$row->category} = $note;
}
push @{ $self->to }, [ $council_email, $self->councils->{ $council } ];
$recips{$council_email} = 1;
my $country = $areas_info->{$council}->{country};
if ($country eq 'W') {
$recips{ 'shelter@' . mySociety::Config::get('EMAIL_DOMAIN') } = 1;
} else {
$recips{ 'eha@' . mySociety::Config::get('EMAIL_DOMAIN') } = 1;
}
}
return () unless $all_confirmed;
return keys %recips;
}
1;
|