diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2018-09-13 10:51:01 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2018-09-13 10:51:01 -0700 |
| commit | 6383208b0f004ddcb26c74788595dce6673863f8 (patch) | |
| tree | 98a9d8902e707bb63f25154fdf84d1b146fd2004 /httemplate/misc/process/payment.cgi | |
| parent | 24fcbda43464e5ee5a342a52f6c5780e12693402 (diff) | |
| parent | bc552f2fba7fd376a2f036a7dc02b58a48fa31b0 (diff) | |
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_4_BRANCH
Diffstat (limited to 'httemplate/misc/process/payment.cgi')
| -rw-r--r-- | httemplate/misc/process/payment.cgi | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 939fc38c2..7747bcbea 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -100,11 +100,11 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { # use new info ## - $cgi->param('year') =~ /^(\d+)$/ + $cgi->param('year') =~ /^(\d{4})/ or errorpage("illegal year ". $cgi->param('year')); $year = $1; - $cgi->param('month') =~ /^(\d+)$/ + $cgi->param('month') =~ /^(\d{2})/ or errorpage("illegal month ". $cgi->param('month')); $month = $1; @@ -211,15 +211,21 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { 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; + # 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, |
