From: Bill Erickson Date: Thu, 27 Oct 2016 20:35:22 +0000 (-0400) Subject: JBAS-1643 Teacher cards pad ID to 4 chars min. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=68db13ff97a51b2927245b4954e6d600e973c33f;p=working%2FEvergreen.git JBAS-1643 Teacher cards pad ID to 4 chars min. Signed-off-by: Bill Erickson --- 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 c9edc780c5..45ef109364 100755 --- a/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl +++ b/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl @@ -252,9 +252,18 @@ sub iterate_csv_rows { $csv->column_names($csv->fields); while (my $phash = $csv->getline_hr($fh)) { + + # If the ID value is less than 4 characters, pad the value + # with zeros to be 4 characters long. This will effect + # the barcode and password. + # Only do this for teacher accounts. + $phash->{student_id} = sprintf('%0.4d', $phash->{student_id}) + if $is_teacher && length($phash->{student_id}) < 4; + # Teacher cards have an extra 't' between district code and ID. $phash->{barcode} = $district_code . ($is_teacher ? 't' : '') . $phash->{student_id}; + $row_handler->($phash); }