LP1901930 Add some missing SIP fields
authorBill Erickson <berickxx@gmail.com>
Tue, 29 Nov 2022 15:40:20 +0000 (10:40 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 29 Nov 2022 15:40:20 +0000 (10:40 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Common.pm

index f7c2a20..3a985e8 100644 (file)
@@ -318,16 +318,9 @@ sub handle_patron_info {
         {PA => $SC->sipymd($patron->expire_date)},
         {PB => $SC->sipymd($patron->dob, 1)},
         {PC => $patron->profile->name},
-        {XI => $patron->id},
-        $SC->stat_cat_sip_fields($patron)
+        {XI => $patron->id}
     );
 
-    $SC->maybe_add_field($response, BD => $details->{patron_address});
-    $SC->maybe_add_field($response, BE => $patron->email);
-    $SC->maybe_add_field($response, BF => $details->{patron_phone});
-    $SC->maybe_add_field($response, 
-        PI => $patron->net_access_level ? $patron->net_access_level->name : '');
-
     if ($list_items eq 'hold_items') {
         for my $hold (@{$details->{hold_items}}) {
             push(@{$response->{fields}}, {AS => $hold});
@@ -423,8 +416,8 @@ sub patron_response_common_data {
         . $SC->spacebool($details->{too_many_fines})
         ;
 
-    return {
+
+    my $response = {
         fixed_fields => [
             $status,
             '000', # language
@@ -440,9 +433,18 @@ sub patron_response_common_data {
             {BH => $session->config->{settings}->{currency}},
             {BL => $SC->sipbool(1)},          # valid patron
             {BV => $details->{balance_owed}}, # fee amount
-            {CQ => $SC->sipbool($details->{valid_patron_password})}
+            {CQ => $SC->sipbool($details->{valid_patron_password})},
+            $SC->stat_cat_sip_fields($patron),
         ]
     };
+
+    $SC->maybe_add_field($response, BD => $details->{patron_address});
+    $SC->maybe_add_field($response, BE => $patron->email);
+    $SC->maybe_add_field($response, BF => $details->{patron_phone});
+    $SC->maybe_add_field($response, 
+        PI => $patron->net_access_level ? $patron->net_access_level->name : '');
+
+    return $response;
 }
 
 sub handle_block {
index 6337593..b90e1f2 100644 (file)
@@ -146,7 +146,7 @@ sub stat_cat_sip_fields {
         my $value = $entry_map->stat_cat_entry;
         my $format = $stat_cat->sip_format;
 
-        if (defined $format) {
+        if ($format) {
 
             if ($format =~ /^\|(.*)\|$/) { # Is format a regex?