diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-03-25 23:17:38 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-03-25 23:17:38 -0700 |
commit | 06e353b743e7be88afa8fce50ea10f27ebb7adef (patch) | |
tree | f8bd2217de55b2f2aca9c01794aafbad302307b8 /httemplate/misc/xmlhttp-cust_main-email_search.html | |
parent | 56230080801b578c595f5807c7e878452b6bc12d (diff) | |
parent | 8e73bf5782dc6fe2b299ba759ad15780a8946cc4 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/misc/xmlhttp-cust_main-email_search.html')
-rw-r--r-- | httemplate/misc/xmlhttp-cust_main-email_search.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/httemplate/misc/xmlhttp-cust_main-email_search.html b/httemplate/misc/xmlhttp-cust_main-email_search.html new file mode 100644 index 000000000..d8c8ef44c --- /dev/null +++ b/httemplate/misc/xmlhttp-cust_main-email_search.html @@ -0,0 +1,29 @@ +<% JSON::to_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 = ( + "cust_main_invoice.dest != 'POST'", + "cust_main_invoice.dest LIKE ".dbh->quote('%'.$email.'%'), + $FS::CurrentUser::CurrentUser->agentnums_sql(table => 'cust_main'), +); +my @cust_main = qsearch({ + 'table' => 'cust_main', + 'select' => 'cust_main.*, cust_main_invoice.dest', + 'addl_from' => 'JOIN cust_main_invoice USING (custnum)', + 'extra_sql' => 'WHERE '.join(' AND ', @where), +}); + +my @result = map { + [ $_->custnum, + $_->name, + $_->dest, + $_->invoice_noemail, + $_->message_noemail, + ] +} @cust_main; + +</%init> |