From 9bf3cc39f0564e2c445bb00079d5b92b034eda27 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Wed, 2 Jul 2014 08:59:22 -0400 Subject: [PATCH 1/2] Se modifica validacion en process_variables, var_null --- workflow/engine/src/ProcessMaker/BusinessModel/Variable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index 7a5609a1b..b0401baa4 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -325,7 +325,7 @@ class Variable } if (isset($aData["VAR_NULL"])) { Validator::isInteger($aData['VAR_NULL'], '$var_null'); - if ($aData["VAR_NULL"] != 0 || $aData["VAR_NULL"] !=1 ) { + if ($aData["VAR_NULL"] != 0 && $aData["VAR_NULL"] !=1 ) { throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array('$var_null','0, 1' ))); } } From 0211fece8375b67c2ee2b7ba2012549d9f6a6fbb Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Wed, 2 Jul 2014 09:28:21 -0400 Subject: [PATCH 2/2] Se adiciona la funcion throwExceptionIfNotExistsVariable para verificar la existencia de la variable en process_variables --- .../ProcessMaker/BusinessModel/Variable.php | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index b0401baa4..3799a44b4 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -153,7 +153,6 @@ class Variable Validator::proUid($processUid, '$prj_uid'); $this->throwExceptionIfNotExistsVariable($variableUid); - //Delete $criteria = new \Criteria("workflow"); @@ -480,5 +479,25 @@ class Variable throw $e; } } + + /** + * Verify if does not exist the variable in table PROCESS_VARIABLES + * + * @param string $variableUid Unique id of variable + * + * return void Throw exception if does not exist the variable in table PROCESS_VARIABLES + */ + public function throwExceptionIfNotExistsVariable($variableUid) + { + try { + $obj = \ProcessVariablesPeer::retrieveByPK($variableUid); + + if (is_null($obj)) { + throw new \Exception('var_uid: '.$variableUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST")); + } + } catch (\Exception $e) { + throw $e; + } + } }