summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
authorjeff <jeff>2010-09-22 19:16:20 +0000
committerjeff <jeff>2010-09-22 19:16:20 +0000
commit5250c44bd7f282c7d782bf0e8349af12376929df (patch)
treeb2afcd8e47270c6f5b78cff378849168d17ed765 /httemplate/misc/process
parent60ee9af0e885def0dd61f4a5506ac0e55d779e89 (diff)
prepayment discounts rt#5318
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi13
-rw-r--r--httemplate/misc/process/payment.cgi26
2 files changed, 24 insertions, 15 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
index 4da00c63d..aefc00654 100644
--- a/httemplate/misc/process/batch-cust_pay.cgi
+++ b/httemplate/misc/process/batch-cust_pay.cgi
@@ -11,12 +11,13 @@
% #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,
-% }
+% 'custnum' => $param->{"custnum$row"},
+% '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"};
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 665001ea9..c1c9071f9 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -119,19 +119,26 @@ if ( $payby eq 'CHEK' ) {
die "unknown payby $payby";
}
+$cgi->param('discount_term') =~ /^\d*$/
+ or errorpage("illegal discount_term");
+my $discount_term = $1;
+
my $error = '';
my $paynum = '';
if ( $cgi->param('batch') ) {
- $error = $cust_main->batch_card(
- 'payby' => $payby,
- 'amount' => $amount,
- 'payinfo' => $payinfo,
- 'paydate' => "$year-$month-01",
- 'payname' => $payname,
- map { $_ => $cgi->param($_) }
- @{$payby2fields{$payby}}
- );
+ $error = 'Prepayment discounts not supported with batched payments'
+ if $discount_term;
+
+ $error ||= $cust_main->batch_card(
+ 'payby' => $payby,
+ 'amount' => $amount,
+ 'payinfo' => $payinfo,
+ 'paydate' => "$year-$month-01",
+ 'payname' => $payname,
+ map { $_ => $cgi->param($_) }
+ @{$payby2fields{$payby}}
+ );
errorpage($error) if $error;
} else {
@@ -146,6 +153,7 @@ if ( $cgi->param('batch') ) {
'payunique' => $payunique,
'paycvv' => $paycvv,
'paynum_ref' => \$paynum,
+ 'discount_term' => $discount_term,
map { $_ => $cgi->param($_) } @{$payby2fields{$payby}}
);
errorpage($error) if $error;