From: Jason Stephenson Date: Fri, 18 Mar 2016 20:38:33 +0000 (-0400) Subject: LP 1306666: Abort Transit Only Change Copy Status if In Transit X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cfe51102658515a4f6253f1f205a97e766d169b0;p=evergreen%2Fmasslnc.git LP 1306666: Abort Transit Only Change Copy Status if In Transit When aborting a transit, the copy status is presently changed, either to the status stored in action.transit_copy or to Reshelving if the transit was for a hold. This causes problems with "hanging" transits where something was not handled properly before. We've had cases where a transit sticks around on a copy that is later checked out, and while that copy is checked out, the transit is aborted, thus setting the copy status to Reshelving when it should be Checked Out. The code change in this branch only changes the copy's status if it is In Transit. A copy in any other status has its status left untouched. Signed-off-by: Jason Stephenson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm index 22074384d3..73abe82307 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm @@ -239,20 +239,24 @@ sub __abort_transit { return $e->die_event unless $e->allowed('ABORT_REMOTE_TRANSIT', $e->requestor->ws_ou); } - # recover the copy status - $copy->status( $transit->copy_status ); - $copy->editor( $e->requestor->id ); - $copy->edit_date('now'); - my $holdtransit = $e->retrieve_action_hold_transit_copy($transit->id); - if( $holdtransit ) { - $logger->info("setting copy to reshelving on hold transit abort"); - $copy->status( OILS_COPY_STATUS_RESHELVING ); + return $e->die_event unless $e->delete_action_transit_copy($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( $transit->copy_status ); + $copy->editor( $e->requestor->id ); + $copy->edit_date('now'); + + if ( $holdtransit ) { + $logger->info("setting copy to reshelving on hold transit abort"); + $copy->status( OILS_COPY_STATUS_RESHELVING ); + } + return $e->die_event unless $e->update_asset_copy($copy); } - return $e->die_event unless $e->delete_action_transit_copy($transit); - return $e->die_event unless $e->update_asset_copy($copy); $e->commit unless $no_commit;