Merged colosa/processmaker into master
This commit is contained in:
@@ -968,7 +968,7 @@ class Processes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($oData->taskExtraProperties)) {
|
||||
foreach ($oData->taskExtraProperties as $key => $value) {
|
||||
$record = $value;
|
||||
@@ -3757,7 +3757,7 @@ class Processes
|
||||
|
||||
// for public files
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID'];
|
||||
|
||||
|
||||
//Get WebEntry file names
|
||||
$arrayWebEntryFile = array();
|
||||
|
||||
@@ -4250,7 +4250,7 @@ class Processes
|
||||
if ($fsContent > 0) {
|
||||
$fileContent = fread( $fp, $fsContent ); //reading string $XmlContent
|
||||
$newFileName = $pathPublic . $sFileName;
|
||||
|
||||
|
||||
if (in_array($sFileName, $arrayWebEntryFile)) {
|
||||
continue;
|
||||
}
|
||||
@@ -4280,8 +4280,9 @@ class Processes
|
||||
public function createTaskExtraPropertiesRows ($aTaskExtraProperties)
|
||||
{
|
||||
if (count($aTaskExtraProperties) > 0) {
|
||||
$oConfig = new Configuration();
|
||||
foreach ($aTaskExtraProperties as $key => $row) {
|
||||
$oConfig = new Configuration();
|
||||
|
||||
if ($oConfig->exists( $row['CFG_UID'], $row['OBJ_UID'], $row['PRO_UID'], $row['USR_UID'], $row['APP_UID']) ) {
|
||||
$oConfig->remove( $row['CFG_UID'], $row['OBJ_UID'], $row['PRO_UID'], $row['USR_UID'], $row['APP_UID'] );
|
||||
$oConfig->setDeleted(false);
|
||||
@@ -5167,7 +5168,7 @@ class Processes
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function truncateName($proTitle)
|
||||
{
|
||||
$proTitle = str_replace(".","_",$proTitle);
|
||||
|
||||
@@ -1357,13 +1357,27 @@ class workspaceTools
|
||||
}
|
||||
|
||||
if ( !$flag && !is_null($flagFunction) ) {
|
||||
$command = 'mysql'
|
||||
. ' --host=' . $parameters['dbHost']
|
||||
. ' --user=' . $parameters['dbUser']
|
||||
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
|
||||
. ' --database=' . mysql_real_escape_string($database)
|
||||
. ' --default_character_set utf8'
|
||||
. ' --execute="SOURCE '.$filename.'"';
|
||||
$aHost = explode(':',$parameters['dbHost']);
|
||||
$dbHost = $aHost[0];
|
||||
if(isset($aHost[1])){
|
||||
$dbPort = $aHost[1];
|
||||
$command = 'mysql'
|
||||
. ' --host=' . $dbHost
|
||||
. ' --port=' . $dbPort
|
||||
. ' --user=' . $parameters['dbUser']
|
||||
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
|
||||
. ' --database=' . mysql_real_escape_string($database)
|
||||
. ' --default_character_set utf8'
|
||||
. ' --execute="SOURCE '.$filename.'"';
|
||||
}else{
|
||||
$command = 'mysql'
|
||||
. ' --host=' . $dbHost
|
||||
. ' --user=' . $parameters['dbUser']
|
||||
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
|
||||
. ' --database=' . mysql_real_escape_string($database)
|
||||
. ' --default_character_set utf8'
|
||||
. ' --execute="SOURCE '.$filename.'"';
|
||||
}
|
||||
shell_exec($command);
|
||||
} else {
|
||||
//If the safe mode of the server is actived
|
||||
@@ -1624,7 +1638,7 @@ class workspaceTools
|
||||
}
|
||||
list ($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
if($port != ''){
|
||||
$dbHost = $dbHost.$port;
|
||||
$dbHost = $dbHost.$port; //127.0.0.1:3306
|
||||
}
|
||||
$aParameters = array('dbHost'=>$dbHost,'dbUser'=>$dbUser,'dbPass'=>$dbPass);
|
||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,19 +6,17 @@ class Configuration extends BaseConfiguration
|
||||
$cnn = Propel::getConnection(ConfigurationPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$configuration = new Configuration();
|
||||
$this->setCfgUid($arrayData["CFG_UID"]);
|
||||
$this->setObjUid($arrayData["OBJ_UID"]);
|
||||
$this->setCfgValue((isset($arrayData["CFG_VALUE"]))? $arrayData["CFG_VALUE"] : "");
|
||||
$this->setProUid($arrayData["PRO_UID"]);
|
||||
$this->setUsrUid($arrayData["USR_UID"]);
|
||||
$this->setAppUid($arrayData["APP_UID"]);
|
||||
|
||||
$configuration->setCfgUid($arrayData["CFG_UID"]);
|
||||
$configuration->setObjUid($arrayData["OBJ_UID"]);
|
||||
$configuration->setCfgValue((isset($arrayData["CFG_VALUE"]))? $arrayData["CFG_VALUE"] : "");
|
||||
$configuration->setProUid($arrayData["PRO_UID"]);
|
||||
$configuration->setUsrUid($arrayData["USR_UID"]);
|
||||
$configuration->setAppUid($arrayData["APP_UID"]);
|
||||
|
||||
if ($configuration->validate()) {
|
||||
if ($this->validate()) {
|
||||
$cnn->begin();
|
||||
|
||||
$result = $configuration->save();
|
||||
$result = $this->save();
|
||||
|
||||
$cnn->commit();
|
||||
|
||||
@@ -27,7 +25,7 @@ class Configuration extends BaseConfiguration
|
||||
} else {
|
||||
$msg = "";
|
||||
|
||||
foreach ($configuration->getValidationFailures() as $validationFailure) {
|
||||
foreach ($this->getValidationFailures() as $validationFailure) {
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
|
||||
@@ -999,8 +999,13 @@ class CaseScheduler
|
||||
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
$recalculateDate = false;
|
||||
$recalculateTime = false;
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
$recalculateDate = true;
|
||||
$recalculateTime = true;
|
||||
break;
|
||||
case "UPD":
|
||||
$arrayDataAux = $caseScheduler->load($caseSchedulerUid);
|
||||
@@ -1023,7 +1028,7 @@ class CaseScheduler
|
||||
$dCurrentDay = (int)(date("d"));
|
||||
$dCurrentMonth = (int)(date("m"));
|
||||
|
||||
$aStartDay = explode("|", $arrayCaseSchedulerData["SCH_START_DAY"]);
|
||||
$aStartDay = ($caseSchedulerOption == 3)? explode("|", $arrayCaseSchedulerData["SCH_START_DAY"]) : array();
|
||||
|
||||
if ($caseSchedulerOption == 3 && $aStartDay[0] == "1") {
|
||||
$monthsArray = explode("|", $sMonths);
|
||||
@@ -1119,7 +1124,7 @@ class CaseScheduler
|
||||
}
|
||||
|
||||
$arrayCaseSchedulerData["SCH_REPEAT_EVERY"] = $arrayData["SCH_REPEAT_EVERY"];
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y-m-d H:i", $date + (((int)($arrayData["SCH_REPEAT_EVERY"])) * 60 * 60));
|
||||
$arrayCaseSchedulerData["SCH_TIME_NEXT_RUN"] = date("Y-m-d H:i:s", $date + (((int)($arrayData["SCH_REPEAT_EVERY"])) * 60 * 60));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1142,19 +1147,64 @@ class CaseScheduler
|
||||
}
|
||||
|
||||
//Create/Update
|
||||
$caseSchedulerAux = new \CaseScheduler();
|
||||
|
||||
$caseSchedulerUid = "";
|
||||
$arrayCaseSchedulerDataOld = array();
|
||||
|
||||
switch ($option) {
|
||||
case "INS":
|
||||
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
|
||||
$arrayCaseSchedulerData["CASE_SH_PLUGIN_UID"] = $arrayData["CASE_SH_PLUGIN_UID"];
|
||||
}
|
||||
|
||||
$caseScheduler->create($arrayCaseSchedulerData);
|
||||
$result = $caseScheduler->create($arrayCaseSchedulerData);
|
||||
|
||||
$caseSchedulerUid = $caseScheduler->getSchUid();
|
||||
$arrayCaseSchedulerDataOld = $caseSchedulerAux->load($caseSchedulerUid);
|
||||
break;
|
||||
case "UPD":
|
||||
$caseScheduler->update($arrayCaseSchedulerData);
|
||||
$caseSchedulerUid = $caseScheduler->getSchUid();
|
||||
$arrayCaseSchedulerDataOld = $caseSchedulerAux->load($caseSchedulerUid);
|
||||
|
||||
$result = $caseScheduler->update($arrayCaseSchedulerData);
|
||||
break;
|
||||
}
|
||||
|
||||
//Update the SCH_TIME_NEXT_RUN field
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
$arrayCaseSchedulerData = $caseScheduler->load($caseSchedulerUid);
|
||||
|
||||
$flagUpdateTimeNextRun = false;
|
||||
|
||||
switch ((int)($arrayCaseSchedulerData["SCH_OPTION"])) {
|
||||
case 1:
|
||||
//Daily
|
||||
$flagUpdateTimeNextRun = $recalculateDate || $recalculateTime;
|
||||
break;
|
||||
case 2:
|
||||
//Weekly
|
||||
$flagUpdateTimeNextRun = $recalculateDate || $recalculateTime || $arrayCaseSchedulerData["SCH_WEEK_DAYS"] != $arrayCaseSchedulerDataOld["SCH_WEEK_DAYS"];
|
||||
break;
|
||||
case 3:
|
||||
//Monthly
|
||||
$flagUpdateTimeNextRun = $recalculateDate || $recalculateTime || $arrayCaseSchedulerData["SCH_START_DAY"] != $arrayCaseSchedulerDataOld["SCH_START_DAY"] || $arrayCaseSchedulerData["SCH_MONTHS"] != $arrayCaseSchedulerDataOld["SCH_MONTHS"];
|
||||
break;
|
||||
case 4:
|
||||
//One time only
|
||||
$flagUpdateTimeNextRun = $arrayCaseSchedulerData["SCH_START_TIME"] != $arrayCaseSchedulerDataOld["SCH_START_TIME"];
|
||||
break;
|
||||
case 5:
|
||||
//Every
|
||||
$flagUpdateTimeNextRun = $arrayCaseSchedulerData["SCH_REPEAT_EVERY"] != $arrayCaseSchedulerDataOld["SCH_REPEAT_EVERY"];
|
||||
break;
|
||||
}
|
||||
|
||||
if ($flagUpdateTimeNextRun) {
|
||||
$caseSchedulerTimeNextRunNew = $caseScheduler->getTimeNextRunByDate($arrayCaseSchedulerData, date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
//Plugin
|
||||
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
|
||||
$oPluginRegistry = &\PMPluginRegistry::getSingleton();
|
||||
|
||||
@@ -21,7 +21,7 @@ class Variable
|
||||
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
$this->existsName($processUid, $arrayData["VAR_NAME"]);
|
||||
$this->existsName($processUid, $arrayData["VAR_NAME"], "");
|
||||
|
||||
$this->throwExceptionFieldDefinition($arrayData);
|
||||
|
||||
@@ -142,7 +142,8 @@ class Variable
|
||||
if ($variable->validate()) {
|
||||
$cnn->begin();
|
||||
if (isset($arrayData["VAR_NAME"])) {
|
||||
$this->existsName($processUid, $arrayData["VAR_NAME"]);
|
||||
$this->existsName($processUid, $arrayData["VAR_NAME"], $variableUid);
|
||||
|
||||
$variable->setVarName($arrayData["VAR_NAME"]);
|
||||
}
|
||||
if (isset($arrayData["VAR_FIELD_TYPE"])) {
|
||||
@@ -428,18 +429,30 @@ class Variable
|
||||
* @param string $variableName Name
|
||||
*
|
||||
*/
|
||||
public function existsName($processUid, $variableName)
|
||||
public function existsName($processUid, $variableName, $variableUidToExclude = "")
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$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::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
if ($rsCriteria->getRow()) {
|
||||
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
if ($variableName == $row["VAR_NAME"]) {
|
||||
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
@@ -517,7 +530,7 @@ class Variable
|
||||
$field = $pmDynaform->searchField($arrayVariable["dyn_uid"], $arrayVariable["field_id"]);
|
||||
$variableDbConnectionUid = $field !== null ? $field->dbConnection : "";
|
||||
$variableSql = $field !== null ? $field->sql : "";
|
||||
|
||||
|
||||
//Get data
|
||||
$_SESSION["PROCESS"] = $processUid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user