From: Bill Erickson Date: Thu, 12 Apr 2018 16:53:50 +0000 (-0700) Subject: JBAS-1998 College cards import tweaks X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=68aad2471e04065991f27417179c5935d38d09a6;p=working%2FEvergreen.git JBAS-1998 College cards import tweaks * 4-year expire * sftp file checks updates 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 c6e1441b92..3a4590af11 100755 --- a/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl +++ b/KCLS/utility-scripts/import_students/generate-patrons-from-csv.pl @@ -85,6 +85,7 @@ my $default_pass; my $commit_mode = 'rollback'; # single xact, then rollback (for testing) my $is_teacher = 0; my $is_classroom = 0; +my $is_college = 0; my $purge_all = 0; my $force_new = 0; my $out_dir = '.'; @@ -106,6 +107,7 @@ GetOptions( 'default-pass=s' => \$default_pass, 'teacher' => \$is_teacher, 'classroom' => \$is_classroom, + 'college' => \$is_college, 'log-stdout' => \$log_stdout, 'out-dir=s' => \$out_dir, 'db-user=s' => \$db_user, @@ -371,6 +373,13 @@ sub set_expire_date { return; } + if ($is_college) { + # college cards expire after 4 years. + $now_date->set_year($now_year + 4); + $phash->{expire_date} = $now_date; + return; + } + my ($year, $mon, $day) = ($phash->{dob} =~ /(\d{4})-(\d{2})-(\d{2})/); my $expire_year = $now_year + ($expire_age - ($now_year - $year)); diff --git a/KCLS/utility-scripts/import_students/sftp-client-agent.sh b/KCLS/utility-scripts/import_students/sftp-client-agent.sh index 2f71b3b61b..a135dfb975 100755 --- a/KCLS/utility-scripts/import_students/sftp-client-agent.sh +++ b/KCLS/utility-scripts/import_students/sftp-client-agent.sh @@ -42,10 +42,15 @@ DISTRICT_CODES=( 414 # Lake Washington 415 # Kent 417 # Northshore +); + +# College students are processed differently +COLLEGE_CODES=( "lwt" # Lake Washington Institute of Technology ); # Hard-code the districts eligible for automatic teacher account processing. +# College teacher accounts are processed the same as school teacher accounts. TEACHER_DISTRICTS=( 402 # Vashon 403 # Renton @@ -162,16 +167,22 @@ for code in "${DISTRICT_CODES[@]}"; do for FILE in $($SSH "$COMMAND -l"); do LOCAL_FILE=$(basename $FILE) TEACHER_FLAG="" + COLLEGE_FLAG="" announce "Inspecting file $FILE" # File format examples: # 415.2016-03-18.csv # 415.teacher.2016-03-18.csv - if [[ $LOCAL_FILE =~ ^[0-9]{3}.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then + if [[ $LOCAL_FILE =~ ^[0-9a-z]{3}.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then announce "Found a student file." + + if [[ " ${COLLEGE_CODES[@]} " =~ " $code " ]]; then + announce "Processing a college student file" + COLLEGE_FLAG="--college" + fi else - if [[ $LOCAL_FILE =~ ^[0-9]{3}.teacher.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then + if [[ $LOCAL_FILE =~ ^[0-9a-z]{3}.teacher.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then announce "Found a teacher file." if [[ " ${TEACHER_DISTRICTS[@]} " =~ " $code " ]]; then