X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fbatch-cust_pay.cgi;h=aa371266cbabd67c245b646bddd4dba20f72d491;hb=dfba562ff61f541ba7c75f2c02b32951b73aa002;hp=e4d1bbff5550dc04c722642a7a23dca2be035633;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index e4d1bbff5..aa371266c 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -1,3 +1,5 @@ +% die "access denied" +% unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); % % my $param = $cgi->Vars; % @@ -8,13 +10,33 @@ % #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"}, -% 'paid' => $param->{"paid$row"}, -% 'payby' => 'BILL', -% 'payinfo' => $param->{"payinfo$row"}, -% 'paybatch' => $paybatch, -% } +% 'custnum' => $custnum, +% 'paid' => $param->{"paid$row"}, +% 'payby' => 'BILL', +% 'payinfo' => $param->{"payinfo$row"}, +% 'discount_term' => $param->{"discount_term$row"}, +% 'paybatch' => $paybatch, +% } % if $param->{"custnum$row"} % || $param->{"paid$row"} % || $param->{"payinfo$row"}; @@ -32,14 +54,15 @@ % % my $erow=0; % $cgi->param('error'. $erow++, shift @errors) while @errors; -% % -<% $cgi->redirect($p.'batch-cust_pay.html?'. $cgi->query_string) +% my $query = $m->scomp('/elements/create_uri_query'); +% +<% $cgi->redirect($p."batch-cust_pay.html?$query") %> % } else { % % -<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %> +<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %> % }