summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi7
-rw-r--r--httemplate/misc/process/delete-cust_pay_batch.cgi37
-rw-r--r--httemplate/misc/process/email-customer-statement.html9
-rw-r--r--httemplate/misc/process/nms-add_iface.html2
4 files changed, 52 insertions, 3 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
index 1105af943..ff7886239 100644
--- a/httemplate/misc/process/batch-cust_pay.cgi
+++ b/httemplate/misc/process/batch-cust_pay.cgi
@@ -12,7 +12,8 @@ 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++ ) {
+my @invrows = grep(/^invnum\d+\.\d+$/, keys %$param);
+foreach my $row ( map /^custnum(\d+)$/, keys %$param ) {
my $custnum = $param->{"custnum$row"};
my $cust_main;
if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) {
@@ -39,6 +40,7 @@ for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
'payinfo' => $param->{"payinfo$row"},
'discount_term' => $param->{"discount_term$row"},
'paybatch' => $paybatch,
+ 'no_auto_apply' => exists($param->{"no_auto_apply$row"}) ? 'Y' : '',
}
if $param->{"custnum$row"}
|| $param->{"paid$row"}
@@ -48,7 +50,8 @@ for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
# payment applications, if any
my @cust_bill_pay = ();
- for ( my $app = 0; exists($param->{"invnum$row.$app"}); $app++ ) {
+ foreach my $app ( sort {$a <=> $b} map /^invnum$row\.(\d+)$/, @invrows ) {
+# for ( my $app = 0; exists($param->{"invnum$row.$app"}); $app++ ) {
next if !$param->{"invnum$row.$app"};
push @cust_bill_pay, new FS::cust_bill_pay {
'invnum' => $param->{"invnum$row.$app"},
diff --git a/httemplate/misc/process/delete-cust_pay_batch.cgi b/httemplate/misc/process/delete-cust_pay_batch.cgi
new file mode 100644
index 000000000..4937b58e2
--- /dev/null
+++ b/httemplate/misc/process/delete-cust_pay_batch.cgi
@@ -0,0 +1,37 @@
+<% $server->process %>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right('Process batches')
+ || $curuser->access_right('Process global batches');
+
+# look up paybatch using agentnums_sql & status constraints
+# to validate access for this particular cust_pay_batch,
+# similar to how it's done in cust_pay_batch.cgi
+
+my %arg = $cgi->param('arg');
+my $paybatchnum = $arg{'paybatchnum'};
+$paybatchnum =~ /^\d+$/ or die "Illegal paybatchnum";
+my @search = ();
+push @search, 'cust_pay_batch.paybatchnum = ' . $paybatchnum;
+push @search, '(cust_pay_batch.status = \'\' OR cust_pay_batch.status IS NULL)';
+push @search, 'pay_batch.status = \'O\'';
+push @search, $curuser->agentnums_sql({ table => 'cust_main' });
+push @search, $curuser->agentnums_sql({ table => 'pay_batch',
+ null_right => 'Process global batches',
+ });
+my $search = ' WHERE ' . join(' AND ', @search);
+die "permission denied" unless qsearchs({
+ 'table' => 'cust_pay_batch',
+ 'hashref' => {},
+ 'addl_from' => 'LEFT JOIN pay_batch USING ( batchnum ) '.
+ 'LEFT JOIN cust_main USING ( custnum ) '.
+ 'LEFT JOIN cust_pay USING ( batchnum, custnum ) ',
+ 'extra_sql' => $search
+});
+
+my $server = new FS::UI::Web::JSRPC 'FS::cust_pay_batch::process_unbatch_and_delete', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/email-customer-statement.html b/httemplate/misc/process/email-customer-statement.html
new file mode 100644
index 000000000..40a8a702a
--- /dev/null
+++ b/httemplate/misc/process/email-customer-statement.html
@@ -0,0 +1,9 @@
+<% $server->process %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices');
+
+my $server = new FS::UI::Web::JSRPC 'FS::cust_main_Mixin::process_email_search_result', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/nms-add_iface.html b/httemplate/misc/process/nms-add_iface.html
index d21b3792a..79e685686 100644
--- a/httemplate/misc/process/nms-add_iface.html
+++ b/httemplate/misc/process/nms-add_iface.html
@@ -1,4 +1,4 @@
-<& /elements/header-popup.html, 'Interface added') &>
+<& /elements/header-popup.html, 'Interface added' &>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>