projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c2b4bc6
)
RT# 81183 Fix crash processing payment with new payment method
author
Mitch Jackson
<mitch@freeside.biz>
Sat, 25 Aug 2018 02:31:14 +0000
(22:31 -0400)
committer
Mitch Jackson
<mitch@freeside.biz>
Fri, 7 Sep 2018 19:01:16 +0000
(15:01 -0400)
httemplate/misc/process/payment.cgi
patch
|
blob
|
history
diff --git
a/httemplate/misc/process/payment.cgi
b/httemplate/misc/process/payment.cgi
index
939fc38
..
d0e5896
100644
(file)
--- a/
httemplate/misc/process/payment.cgi
+++ b/
httemplate/misc/process/payment.cgi
@@
-211,15
+211,21
@@
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
my $error = '';
my $paynum = '';
my $error = '';
my $paynum = '';
-my $paydate;
-if ($cust_payby->paydate) { $paydate = "$year-$month-01"; }
-else { $paydate = "2037-12-01"; }
if ( $cgi->param('batch') ) {
$error = 'Prepayment discounts not supported with batched payments'
if $discount_term;
if ( $cgi->param('batch') ) {
$error = 'Prepayment discounts not supported with batched payments'
if $discount_term;
+ # Invalid payment expire dates are replaced with 2037-12-01 (why?)
+ my $paydate = "${year}-${month}-01";
+ {
+ use DateTime;
+ local $@;
+ eval { DateTime->new({ year => $year, month => $month, day => 1 }) };
+ $paydate = '2037-12-01' if $@;
+ }
+
$error ||= $cust_main->batch_card(
'payby' => $payby,
'amount' => $amount,
$error ||= $cust_main->batch_card(
'payby' => $payby,
'amount' => $amount,