blob: c60643566a351de62136d9f538e651509ab2d69e (
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
|
package FixMyStreet::SendReport::NI;
use Moose;
BEGIN { extends 'FixMyStreet::SendReport::Email'; }
sub build_recipient_list {
my ( $self, $row, $h ) = @_;
my $all_confirmed = 1;
foreach my $body ( @{ $self->bodies } ) {
my $contact = FixMyStreet::App->model("DB::Contact")->find( {
deleted => 0,
body_id => $body->id,
category => $row->category
} );
my ($email, $confirmed, $note) = ( $contact->email, $contact->confirmed, $contact->note );
unless ($confirmed) {
$all_confirmed = 0;
$email = 'N/A' unless $email;
}
my $name = $body->name;
if ( $email =~ /^roads.([^@]*)\@drdni/ ) {
$name = "Roads Service (\u$1)";
$h->{bodies_name} = $name;
$row->external_body( 'Roads Service' );
}
push @{ $self->to }, [ $email, $name ];
}
return $all_confirmed && @{$self->to};
}
1;
|