PM-1969-2009

This commit is contained in:
Roly Rudy Gutierrez Pinto
2015-03-31 16:33:28 -04:00
parent ec1a31e6a6
commit f02d684259
2 changed files with 128 additions and 5 deletions

View File

@@ -129,7 +129,13 @@ class Variable
$cnn = \Propel::getConnection("workflow");
try {
$variable = \ProcessVariablesPeer::retrieveByPK($variableUid);
$oldVariable = array(
"VAR_NAME" => $variable->getVarName(),
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
"VAR_SQL" => $variable->getVarSql(),
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
);
if ($variable->validate()) {
$cnn->begin();
if (isset($arrayData["VAR_NAME"])) {
@@ -163,6 +169,17 @@ class Variable
}
$variable->save();
$cnn->commit();
//update dynaforms
$newVariable = array(
"VAR_NAME" => $variable->getVarName(),
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
"VAR_SQL" => $variable->getVarSql(),
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
);
\G::LoadClass('pmDynaform');
$pmDynaform = new \pmDynaform();
$pmDynaform->synchronizeVariable($processUid, $newVariable, $oldVariable);
} else {
$msg = "";
@@ -200,7 +217,13 @@ class Variable
$this->throwExceptionIfNotExistsVariable($variableUid);
$this->verifyUse($processUid, $variableUid);
$variable = $this->getVariable($processUid, $variableUid);
\G::LoadClass('pmDynaform');
$pmDynaform = new \pmDynaform();
$isUsed = $pmDynaform->isUsed($processUid, $variable);
if ($isUsed !== false) {
throw new \Exception(\G::LoadTranslation("ID_VARIABLE_IN_USE", array($variableUid, $isUsed)));
}
//Delete
$criteria = new \Criteria("workflow");