diff options
author | ivan <ivan> | 2002-04-24 09:03:37 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-04-24 09:03:37 +0000 |
commit | f3d48cda02218523b2cafcc3c3edfe5771d8676e (patch) | |
tree | 9a2a3de7cde256d9acd7a4463ba0bfcead2697be | |
parent | 91a5fe454cc6411bc0f8db545bc42f55fe2cd510 (diff) |
msgcat error for credit card expiration (closes: Bug#407)
-rw-r--r-- | FS/FS/cust_main.pm | 9 | ||||
-rwxr-xr-x | bin/populate-msgcat | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 6fefe0db3..4a6a95251 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -683,11 +683,10 @@ sub check { } else { $self->paydate =~ /^(\d{1,2})[\/\-](\d{2}(\d{2})?)$/ or return "Illegal expiration date: ". $self->paydate; - if ( length($2) == 4 ) { - $self->paydate("$2-$1-01"); - } else { - $self->paydate("20$2-$1-01"); - } + my $y = length($2) == 4 ? $2 : "20$2"; + $self->paydate("$y-$1-01"); + my($nowm,$nowy)=(localtime(time))[4,5]; $nowm++; $nowy+=1900; + return gettext('expired_card') if $y<$nowy || ( $y==$nowy && $1<$nowm ); } if ( $self->payname eq '' ) { diff --git a/bin/populate-msgcat b/bin/populate-msgcat index 64fa59a44..506cf5f0b 100755 --- a/bin/populate-msgcat +++ b/bin/populate-msgcat @@ -102,6 +102,10 @@ sub messages { #'en_US' => '', }, + 'expired_card' => { + 'en_US' => 'Expired card', + }, + ); } |