blob: eb9ecc8f65a0ed185ff2bd3d63bc054bfe1c47ea (
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
|
<% encode_json(\@result) %>\
<%init>
die 'access denied'
unless $FS::CurrentUser::CurrentUser->access_right('Edit customer');
my $sub = $cgi->param('sub');
my $email = $cgi->param('arg');
my @where = (
'contact_email.emailaddress LIKE '.dbh->quote('%'.$email.'%'),
$FS::CurrentUser::CurrentUser->agentnums_sql(table => 'cust_main'),
);
my @cust_main = qsearch({
'table' => 'cust_main',
'select' => 'cust_main.*',
'addl_from' => ' JOIN cust_contact USING (custnum) '.
' JOIN contact_email USING (contactnum)',
'extra_sql' => 'WHERE '.join(' AND ', @where),
});
my @result = map {
[ $_->custnum,
$_->name,
$_->dest,
$_->invoice_noemail,
$_->message_noemail,
]
} @cust_main;
</%init>
|