return $e->die_event unless $e->delete_action_transit_copy($transit);
- # Only change the copy status if the copy status is "In Transit" and the transit is aborted at home.
- if ($copy->status == OILS_COPY_STATUS_IN_TRANSIT && $e->requestor->ws_ou == $copy->circ_lib) {
- # recover the copy status
- $copy->status( $transit->copy_status );
- $copy->editor( $e->requestor->id );
- $copy->edit_date('now');
-
+ # Only change the copy status if the copy status is "In Transit", to avoid clobbering
+ # circulations in the face of bad, legacy data.
+ if ($copy->status == OILS_COPY_STATUS_IN_TRANSIT) {
+
+ # If a hold transit (meaning, it had to be available) we force the status
+ # to reshelving at home and to in-transit when not at home. The latter indicates
+ # that the copy is not at the right location, and should be looked at. Unfortunately
+ # this will defeat op-capture when the copy is later scanned, possibly causing more
+ # work for staff.
if ( $holdtransit ) {
- $logger->info("setting copy to reshelving on hold transit abort");
- $copy->status( OILS_COPY_STATUS_RESHELVING );
+ if ($e->requestor->ws_ou == $copy->circ_lib) {
+ $logger->info("setting copy to reshelving on hold transit abort at home");
+ $copy->status( OILS_COPY_STATUS_RESHELVING );
+ $copy->ischanged(1);
+ } else {
+ if (!$no_reset_hold) {
+ $e->commit unless $no_commit;
+ return 1;
+ }
+ $logger->info("leaving copy untouched on hold transit abort away from home");
+ }
+ } else {
+ $copy->status( $transit->copy_status );
+ $copy->ischanged(1);
+ }
+
+ if ($copy->ischanged) {
+ $copy->editor( $e->requestor->id );
+ $copy->edit_date('now');
+ return $e->die_event unless $e->update_asset_copy($copy);
}
- return $e->die_event unless $e->update_asset_copy($copy);
}