Merged in release/3.2 (pull request #5427)
Release/3.2 Approved-by: Paula Quispe
This commit is contained in:
@@ -2949,6 +2949,7 @@ class Bootstrap
|
||||
$registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
|
||||
$registerLogger->addLog($level, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default information from the context
|
||||
*
|
||||
@@ -2979,7 +2980,7 @@ class Bootstrap
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the action of executing a php file or attempting to upload a php
|
||||
* Record the action of executing a php file or attempting to upload a php
|
||||
* file in server.
|
||||
* @param type $channel
|
||||
* @param type $level
|
||||
@@ -2999,5 +3000,26 @@ class Bootstrap
|
||||
\Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log');
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the constant to related the Workspaces
|
||||
*
|
||||
* @param string $workspace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setConstantsRelatedWs($wsName = null) {
|
||||
if (!defined('SYS_SYS') && !is_null($wsName)) {
|
||||
//If SYS_SYS exists, is not update with $wsName
|
||||
define('SYS_SYS', $wsName);
|
||||
}
|
||||
if (defined('SYS_SYS') && !defined('PATH_DATA_SITE')) {
|
||||
define('PATH_DATA_SITE', PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP);
|
||||
}
|
||||
if (defined('PATH_DATA_SITE') && !defined('PATH_WORKSPACE')) {
|
||||
define('PATH_WORKSPACE', PATH_DATA_SITE);
|
||||
}
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -860,21 +860,21 @@ function run_check_workspace_disabled_code($args, $opts)
|
||||
}
|
||||
|
||||
function migrate_new_cases_lists($command, $args, $opts) {
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$opts = $filter->xssFilterHard($opts);
|
||||
$args = $filter->xssFilterHard($args);
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||
try {
|
||||
$workspace->migrateList($workspace->name, true, $lang);
|
||||
echo "> List tables are done\n";
|
||||
} catch (Exception $e) {
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$opts = $filter->xssFilterHard($opts);
|
||||
$args = $filter->xssFilterHard($args);
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
foreach ($workspaces as $workspace) {
|
||||
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||
try {
|
||||
$workspace->migrateList($workspace->name, true, $lang);
|
||||
echo "> List tables are done\n";
|
||||
} catch (Exception $e) {
|
||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrate_counters($command, $args) {
|
||||
|
||||
@@ -52,10 +52,8 @@ function __autoload ($sClassName)
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('PATH_WORKSPACE')) {
|
||||
define('PATH_WORKSPACE', PATH_DATA_SITE);
|
||||
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE);
|
||||
if (defined('SYS_SYS') && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPACE'))) {
|
||||
Bootstrap::setConstantsRelatedWs(SYS_SYS);
|
||||
}
|
||||
|
||||
//Start - Custom functions
|
||||
|
||||
@@ -877,7 +877,7 @@ class processMap
|
||||
|
||||
public function getStepTriggersCriteria($sStepUID = '', $sTaskUID = '', $sType = '')
|
||||
{
|
||||
$imgEx = "<div><img src='/images/hasCondition.png' height='16' width='16'></div>";
|
||||
$imgEx = '<div><img src=\\\'/images/hasCondition.png\\\' height=\\\'16\\\' width=\\\'16\\\'></div>';
|
||||
$imgNoEx = '<div></div>';
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addAsColumn('CON_VALUE', TriggersPeer::TRI_TITLE);
|
||||
@@ -886,7 +886,7 @@ class processMap
|
||||
$oCriteria->addAsColumn('TRI_LOCATE_WEBBOT_PARAM', '(SELECT LOCATE(MD5(' . TriggersPeer::TRI_WEBBOT . '),' . TriggersPeer::TRI_PARAM . ') FROM ' . TriggersPeer::TABLE_NAME . ' WHERE ' . TriggersPeer::TRI_UID . '=' . StepTriggerPeer::TRI_UID . ' )');
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::ST_TYPE);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oCriteria->addSelectColumn('IF ('.StepTriggerPeer::ST_CONDITION.' = "", "'.$imgNoEx.'", "'.$imgEx.'") AS CONDITION_SET');
|
||||
$oCriteria->addSelectColumn('IF (' . StepTriggerPeer::ST_CONDITION . ' = \'\', \'' . $imgNoEx . '\', \'' . $imgEx . '\') AS CONDITION_SET');
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oCriteria->addSelectColumn(StepTriggerPeer::ST_POSITION);
|
||||
$oCriteria->addSelectColumn(TriggersPeer::TRI_TITLE);
|
||||
|
||||
@@ -2203,7 +2203,7 @@ class Processes
|
||||
foreach (array("PRO_TRI_DELETED", "PRO_TRI_CANCELED", "PRO_TRI_PAUSED", "PRO_TRI_REASSIGNED") as $value) {
|
||||
$key = $value;
|
||||
|
||||
if (isset($map[$oData->process[$key]])) {
|
||||
if (isset($oData->process[$key]) && isset($map[$oData->process[$key]])) {
|
||||
$oData->process[$key] = $map[$oData->process[$key]];
|
||||
}
|
||||
}
|
||||
@@ -5073,9 +5073,22 @@ class Processes
|
||||
$fileContent = fread($fp, $fsContent); //reading string $XmlContent
|
||||
$newFileName = $pathMailTem . $sFileName;
|
||||
$bytesSaved = @file_put_contents($newFileName, $fileContent);
|
||||
if ($bytesSaved != $fsContent) {
|
||||
if($bytesSaved === false){
|
||||
throw (new Exception('Error writing MailTemplate file in directory : ' . $pathMailTem));
|
||||
}
|
||||
if ($bytesSaved != $fsContent) {
|
||||
$channel = "writingMailTemplate";
|
||||
$context = \Bootstrap::getDefaultContextLog();
|
||||
$context['action'] = $channel;
|
||||
if (defined("SYS_CURRENT_URI") && defined("SYS_CURRENT_PARMS")) {
|
||||
$context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS;
|
||||
}
|
||||
$context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '';
|
||||
$sysSys = defined("SYS_SYS") ? SYS_SYS : "Undefined";
|
||||
$message = 'The imported template has a number of byes different than the original template, please verify if the file \'' . $newFileName . '\' is correct.';
|
||||
$level = 400;
|
||||
Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,6 +277,9 @@ class workspaceTools
|
||||
$this->resetDBDiff['DB_USER'] = $dbName;
|
||||
$value = $dbName;
|
||||
}
|
||||
if (array_search($key, array('DB_PASS', 'DB_RBAC_PASS', 'DB_REPORT_PASS')) !== false && !empty($this->dbGrantUserPassword)) {
|
||||
$value = $this->dbGrantUserPassword;
|
||||
}
|
||||
return $matches[1] . $value . $matches[4];
|
||||
}
|
||||
|
||||
@@ -305,6 +308,7 @@ class workspaceTools
|
||||
$this->unify = $unify;
|
||||
if ($resetDBNames) {
|
||||
$this->dbGrantUser = uniqid('wf_');
|
||||
$this->dbGrantUserPassword = G::generate_password(12, "luns", ".");
|
||||
}
|
||||
|
||||
|
||||
@@ -946,7 +950,7 @@ class workspaceTools
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workspaceSchema = $this->getSchema($rbac);
|
||||
$changes = System::compareSchema($workspaceSchema, $schema);
|
||||
|
||||
$changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0);
|
||||
@@ -1349,16 +1353,12 @@ class workspaceTools
|
||||
throw new Exception("Unable to retrieve users: " . mysql_error());
|
||||
}
|
||||
$users = mysql_num_rows($result);
|
||||
if ($users != 0) {
|
||||
$result = mysql_query("DROP USER '$username'@'$hostname'");
|
||||
if ($result === false) {
|
||||
throw new Exception("Unable to drop user: " . mysql_error());
|
||||
}
|
||||
}
|
||||
if ($users === 0) {
|
||||
CLI::logging("Creating user $username for $hostname\n");
|
||||
$result = mysql_query("CREATE USER '$username'@'$hostname' IDENTIFIED BY '$password'");
|
||||
if ($result === false) {
|
||||
throw new Exception("Unable to create user $username: " . mysql_error());
|
||||
$result = mysql_query("CREATE USER '$username'@'$hostname' IDENTIFIED BY '$password'");
|
||||
if ($result === false) {
|
||||
throw new Exception("Unable to create user $username: " . mysql_error());
|
||||
}
|
||||
}
|
||||
$result = mysql_query("GRANT ALL ON $database.* TO '$username'@'$hostname'");
|
||||
if ($result === false) {
|
||||
@@ -1752,8 +1752,8 @@ class workspaceTools
|
||||
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
||||
$versionBackupEngine = (isset($metadata->backupEngineVersion)) ? $metadata->backupEngineVersion : 1;
|
||||
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters, $versionBackupEngine);
|
||||
$workspace->createDBUser($dbUser, $db->pass, "localhost", $dbName);
|
||||
$workspace->createDBUser($dbUser, $db->pass, "%", $dbName);
|
||||
$workspace->createDBUser($dbUser, ($workspace->dbGrantUserPassword != '' ? $workspace->dbGrantUserPassword : $db->pass), "localhost", $dbName);
|
||||
$workspace->createDBUser($dbUser, ($workspace->dbGrantUserPassword != '' ? $workspace->dbGrantUserPassword : $db->pass), "%", $dbName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2524,6 +2524,7 @@ class workspaceTools
|
||||
$delaycriteria->addSelectColumn(AppDelayPeer::APP_UID);
|
||||
$delaycriteria->addSelectColumn(AppDelayPeer::PRO_UID);
|
||||
$delaycriteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX);
|
||||
$delaycriteria->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE);
|
||||
$delaycriteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER);
|
||||
$delaycriteria->addSelectColumn(AppCacheViewPeer::USR_UID);
|
||||
$delaycriteria->addSelectColumn(AppCacheViewPeer::APP_STATUS);
|
||||
@@ -2539,6 +2540,7 @@ class workspaceTools
|
||||
$row = $rsCriteria->getRow();
|
||||
$data = $row;
|
||||
$data["DEL_INDEX"] = $row["APP_DEL_INDEX"];
|
||||
$data["APP_RESTART_DATE"] = $row["APP_DISABLE_ACTION_DATE"];
|
||||
$listPaused = new ListPaused();
|
||||
$listPaused ->remove($row["APP_UID"],$row["APP_DEL_INDEX"],$data);
|
||||
$listPaused->setDeleted(false);
|
||||
|
||||
@@ -498,7 +498,7 @@ if ($action == "uploadFileNewProcess") {
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result->affectedGroups = $affectedGroups;
|
||||
$result->affectedGroups = empty($affectedGroups) ? "" : $affectedGroups;
|
||||
|
||||
//Add Audit Log
|
||||
$process = new Process();
|
||||
@@ -641,7 +641,7 @@ if ($action == "uploadFileNewProcessExist") {
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result->affectedGroups = $affectedGroups;
|
||||
$result->affectedGroups = empty($affectedGroups) ? "" : $affectedGroups;
|
||||
|
||||
//!data ouput
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -1636,7 +1636,9 @@ importProcessExistGroup = function()
|
||||
} else {
|
||||
Ext.getCmp('objectsToImport').setValue("");
|
||||
Ext.getCmp('importProcessExistGroupWindow').close();
|
||||
Ext.getCmp('importProcessExistProcessWindow').close();
|
||||
if (Ext.getCmp('importProcessExistProcessWindow')) {
|
||||
Ext.getCmp('importProcessExistProcessWindow').close();
|
||||
}
|
||||
Ext.getCmp('importProcessWindow').close();
|
||||
Ext.MessageBox.show({
|
||||
title: _('ID_ERROR'),
|
||||
|
||||
Reference in New Issue
Block a user