Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -21,7 +21,7 @@ class Variable
|
|||||||
|
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
|
||||||
$this->existsName($processUid, $arrayData["VAR_NAME"]);
|
$this->existsName($processUid, $arrayData["VAR_NAME"], "");
|
||||||
|
|
||||||
$this->throwExceptionFieldDefinition($arrayData);
|
$this->throwExceptionFieldDefinition($arrayData);
|
||||||
|
|
||||||
@@ -142,7 +142,8 @@ class Variable
|
|||||||
if ($variable->validate()) {
|
if ($variable->validate()) {
|
||||||
$cnn->begin();
|
$cnn->begin();
|
||||||
if (isset($arrayData["VAR_NAME"])) {
|
if (isset($arrayData["VAR_NAME"])) {
|
||||||
$this->existsName($processUid, $arrayData["VAR_NAME"]);
|
$this->existsName($processUid, $arrayData["VAR_NAME"], $variableUid);
|
||||||
|
|
||||||
$variable->setVarName($arrayData["VAR_NAME"]);
|
$variable->setVarName($arrayData["VAR_NAME"]);
|
||||||
}
|
}
|
||||||
if (isset($arrayData["VAR_FIELD_TYPE"])) {
|
if (isset($arrayData["VAR_FIELD_TYPE"])) {
|
||||||
@@ -428,18 +429,30 @@ class Variable
|
|||||||
* @param string $variableName Name
|
* @param string $variableName Name
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function existsName($processUid, $variableName)
|
public function existsName($processUid, $variableName, $variableUidToExclude = "")
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
|
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
|
||||||
|
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
|
||||||
|
|
||||||
|
if ($variableUidToExclude != "") {
|
||||||
|
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUidToExclude, \Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
|
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
|
||||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
$rsCriteria->next();
|
|
||||||
if ($rsCriteria->getRow()) {
|
while ($rsCriteria->next()) {
|
||||||
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
if ($variableName == $row["VAR_NAME"]) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@@ -517,7 +530,7 @@ class Variable
|
|||||||
$field = $pmDynaform->searchField($arrayVariable["dyn_uid"], $arrayVariable["field_id"]);
|
$field = $pmDynaform->searchField($arrayVariable["dyn_uid"], $arrayVariable["field_id"]);
|
||||||
$variableDbConnectionUid = $field !== null ? $field->dbConnection : "";
|
$variableDbConnectionUid = $field !== null ? $field->dbConnection : "";
|
||||||
$variableSql = $field !== null ? $field->sql : "";
|
$variableSql = $field !== null ? $field->sql : "";
|
||||||
|
|
||||||
//Get data
|
//Get data
|
||||||
$_SESSION["PROCESS"] = $processUid;
|
$_SESSION["PROCESS"] = $processUid;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user