LP1901930 SIP2Mediator checkin support
authorBill Erickson <berickxx@gmail.com>
Fri, 30 Oct 2020 22:15:15 +0000 (18:15 -0400)
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
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Item.pm

index 13ac5a2..8c88e08 100644 (file)
@@ -447,7 +447,7 @@ sub handle_checkout {
             {AA => $patron_barcode},
             {AB => $item_barcode},
             $msg ? {AF => $msg} : (),
-            $circ ? {AH => $circ_details->{due_date}} : ();
+            $circ ? {AH => $circ_details->{due_date}} : (),
             {AJ => $item_details->{title}},
             $circ ? {BK => $circ->id} : (),
             {AO => $config->{institution}},
@@ -476,12 +476,13 @@ sub handle_checkin {
             0,                  # checkin ok
             $SC->sipbool(0),    # resensitize
             $SC->sipbool(0),    # magnetic media
-            'N'                 # alert
+            'N',                # alert
             $SC->sipdate,       # transaction date
         ],
         fields => [
-            {AA => $patron_barcode},
+            {AB => $item_barcode},
             {AO => $config->{institution}},
+            {CV => '00'} # unkown alert type
         ]
     } unless $item_details;
 
@@ -492,24 +493,10 @@ sub handle_checkin {
         item_details => $item_details
     );
 
-    return {
-        code => '10',
-        fixed_fields => [
-            0,                  # checkin ok
-            $SC->sipbool(0),    # resensitize
-            $SC->sipbool(0),    # magnetic media
-            'Y'                 # alert
-            $SC->sipdate,       # transaction date
-        ],
-        fields => [
-            {AA => $patron_barcode},
-            {AO => $config->{institution}},
-            {CV => '00'} # unkown alert type
-        ]
-    }
-
     my $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};
 
     return {
         fixed_fields => [
@@ -520,7 +507,7 @@ sub handle_checkin {
             $SC->sipdate,                               # transaction date
         ],
         fields => [
-            {AA => $patron_barcode},
+            {AA => $checkin_details->{patron_barcode}},
             {AB => $item_barcode},
             $msg ? {AF => $msg} : (),
             {AJ => $item_details->{title}},
@@ -532,7 +519,9 @@ sub handle_checkin {
             {CI => 0}, # security inhibit
             {CK => $item_details->{media_type}},
             {CV => $checkin_details->{alert_type}},
-            {CT => $details->{destination_loc}}
+            {CT => $checkin_details->{destination_loc}},
+            $hold_bc ? {CY => $hold_bc} : (),
+            $hold_name ? {DA => $hold_name} : ()
         ]
     };
 }
index 7c65cf0..e309958 100644 (file)
@@ -85,6 +85,11 @@ sub perform_checkin {
             $SC->org_sn_from_id($session, $copy->circ_lib);
     }
 
+    if ($circ) {
+        my $card = $session->editor->retrieve_actor_user($circ->usr);
+        $details->{patron_barcode} = $card->barcode if $card;
+    }
+
     $class->handle_hold($session, $details, $payload, %params);
 
     if ($textcode eq 'NO_CHANGE' || $textcode eq 'SUCCESS') {
index 00f623a..db07a69 100644 (file)
@@ -38,7 +38,7 @@ sub get_item_details {
 
     my $details = {
         item => $item,
-        security_marker => '02' # matches SIP/Item.pm
+        security_marker => '02', # matches SIP/Item.pm
         owning_loc => $item->call_number->owning_lib->sn,
         current_loc => $item->circ_lib->shortname,
         permanent_loc => $item->circ_lib->shortname,