vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fapee...@apache.org
Subject svn commit: r1488379 - /vcl/trunk/managementnode/lib/VCL/utils.pm
Date Fri, 31 May 2013 20:05:40 GMT
Author: fapeeler
Date: Fri May 31 20:05:40 2013
New Revision: 1488379

URL: http://svn.apache.org/r1488379
Log:
VCL-697

Fix for overwrite state issue.


Modified:
    vcl/trunk/managementnode/lib/VCL/utils.pm

Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1488379&r1=1488378&r2=1488379&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Fri May 31 20:05:40 2013
@@ -1518,7 +1518,8 @@ sub update_request_state {
 		UPDATE
 		request,
 		state state,
-		state laststate
+		state laststate,
+		state cstate
 		SET
 		request.stateid = state.id,
 		request.laststateid = laststate.id
@@ -1527,12 +1528,23 @@ sub update_request_state {
 		AND laststate.name = \'$laststate_name\'
 		AND request.id = $request_id
 		";
+
+      		# If input state_name is not pending. 
+      		# All other state changes must have the current state pending  
+      		if($state_name ne "pending") {
+         	  $update_statement .= "
+         	  AND request.stateid = cstate.id
+         	  AND cstate.name = 'pending'      
+         	  ";
+          	}
+
 	} ## end if (defined $laststate_name && $laststate_name...
 	else {
 		$update_statement = "
 		UPDATE
 		request,
-		state state
+		state state,
+		state cstate
 		SET
 		request.stateid = state.id
 		WHERE
@@ -1540,6 +1552,15 @@ sub update_request_state {
 		AND request.id = $request_id
 		";
 
+      		# If input state_name is not pending. 
+      		# All other state changes must have the current state pending  
+      		if($state_name ne "pending") {
+         	  $update_statement .= "
+         	  AND request.stateid = cstate.id
+         	  AND cstate.name = 'pending'      
+         	  ";
+          	}
+
 		$laststate_name = 'unchanged';
 	} ## end else [ if (defined $laststate_name && $laststate_name...
 



Mime
View raw message