From f3d48cda02218523b2cafcc3c3edfe5771d8676e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 24 Apr 2002 09:03:37 +0000 Subject: [PATCH] msgcat error for credit card expiration (closes: Bug#407) --- FS/FS/cust_main.pm | 9 ++++----- 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', + }, + ); } -- 2.11.0