From da5d6a46f4ca05547ce31f26e4e00b5401e4a9a3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 11 Sep 2017 14:25:13 -0400 Subject: [PATCH] Teacher cards short username handles characters Fixes bug in teacher account generator so that it properly handles student_id values less than 4 characters for both numbers and letters. Previously it would fail padding non-numeric IDs. Signed-off-by: Bill Erickson --- KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 df672e8813..f36903c41b 100755 --- a/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl +++ b/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl @@ -271,7 +271,7 @@ sub iterate_csv_rows { # 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}) + $phash->{student_id} = sprintf('%04s', $phash->{student_id}) if $is_teacher && length($phash->{student_id}) < 4; # All teacher ID's, which can be alpha-numeric, are upper case. -- 2.11.0