prevent suspend in transit initial poking
authorBill Erickson <berick@esilibrary.com>
Wed, 9 Nov 2011 19:08:10 +0000 (14:08 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 9 Nov 2011 19:24:57 +0000 (14:24 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 9ed7f49..27dd1af 100644 (file)
@@ -867,6 +867,7 @@ sub batch_update_hold {
 
 sub update_hold_impl {
     my($self, $e, $hold, $values) = @_;
+    my $hold_status;
 
     unless($hold) {
         $hold = $e->retrieve_action_hold_request($values->{id})
@@ -913,15 +914,28 @@ sub update_hold_impl {
                return $e->die_event unless $e->allowed('UPDATE_HOLD_REQUEST_TIME', $hold->pickup_lib);
        }
 
+
+    # --------------------------------------------------------------
+    # See if the hold is getting frozen while in transit.  If so, 
+    # make sure that's allowed.
+    # --------------------------------------------------------------
+    if ($U->is_true($hold->frozen) and !$U->is_true($orig_hold->frozen)) {
+        $hold_status = _hold_status($e, $hold);
+        if ($hold_status == 3) { # in transit
+        
+       }
+    }
+
+
     # --------------------------------------------------------------
     # if the hold is on the holds shelf or in transit and the pickup 
     # lib changes we need to create a new transit.
     # --------------------------------------------------------------
     if($orig_hold->pickup_lib ne $hold->pickup_lib) {
 
-        my $status = _hold_status($e, $hold);
+        $hold_status = _hold_status($e, $hold) unless $hold_status;
 
-        if($status == 3) { # in transit
+        if($hold_status == 3) { # in transit
 
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_TRANSIT', $orig_hold->pickup_lib);
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_TRANSIT', $hold->pickup_lib);
@@ -937,7 +951,7 @@ sub update_hold_impl {
             $transit->dest($hold->pickup_lib);
             $e->update_action_hold_transit_copy($transit) or return $e->die_event;
 
-        } elsif($status == 4) { # on holds shelf
+        } elsif($hold_status == 4) { # on holds shelf
 
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $orig_hold->pickup_lib);
             return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $hold->pickup_lib);