Skip to content

Commit

Permalink
Merge pull request #50 from multnomah-county-it/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
john-c-houser authored Dec 21, 2022
2 parents 6461d20 + 305db68 commit 2e34ea0
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ingestor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ sub search {
my %options = ( ct => 1000, includeFields => 'barcode,firstName,middleName,lastName' );
my $bydob = ILSWS::patron_search($token, 'BIRTHDATE', "${year}${mon}${day}", \%options);

if ( $bydob->{'totalResults'} >= 1 ) {
if ( $bydob && $bydob->{'totalResults'} >= 1 ) {

# If we found a person or persons with student's DOB, then we continue
# by searching via street.
Expand Down Expand Up @@ -614,25 +614,24 @@ sub create_data_structure {
$new_student{'fields'}{'alternateID'} = "$client->{'id'}$student->{'student_id'}";
}

$new_student{'fields'}{'firstName'} = $student->{'first_name'};
if ( $student->{'middle_name'} ne 'null' ) {
$new_student{'fields'}{'middleName'} = $student->{'middle_name'};
}
$new_student{'fields'}{'lastName'} = $student->{'last_name'};
$new_student{'fields'}{'birthDate'} = $student->{'dob'};

if ( $mode eq 'new_defaults' ) {
$new_student{'fields'}{'pin'} = "${mon}${day}${year}";
}
$new_student{'fields'}{'firstName'} = $student->{'first_name'};
if ( $student->{'middle_name'} ne 'null' ) {
$new_student{'fields'}{'middleName'} = $student->{'middle_name'};
}
$new_student{'fields'}{'lastName'} = $student->{'last_name'};

$new_student{'fields'}{'category01'}{'resource'} = '/policy/patronCategory01';
$new_student{'fields'}{'category01'}{'key'} = $client->{$mode}->{'user_categories'}->{'1'};
$new_student{'fields'}{'pin'} = "${mon}${day}${year}";

if ( $mode eq 'new_defaults' ) {
$new_student{'fields'}{'category02'}{'resource'} = '/policy/patronCategory02';
$new_student{'fields'}{'category02'}{'key'} = $client->{'new_defaults'}->{'user_categories'}->{'2'};
}

$new_student{'fields'}{'category01'}{'resource'} = '/policy/patronCategory01';
$new_student{'fields'}{'category01'}{'key'} = $client->{$mode}->{'user_categories'}->{'1'};

$new_student{'fields'}{'category03'}{'resource'} = '/policy/patronCategory03';
$new_student{'fields'}{'category03'}{'key'} = $client->{$mode}->{'user_categories'}->{'3'};

Expand Down

0 comments on commit 2e34ea0

Please sign in to comment.