summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authormark <mark>2010-09-23 23:21:06 +0000
committermark <mark>2010-09-23 23:21:06 +0000
commit7f75baeccde8bf68e6914ce7efac73cdb7e7dcd0 (patch)
treea5f3dd722c99e3fef67d209dd90fda99aaf3c6c3 /httemplate
parente6c54cd41c23d8c0da9d5e0f66c20a571470d435 (diff)
fix use of agent_custid in quick payment entry, RT#10035
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi21
-rw-r--r--httemplate/misc/xmlhttp-cust_main-search.cgi4
2 files changed, 22 insertions, 3 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
index aefc006..e51b9e6 100644
--- a/httemplate/misc/process/batch-cust_pay.cgi
+++ b/httemplate/misc/process/batch-cust_pay.cgi
@@ -10,8 +10,27 @@
% #my $row = 0;
% #while ( exists($param->{"custnum$row"}) ) {
% for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
+% my $custnum = $param->{"custnum$row"};
+% my $cust_main;
+% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) {
+% $cust_main = qsearchs({
+% 'table' => 'cust_main',
+% 'hashref' => { 'custnum' => $1 },
+% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+% });
+% }
+% if ( !$cust_main ) { # not found, try agent_custid
+% $cust_main = qsearchs({
+% 'table' => 'cust_main',
+% 'hashref' => { 'agent_custid' => $custnum },
+% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+% });
+% }
+% $custnum = $cust_main->custnum if $cust_main;
+% # if !$cust_main, then this will throw an error on batch_insert
+%
% push @cust_pay, new FS::cust_pay {
-% 'custnum' => $param->{"custnum$row"},
+% 'custnum' => $custnum,
% 'paid' => $param->{"paid$row"},
% 'payby' => 'BILL',
% 'payinfo' => $param->{"payinfo$row"},
diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi
index 26e68b5..615a4bb 100644
--- a/httemplate/misc/xmlhttp-cust_main-search.cgi
+++ b/httemplate/misc/xmlhttp-cust_main-search.cgi
@@ -2,10 +2,10 @@
%
% my $custnum = $cgi->param('arg');
% my $cust_main = '';
-% if ( $custnum <= 2147483647 ) {
+% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) {
% $cust_main = qsearchs({
% 'table' => 'cust_main',
-% 'hashref' => { 'custnum' => $custnum },
+% 'hashref' => { 'custnum' => $1 },
% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
% });
% }