From 25c84867140f2d493808da9ed2c64d05cda0dbdc Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 24 Sep 2015 07:37:59 -0700 Subject: [PATCH] JBAS-886 student importer max expire date Avoid expire dates far in the future on invalid DoB's by assuming no students are younger than 2 years old for the purposes of calculating the expire date. Note, this does not affect the stored DoB. We store whatever is sent. Signed-off-by: Bill Erickson --- KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl b/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl index 9b1734fc06..8330b7e5f2 100755 --- a/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl +++ b/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl @@ -280,6 +280,12 @@ sub set_expire_date { my $now_year = DateTime->now->year; my $expire_year = $now_year + (18 - ($now_year - $year)); + # Invalid DoB's can lead to expire_date's far in the future. + # If a student's birth year puts them at less than 2 years old, + # modify the year to make them appear 2 years old for calculating + # the expire year. We retain the provided day and month. + $expire_year = ($now_year + 16) if ($expire_year - $now_year) > 16; + # if dob occurs after july 1, expire date will occur the following year. $expire_year++ if ($mon > 7) or ($mon == 7 and $day > 1); -- 2.11.0