LP1901930 SIP2Mediator checkin repairs
authorBill Erickson <berickxx@gmail.com>
Mon, 2 Nov 2020 15:24:19 +0000 (10:24 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 30 Nov 2020 16:38:25 +0000 (08:38 -0800)
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/Checkin.pm

index 7612303..0bdda66 100644 (file)
@@ -411,7 +411,7 @@ sub handle_checkout {
         ],
         fields => [
             {AA => $patron_barcode},
-            {AB => $item_barcode},
+            {AB => $item_barcode}
         ]
     } unless ($item_details && $patron_details);
 
@@ -422,10 +422,10 @@ sub handle_checkout {
         fee_ack => $fee_ack
     );
 
-
     my $magnetic = $item_details->{magnetic_media};
     my $deposit = $item_details->{item}->deposit_amount;
-    my $msg = $circ_details->{screen_msg};
+    my $screen_msg = $circ_details->{screen_msg};
+    my $due_date = $circ_details->{due_date};
     my $circ = $circ_details->{circ};
 
     my $can_renew = 0;
@@ -446,15 +446,15 @@ sub handle_checkout {
         fields => [
             {AA => $patron_barcode},
             {AB => $item_barcode},
-            $msg ? {AF => $msg} : (),
-            $circ ? {AH => $circ_details->{due_date}} : (),
             {AJ => $item_details->{title}},
-            $circ ? {BK => $circ->id} : (),
             {AO => $config->{institution}},
             {BT => $item_details->{fee_type}},
-            $deposit ? {BV => $deposit} : (),
             {CI => 0}, # security inhibit
-            {CK => $item_details->{media_type}}
+            {CK => $item_details->{media_type}},
+            $screen_msg ? {AF => $screen_msg}   : (),
+            $due_date   ? {AH => $due_date}     : (),
+            $circ       ? {BK => $circ->id}     : (),
+            $deposit    ? {BV => $deposit}      : (),
         ]
     };
 }
@@ -493,10 +493,11 @@ sub handle_checkin {
         item_details => $item_details
     );
 
-    my $msg = $checkin_details->{screen_msg};
+    my $screen_msg = $checkin_details->{screen_msg};
     my $magnetic = $item_details->{magnetic_media};
     my $hold_bc = $checkin_details->{hold_patron_barcode};
     my $hold_name = $checkin_details->{hold_patron_name};
+    my $dest_loc = $checkin_details->{destination_loc};
 
     return {
         code => '10',
@@ -510,7 +511,6 @@ sub handle_checkin {
         fields => [
             {AA => $checkin_details->{patron_barcode}},
             {AB => $item_barcode},
-            $msg ? {AF => $msg} : (),
             {AJ => $item_details->{title}},
             {AO => $config->{institution}},
             {AP => $checkin_details->{current_loc}},
@@ -520,9 +520,10 @@ sub handle_checkin {
             {CI => 0}, # security inhibit
             {CK => $item_details->{media_type}},
             {CV => $checkin_details->{alert_type}},
-            {CT => $checkin_details->{destination_loc}},
-            $hold_bc ? {CY => $hold_bc} : (),
-            $hold_name ? {DA => $hold_name} : ()
+            $screen_msg ? {AF => $screen_msg}   : (),
+            $dest_loc   ? {CT => $dest_loc}     : (),
+            $hold_bc    ? {CY => $hold_bc}      : (),
+            $hold_name  ? {DA => $hold_name}    : ()
         ]
     };
 }
index cb042ca..0f01462 100644 (file)
@@ -46,8 +46,8 @@ sub perform_checkin {
     };
 
     $args->{circ_lib} = 
-        $SC->org_id_from_sn($params{corrent_loc}) || 
-        $session->editor->requestor->ws_ou;
+        $SC->org_id_from_sn($session, $params{corrent_loc}) 
+        || $session->editor->requestor->ws_ou;
 
     my $method = 'open-ils.circ.checkin';
     $method .= '.override' if $override;
@@ -86,8 +86,11 @@ sub perform_checkin {
     }
 
     if ($circ) {
-        my $card = $session->editor->retrieve_actor_user($circ->usr);
-        $details->{patron_barcode} = $card->barcode if $card;
+        my $usr = $session->editor->retrieve_actor_user([
+            $circ->usr, {flesh => 1, flesh_fields => {au => ['card']}}]);
+
+        $details->{patron_barcode} = 
+            $usr->card->barcode if $usr && $usr->card;
     }
 
     $class->handle_hold($session, $details, $payload, %params);
@@ -136,7 +139,7 @@ sub handle_hold {
 
     } else {
         $pickup_lib_id = $hold->pickup_lib;
-        $pickup_lib_sn = $SC->org_sn_from_id($hold->pickup_lib);
+        $pickup_lib_sn = $SC->org_sn_from_id($session, $pickup_lib_id);
     }
 
     $details->{alert} = 1;