summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
authorivan <ivan>2005-10-10 12:20:57 +0000
committerivan <ivan>2005-10-10 12:20:57 +0000
commit550685eff557af23e242c545d6a9e27a7ef44f23 (patch)
treef269ba2ad03102153812a8e95d4c7b8ecb5f7994 /httemplate/misc/process
parentcf8f8aafc5595b31f24a7b0d06289c830d123cb8 (diff)
updated quick payment entry
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi40
1 files changed, 40 insertions, 0 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
new file mode 100644
index 000000000..1cc6c3bad
--- /dev/null
+++ b/httemplate/misc/process/batch-cust_pay.cgi
@@ -0,0 +1,40 @@
+<%
+ my $param = $cgi->Vars;
+
+ #my $paybatch = $param->{'paybatch'};
+ my $paybatch = time2str('webbatch-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+
+ my @cust_pay = ();
+ #my $row = 0;
+ #while ( exists($param->{"custnum$row"}) ) {
+ for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
+ push @cust_pay, new FS::cust_pay {
+ 'custnum' => $param->{"custnum$row"},
+ 'paid' => $param->{"paid$row"},
+ 'payby' => 'BILL',
+ 'payinfo' => $param->{"payinfo$row"},
+ 'paybatch' => $paybatch,
+ }
+ if $param->{"custnum$row"}
+ || $param->{"paid$row"}
+ || $param->{"payinfo$row"};
+ #$row++;
+ }
+
+ my @errors = FS::cust_pay->batch_insert(@cust_pay);
+ my $num_errors = scalar(grep $_, @errors);
+
+ if ( $num_errors ) {
+
+ $cgi->param('error', "$num_errors error". ($num_errors>1 ? 's' : '') );
+
+ my $erow=0;
+ $cgi->param('error'. $erow++, shift @errors) while @errors;
+
+ %><%= $cgi->redirect($p.'batch-cust_pay.html?'. $cgi->query_string)
+
+ %><% } else {
+
+ %><%= $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+
+ <% } %>