Fixed issue where the LRC of a card was the reverse of the start
[magread] / carddetect.cpp
index 58473a4..e196ca1 100644 (file)
@@ -195,6 +195,13 @@ void CardDetect::aamvaCardCheck( QString expDate ) {
        }
        card->aamvaBirthday = QDate::fromString( bday, "yyyyMMdd" );
 
+       //set the age
+       card->aamvaAge = QDate::currentDate().year() - card->aamvaBirthday.year();
+       QDate curBday;
+       curBday.setDate( QDate::currentDate().year(), card->aamvaBirthday.month(), card->aamvaBirthday.day() );
+       if( curBday > QDate::currentDate() )
+               card->aamvaAge--;
+
        //set the expiration date
        if( expDate.endsWith( "99" ) ) { // expires on the birth day and month in the given year
                expDate.replace( 2, 4, bday.mid( 4, 4 ) );