From 8032977c915b42634c70feee045b4ec42c3db98f Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 24 Oct 2008 02:08:21 +0000 Subject: fixes to facilitate using agent_custid as custnum, RT#4190 --- httemplate/misc/xmlhttp-cust_main-search.cgi | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'httemplate/misc/xmlhttp-cust_main-search.cgi') diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 20707dab8..26e68b5d8 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -1,11 +1,21 @@ % if ( $sub eq 'custnum_search' ) { % % my $custnum = $cgi->param('arg'); -% my $cust_main = qsearchs({ -% 'table' => 'cust_main', -% 'hashref' => { 'custnum' => $custnum }, -% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, -% }); +% my $cust_main = ''; +% if ( $custnum <= 2147483647 ) { +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'custnum' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } +% if ( ! $cust_main ) { +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'agent_custid' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } % "<% $cust_main ? $cust_main->name : '' %>" % @@ -19,6 +29,8 @@ % } <%init> +my $conf = new FS::Conf; + my $sub = $cgi->param('sub'); -- cgit v1.2.1