LP#1613374 - Check stored copy status before clobbering it.
authorChris Sharp <csharp@georgialibraries.org>
Wed, 24 Aug 2016 18:23:09 +0000 (14:23 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 24 Aug 2016 22:05:40 +0000 (18:05 -0400)
Some transit.copy_statuses would result in some other behavior
upon checkin, so we check all that would go into 'Reshelving'
status, otherwise, restore the stored status.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm

index 88b706b..fad7923 100644 (file)
@@ -245,8 +245,21 @@ sub __abort_transit {
 
     # Only change the copy status if the copy status is "In Transit."
     if ($copy->status == OILS_COPY_STATUS_IN_TRANSIT) {
-        # recover the copy status
-        $copy->status( OILS_COPY_STATUS_CANCELED_TRANSIT );
+        # if the status would normally result in 'Reshelving' once the item is checked in
+        if ($transit->copy_status == OILS_COPY_STATUS_AVAILABLE   ||
+            $transit->copy_status == OILS_COPY_STATUS_CHECKED_OUT ||
+            $transit->copy_status == OILS_COPY_STATUS_IN_PROCESS  ||
+            $transit->copy_status == OILS_COPY_STATUS_ON_HOLDS_SHELF  ||
+            $transit->copy_status == OILS_COPY_STATUS_IN_TRANSIT  ||
+            $transit->copy_status == OILS_COPY_STATUS_CATALOGING  ||
+            $transit->copy_status == OILS_COPY_STATUS_ON_RESV_SHELF  ||
+            $transit->copy_status == OILS_COPY_STATUS_RESHELVING) {
+            # set copy to Canceled Transit
+            $copy->status( OILS_COPY_STATUS_CANCELED_TRANSIT);
+        } else {
+            # recover the copy status
+            $copy->status($transit->copy_status);
+        }
         $copy->editor( $e->requestor->id );
         $copy->edit_date('now');