From: ivan Date: Fri, 18 Nov 2005 03:48:30 +0000 (+0000) Subject: allow expired cards to remain on file; only check edits for an expired card when... X-Git-Tag: BEFORE_FINAL_MASONIZE~305 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=ee0e5cbfd357b5943f08ee26e4894a88d1ea9d40 allow expired cards to remain on file; only check edits for an expired card when the # has changed --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 54d56988e..f9031d792 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2,7 +2,7 @@ package FS::cust_main; use strict; use vars qw( @ISA @EXPORT_OK $DEBUG $me $conf @encrypted_fields - $import $skip_fuzzyfiles ); + $import $skip_fuzzyfiles $ignore_expired_card ); use vars qw( $realtime_bop_decline_quiet ); #ugh use Safe; use Carp; @@ -59,6 +59,7 @@ $me = '[FS::cust_main]'; $import = 0; $skip_fuzzyfiles = 0; +$ignore_expired_card = 0; @encrypted_fields = ('payinfo', 'paycvv'); @@ -926,6 +927,11 @@ sub replace { unless grep { $_ eq getotaker } $conf->config('users-allow_comp'); } + local($ignore_expired_card) = 1 + if $old->payby =~ /^(CARD|DCRD)$/ + && $self->payby =~ /^(CARD|DCRD)$/ + && $old->payinfo eq $self->payinfo; + my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; @@ -1281,7 +1287,7 @@ sub check { if ( $self->paydate eq '' || $self->paydate eq '-' ) { return "Expriation date required" - unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB|CASH|WEST)$/; + unless $self->payby =~ /^(BILL|PREPAY|CHEK|DCHK|LECB|CASH|WEST)$/; $self->paydate(''); } else { my( $m, $y ); @@ -1295,7 +1301,9 @@ sub check { $self->paydate("$y-$m-01"); my($nowm,$nowy)=(localtime(time))[4,5]; $nowm++; $nowy+=1900; return gettext('expired_card') - if !$import && ( $y<$nowy || ( $y==$nowy && $1<$nowm ) ); + if !$import + && !$ignore_expired_card + && ( $y<$nowy || ( $y==$nowy && $1<$nowm ) ); } if ( $self->payname eq '' && $self->payby !~ /^(CHEK|DCHK)$/ &&