prevent transit abort if transit_copy_status is lost/missing
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Aug 2006 00:04:36 +0000 (00:04 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Aug 2006 00:04:36 +0000 (00:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5798 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Transit.pm

index f937be4..e7b3079 100644 (file)
@@ -11,6 +11,7 @@ use OpenILS::Application::AppUtils;
 use OpenILS::Application::Circ::Holds;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenSRF::AppSession;
+use OpenILS::Const qw/:const/;
 
 my $U                                                  = "OpenILS::Application::AppUtils";
 my $holdcode                           = "OpenILS::Application::Circ::Holds";
@@ -188,7 +189,7 @@ sub abort_transit {
        # ---------------------------------------------------------------------
        # Find the related copy and/or transit based on whatever data we have
        if( $barcode ) {
-               $copy = $e->search_asset_copy({barcode=>$barcode})->[0];
+               $copy = $e->search_asset_copy({barcode=>$barcode, deleted => 'f'})->[0];
                return $e->event unless $copy;
 
        } elsif( $copyid ) {
@@ -212,6 +213,12 @@ sub abort_transit {
        }
        # ---------------------------------------------------------------------
 
+       if( $transit->copy_status == OILS_COPY_STATUS_LOST or
+               $transit->copy_status == OILS_COPY_STATUS_MISSING ) {
+               $e->rollback;
+               return OpenILS::Event->new('TRANSIT_ABORT_NOT_ALLOWED');
+       }
+
 
        if( $transit->dest != $e->requestor->ws_ou 
                and $transit->source != $e->requestor->ws_ou ) {