manual batch approval and TD EFT fixes, RT#10545
[freeside.git] / httemplate / misc / process / pay_batch-approve.cgi
diff --git a/httemplate/misc/process/pay_batch-approve.cgi b/httemplate/misc/process/pay_batch-approve.cgi
new file mode 100644 (file)
index 0000000..f857e23
--- /dev/null
@@ -0,0 +1,16 @@
+% if ( $error ) {
+%   $cgi->param('error', $error);
+% }
+<% $cgi->redirect(popurl(3)."search/cust_pay_batch.cgi?dcln=1;batchnum=$batchnum") %>
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Process batches');
+
+my $batchnum = $cgi->param('batchnum');
+# make a record in the paybatch of who did this
+my $paybatch = 'manual-'.$FS::CurrentUser::CurrentUser->username.
+   '-' . time2str('%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+my $pay_batch = qsearchs('pay_batch', { 'batchnum' => $batchnum })
+  or die "batchnum '$batchnum' not found";
+my $error = $pay_batch->manual_approve('paybatch' => $paybatch);
+</%init>