Merge remote-tracking branch 'origin/develop' into bugfix/HOR-3203

This commit is contained in:
hjonathan
2017-05-19 16:21:37 -04:00
546 changed files with 63670 additions and 17583 deletions

View File

@@ -868,6 +868,7 @@ function executeCaseSelfService()
global $oPMScript;
$oPMScript = new PMScript();
$oPMScript->setDataTrigger($row);
$oPMScript->setFields($appFields["APP_DATA"]);
$oPMScript->setScript($row["TRI_WEBBOT"]);
$oPMScript->execute();

View File

@@ -38,17 +38,64 @@ CLI::taskRun('run_flush_cache');
function run_flush_cache($args, $opts)
{
$rootDir = realpath(__DIR__."/../../../../");
if (count($args) === 1) {
flush_cache($args, $opts);
} else {
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
passthru("./processmaker flush-cache " . $workspace->name);
}
}
}
/**
* Flush the cache files for the specified workspace(s).
* If no workspace is specified, then the cache will be flushed in all available
* workspaces.
*
* @param type $args
* @param type $opts
*/
function flush_cache($args, $opts)
{
$rootDir = realpath(__DIR__ . "/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
if (! defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL);
if (!defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing)." . PHP_EOL);
}
CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... ");
//Update singleton file by workspace
foreach ($workspaces as $workspace) {
eprint("Update singleton in workspace " . $workspace->name . " ... ");
Bootstrap::setConstantsRelatedWs($workspace->name);
$pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
$oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
$items = \PMPlugin::getlist($workspace->name);
foreach ($items as $item) {
if ($item["sStatusFile"] === true) {
$path = PATH_PLUGINS . $item["sFile"];
require_once($path);
$details = $oPluginRegistry->getPluginDetails($item["sFile"]);
//Only if the API directory structure is defined
$pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
if (is_dir($pathApiDirectory)) {
if (class_exists($details->sClassName)) {
$oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
$oPlugin->setup();
file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance());
}
}
}
}
eprintln("DONE");
}
//flush the cache files
CLI::logging("Flush " . pakeColor::colorize("system", "INFO") . " cache ... ");
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
echo "DONE" . PHP_EOL;
@@ -60,8 +107,8 @@ function run_flush_cache($args, $opts)
G::mk_dir($workspace->path . "/cache", 0777);
G::rm_dir($workspace->path . "/cachefiles");
G::mk_dir($workspace->path . "/cachefiles", 0777);
if (file_exists($workspace->path.'/routes.php')) {
unlink($workspace->path.'/routes.php');
if (file_exists($workspace->path . '/routes.php')) {
unlink($workspace->path . '/routes.php');
}
echo "DONE" . PHP_EOL;
}

View File

@@ -426,8 +426,24 @@ function run_database_import($args, $opts) {
throw new Exception("Not implemented");
}
/**
* Check if we need to execute an external program for each workspace
* If we apply the command for all workspaces we will need to execute one by one by redefining the constants
* @param string $args, workspaceName that we need to apply the database-upgrade
* @param string $opts
*
* @return void
*/
function run_database_upgrade($args, $opts) {
database_upgrade("upgrade", $args);
//Check if the command is executed by a specific workspace
if (count($args) === 1) {
database_upgrade('upgrade', $args);
} else {
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
passthru('./processmaker database-upgrade '.$workspace->name);
}
}
}
function run_database_check($args, $opts) {
@@ -446,27 +462,31 @@ function run_migrate_list_unassigned($args, $opts) {
migrate_list_unassigned("migrate", $args, $opts);
}
/**
* This function is executed only by one workspace
* @param string $command, the specific actions must be: upgrade|check
* @param array $args, workspaceName for to apply the database-upgrade
*
* @return void
*/
function database_upgrade($command, $args) {
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$command = $filter->xssFilterHard($command);
$args = $filter->xssFilterHard($args);
//Load the attributes for the workspace
$workspaces = get_workspaces_from_args($args);
$checkOnly = (strcmp($command, "check") == 0);
//Loop, read all the attributes related to the one workspace
$wsName = $workspaces[key($workspaces)]->name;
Bootstrap::setConstantsRelatedWs($wsName);
if ($checkOnly) {
print_r("Checking database in ".pakeColor::colorize($wsName, "INFO")."\n");
} else {
print_r("Upgrading database in ".pakeColor::colorize($wsName, "INFO")."\n");
}
foreach ($workspaces as $workspace) {
if (!defined("SYS_SYS")) {
define("SYS_SYS", $workspace->name);
}
if (!defined("PATH_DATA_SITE")) {
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
}
if ($checkOnly)
print_r("Checking database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
else
print_r("Upgrading database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
try {
$changes = $workspace->upgradeDatabase($checkOnly);
if ($changes != false) {

View File

@@ -70,6 +70,7 @@ class Applications
APP_DELEGATION.DEL_DELAYED,
APP_DELEGATION.DEL_DELAY_DURATION,
TASK.TAS_TITLE AS APP_TAS_TITLE,
TASK.TAS_TYPE AS APP_TAS_TYPE,
USERS.USR_LASTNAME,
USERS.USR_FIRSTNAME,
USERS.USR_USERNAME,
@@ -156,6 +157,9 @@ class Applications
}
//Define the number of records by return
if(empty($limit)) {
$limit = 25;
}
if (!empty($start)) {
$sqlData .= " LIMIT $start, " . $limit;
} else {

View File

@@ -3478,11 +3478,13 @@ class Cases
$bExecute = true;
if ($aTrigger['ST_CONDITION'] !== '') {
$oPMScript->setDataTrigger($aTrigger);
$oPMScript->setScript($aTrigger['ST_CONDITION']);
$bExecute = $oPMScript->evaluate();
}
if ($bExecute) {
$oPMScript->setDataTrigger($aTrigger);
$oPMScript->setScript($aTrigger['TRI_WEBBOT']);
$oPMScript->execute();
@@ -7143,6 +7145,7 @@ class Cases
$aFields['APP_DATA']['APPLICATION'] = $appUid;
$aFields['APP_DATA']['PROCESS'] = $proUid;
$oPMScript = new PMScript();
$oPMScript->setDataTrigger($arrayWebBotTrigger);
$oPMScript->setFields($aFields['APP_DATA']);
$oPMScript->setScript($arrayWebBotTrigger['TRI_WEBBOT']);
$oPMScript->execute();
@@ -7154,9 +7157,6 @@ class Cases
unset($aFields['APP_PIN']);
$this->updateCase($aFields['APP_UID'], $aFields);
//Log
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $aFields['APP_DATA']['PROCESS'], 'tasUid' => $aFields['APP_DATA']['TASK'], 'appUid' => $aFields['APP_DATA']['APPLICATION'], 'action' => $action, 'triggerInfo' => ['triUid' => $arrayWebBotTrigger['TRI_UID'], 'triExecutionTime' => $oPMScript->scriptExecutionTime]], SYS_SYS, 'processmaker.log');
return true;
}
return false;

View File

@@ -1462,7 +1462,7 @@ class Derivation
$appFields['PRO_UID'],
$currentDelegation['APP_UID'],
$nextDel['TAS_UID'],
(isset( $nextDel['USR_UID'] ) ? $nextDel['USR_UID'] : ''),
$this->verifyCurrentUserInTask($nextDel, $aSP),
$currentDelegation['DEL_INDEX'],
$nextDel['DEL_PRIORITY'],
$delType,
@@ -1645,6 +1645,22 @@ class Derivation
return $iNewDelIndex;
}
/**
* This function returns the current user Checking cases where USR_ID exists or checking a subprocess (SYNCHRONOUS)
* @param $nextDel
* @param null $aSP
* @return string
*/
function verifyCurrentUserInTask($nextDel, $aSP = null)
{
if (isset($aSP) && $aSP["SP_SYNCHRONOUS"] == "1") {
$currentUser = "";
} else {
$currentUser = isset($nextDel['USR_UID']) ? $nextDel['USR_UID'] : "";
}
return $currentUser;
}
/**
* This function create, update and closed a new record related to appThread
*

View File

@@ -514,6 +514,68 @@ class PMPlugin
}
}
}
/**
* Gets an array of plugins that are in the processmaker plugin directory.
* @param string $workspace
* @return array
*/
public static function getList($workspace)
{
$items = Array();
$aPluginsPP = array();
if (is_file(PATH_PLUGINS . 'enterprise/data/data')) {
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . 'enterprise/data/data')));
foreach ($aPlugins as $aPlugin) {
$aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php';
}
}
$oPluginRegistry = PMPluginRegistry::getSingleton();
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (in_array($file, $aPluginsPP)) {
continue;
}
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
$pluginDetail = $oPluginRegistry->getPluginDetails($file);
if ($pluginDetail === null) {
continue;
}
$status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
$status = $pluginDetail->enabled ? 1 : 0;
if (isset($pluginDetail->aWorkspaces)) {
if (!is_array($pluginDetail->aWorkspaces)) {
$pluginDetail->aWorkspaces = array();
}
if (!in_array($workspace, $pluginDetail->aWorkspaces)) {
continue;
}
}
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
if (isset($pluginDetail) && !$pluginDetail->bPrivate) {
$items[] = [
'id' => (count($items) + 1),
'namespace' => $pluginDetail->sNamespace,
'title' => $pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)',
'className' => $pluginDetail->sNamespace,
'description' => $pluginDetail->sDescription,
'version' => $pluginDetail->iVersion,
'setupPage' => $pluginDetail->sSetupPage,
'status_label' => $status_label,
'status' => $status,
'setup' => $setup,
'sFile' => $file,
'sStatusFile' => $pluginDetail->enabled
];
}
}
}
closedir($handle);
}
return $items;
}
}

View File

@@ -97,6 +97,10 @@ if (file_exists( $dir )) {
*/
class PMScript
{
/**
* @var array $dataTrigger
*/
public $dataTrigger = array();
/**
* Original fields
@@ -208,15 +212,35 @@ class PMScript
return true;
}
public function executeAndCatchErrors ($sScript, $sCode)
/**
* @param $dataTrigger
*/
public function setDataTrigger($dataTrigger)
{
ob_start( 'handleFatalErrors' );
set_error_handler( 'handleErrors' );
$this->dataTrigger = is_array($dataTrigger) ? $dataTrigger : array();
}
/**
* @param $sScript
* @param $sCode
*/
public function executeAndCatchErrors($sScript, $sCode)
{
ob_start('handleFatalErrors');
set_error_handler('handleErrors');
$_SESSION['_CODE_'] = $sCode;
eval( $sScript );
$_SESSION['_DATA_TRIGGER_'] = $this->dataTrigger;
$_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'] = microtime(true);
eval($sScript);
$this->scriptExecutionTime = round(microtime(true) -
$_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'], 5);
$this->evaluateVariable();
unset( $_SESSION['_CODE_'] );
ob_end_flush();
//log trigger execution in processmaker.log
G::logTriggerExecution($_SESSION, '', '', $this->scriptExecutionTime);
unset($_SESSION['_CODE_']);
unset($_SESSION['_DATA_TRIGGER_']);
}
/**
@@ -363,14 +387,8 @@ class PMScript
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n " . " \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
//echo '<pre>-->'; print_r($this->aFields); echo '<---</pre>';
$timeStart = microtime(true);
$this->executeAndCatchErrors($sScript, $this->sScript);
$timeEnd = microtime(true);
$this->scriptExecutionTime = round($timeEnd - $timeStart, 5);
$this->aFields["__VAR_CHANGED__"] = implode(",", $this->affected_fields);
for ($i = 0; $i < count( $this->affected_fields ); $i ++) {
$_SESSION['TRIGGER_DEBUG']['DATA'][] = Array ('key' => $this->affected_fields[$i],'value' => isset( $this->aFields[$this->affected_fields[$i]] ) ? $this->aFields[$this->affected_fields[$i]] : ''
@@ -692,16 +710,19 @@ function pmSqlEscape ($vValue)
* author: Julio Cesar Laura Avenda<64>o <juliocesar@colosa.com>
* date: 2009-10-01
* ************************************************************************* */
/*
* Convert to data base escaped string
* @param string $errno
* @param string $errstr
* @param string $errfile
* @param string $errline
* @return void
/**
* @param $errno
* @param $errstr
* @param $errfile
* @param $errline
*/
function handleErrors ($errno, $errstr, $errfile, $errline)
function handleErrors($errno, $errstr, $errfile, $errline)
{
if ($errno != 2048 && isset($_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'])) {
G::logTriggerExecution($_SESSION, $errstr, '', round(microtime(true) -
$_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'], 5));
}
if ($errno != '' && ($errno != 8) && ($errno != 2048)) {
if (isset( $_SESSION['_CODE_'] )) {
$sCode = $_SESSION['_CODE_'];
@@ -726,9 +747,13 @@ function handleErrors ($errno, $errstr, $errfile, $errline)
function handleFatalErrors ($buffer)
{
G::LoadClass( 'case' );
$oCase = new Cases();
if (!empty($buffer)) {
G::logTriggerExecution($_SESSION, $buffer, 'FATAL_ERROR');
}
if (preg_match( '/(error<\/b>:)(.+)(<br)/', $buffer, $regs )) {
G::LoadClass( 'case' );
$oCase = new Cases();
$err = preg_replace( '/<.*?>/', '', $regs[2] );
$aAux = explode( ' in ', $err );
$sCode = isset($_SESSION['_CODE_']) ? $_SESSION['_CODE_'] : null;

View File

@@ -2203,6 +2203,7 @@ class wsBase
}
if ($bExecute) {
$oPMScript->setDataTrigger($aTrigger);
$oPMScript->setScript( $aTrigger['TRI_WEBBOT'] );
$oPMScript->execute();
@@ -2610,13 +2611,11 @@ class wsBase
$aTriggers[] = $row;
$oPMScript = new PMScript();
$oPMScript->setDataTrigger($row);
$oPMScript->setFields( $appFields['APP_DATA'] );
$oPMScript->setScript( $row['TRI_WEBBOT'] );
$oPMScript->execute();
//Log
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $appFields['APP_DATA']['PROCESS'], 'tasUid' => $appFields['APP_DATA']['TASK'], 'appUid' => $appFields['APP_DATA']['APPLICATION'], 'triggerInfo' => ['triUid' => $row['TRI_UID'], 'triExecutionTime' => $oPMScript->scriptExecutionTime]], SYS_SYS, 'processmaker.log');
if (isset($oPMScript->aFields["__ERROR__"]) && trim($oPMScript->aFields["__ERROR__"]) != "" && $oPMScript->aFields["__ERROR__"] != "none") {
throw new Exception($oPMScript->aFields["__ERROR__"]);
}

View File

@@ -288,6 +288,7 @@ class AppEvent extends BaseAppEvent
$aFields['APP_DATA']['APP_NUMBER'] = $aFields['APP_NUMBER'];
$aFields['APP_DATA']['TAS_TITLE'] = $taskFields['TAS_TITLE'];
$aFields['APP_DATA']['DEL_TASK_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE'];
$oPMScript->setDataTrigger($oTrigger->toArray(\BasePeer::TYPE_FIELDNAME));
$oPMScript->setFields( $aFields['APP_DATA'] );
$oPMScript->setScript( $oTrigger->getTriWebbot() );

View File

@@ -1027,4 +1027,16 @@ class Process extends BaseProcess
$users->update($newData);
}
}
/**
* Load a process object by PRO_ID
*
* @param type $id
* @return Process
*/
public static function loadById($id) {
$criteria = new Criteria(ProcessPeer::DATABASE_NAME);
$criteria->add(ProcessPeer::PRO_ID, $id);
return ProcessPeer::doSelect($criteria)[0];
}
}

View File

@@ -90,5 +90,26 @@ class SubApplication extends BaseSubApplication
throw($oError);
}
}
/**
* This function is relate to subprocess, verify is parent case had create a case
* This is relevant for SYNCHRONOUS subprocess
* @param string $appUid
* @param integer $delIndex
* @return boolean
*/
public function isSubProcessWithCasePending($appUid, $delIndex){
$oCriteria = new Criteria('workflow');
$oCriteria->add(SubApplicationPeer::APP_PARENT, $appUid);
$oCriteria->add(SubApplicationPeer::DEL_INDEX_PARENT, $delIndex);
$oCriteria->add(SubApplicationPeer::SA_STATUS, 'ACTIVE');
$oDataset = SubApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
return true;
}
return false;
}
}

View File

@@ -484,5 +484,16 @@ class Users extends BaseUsers
throw ($oError);
}
}
}
/**
* Load a process object by USR_ID
*
* @param type $id
* @return Users
*/
public static function loadById($id) {
$criteria = new Criteria(UsersPeer::DATABASE_NAME);
$criteria->add(UsersPeer::USR_ID, $id);
return UsersPeer::doSelect($criteria)[0];
}
}

View File

@@ -73,6 +73,8 @@ class UsersPropertiesMapBuilder
$tMap->addColumn('USR_PASSWORD_HISTORY', 'UsrPasswordHistory', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('USR_SETTING_DESIGNER', 'UsrSettingDesigner', 'string', CreoleTypes::LONGVARCHAR, false, null);
} // doBuild()
} // UsersPropertiesMapBuilder

View File

@@ -51,6 +51,12 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
*/
protected $usr_password_history;
/**
* The value for the usr_setting_designer field.
* @var string
*/
protected $usr_setting_designer;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -130,6 +136,17 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
return $this->usr_password_history;
}
/**
* Get the [usr_setting_designer] column value.
*
* @return string
*/
public function getUsrSettingDesigner()
{
return $this->usr_setting_designer;
}
/**
* Set the value of [usr_uid] column.
*
@@ -225,6 +242,28 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
} // setUsrPasswordHistory()
/**
* Set the value of [usr_setting_designer] column.
*
* @param string $v new value
* @return void
*/
public function setUsrSettingDesigner($v)
{
// Since the native PHP type for this column is string,
// we will cast the input to a string (if it is not).
if ($v !== null && !is_string($v)) {
$v = (string) $v;
}
if ($this->usr_setting_designer !== $v) {
$this->usr_setting_designer = $v;
$this->modifiedColumns[] = UsersPropertiesPeer::USR_SETTING_DESIGNER;
}
} // setUsrSettingDesigner()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -250,12 +289,14 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$this->usr_password_history = $rs->getString($startcol + 3);
$this->usr_setting_designer = $rs->getString($startcol + 4);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = UsersPropertiesPeer::NUM_COLUMNS - UsersPropertiesPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 5; // 5 = UsersPropertiesPeer::NUM_COLUMNS - UsersPropertiesPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating UsersProperties object", $e);
@@ -471,6 +512,9 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
case 3:
return $this->getUsrPasswordHistory();
break;
case 4:
return $this->getUsrSettingDesigner();
break;
default:
return null;
break;
@@ -495,6 +539,7 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$keys[1] => $this->getUsrLastUpdateDate(),
$keys[2] => $this->getUsrLoggedNextTime(),
$keys[3] => $this->getUsrPasswordHistory(),
$keys[4] => $this->getUsrSettingDesigner(),
);
return $result;
}
@@ -538,6 +583,9 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
case 3:
$this->setUsrPasswordHistory($value);
break;
case 4:
$this->setUsrSettingDesigner($value);
break;
} // switch()
}
@@ -577,6 +625,10 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$this->setUsrPasswordHistory($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setUsrSettingDesigner($arr[$keys[4]]);
}
}
/**
@@ -604,6 +656,10 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$criteria->add(UsersPropertiesPeer::USR_PASSWORD_HISTORY, $this->usr_password_history);
}
if ($this->isColumnModified(UsersPropertiesPeer::USR_SETTING_DESIGNER)) {
$criteria->add(UsersPropertiesPeer::USR_SETTING_DESIGNER, $this->usr_setting_designer);
}
return $criteria;
}
@@ -664,6 +720,8 @@ abstract class BaseUsersProperties extends BaseObject implements Persistent
$copyObj->setUsrPasswordHistory($this->usr_password_history);
$copyObj->setUsrSettingDesigner($this->usr_setting_designer);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseUsersPropertiesPeer
const CLASS_DEFAULT = 'classes.model.UsersProperties';
/** The total number of columns. */
const NUM_COLUMNS = 4;
const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -43,6 +43,9 @@ abstract class BaseUsersPropertiesPeer
/** the column name for the USR_PASSWORD_HISTORY field */
const USR_PASSWORD_HISTORY = 'USERS_PROPERTIES.USR_PASSWORD_HISTORY';
/** the column name for the USR_SETTING_DESIGNER field */
const USR_SETTING_DESIGNER = 'USERS_PROPERTIES.USR_SETTING_DESIGNER';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -54,10 +57,10 @@ abstract class BaseUsersPropertiesPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrLastUpdateDate', 'UsrLoggedNextTime', 'UsrPasswordHistory', ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID, UsersPropertiesPeer::USR_LAST_UPDATE_DATE, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME, UsersPropertiesPeer::USR_PASSWORD_HISTORY, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_LAST_UPDATE_DATE', 'USR_LOGGED_NEXT_TIME', 'USR_PASSWORD_HISTORY', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('UsrUid', 'UsrLastUpdateDate', 'UsrLoggedNextTime', 'UsrPasswordHistory', 'UsrSettingDesigner', ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID, UsersPropertiesPeer::USR_LAST_UPDATE_DATE, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME, UsersPropertiesPeer::USR_PASSWORD_HISTORY, UsersPropertiesPeer::USR_SETTING_DESIGNER, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID', 'USR_LAST_UPDATE_DATE', 'USR_LOGGED_NEXT_TIME', 'USR_PASSWORD_HISTORY', 'USR_SETTING_DESIGNER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -67,10 +70,10 @@ abstract class BaseUsersPropertiesPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrLastUpdateDate' => 1, 'UsrLoggedNextTime' => 2, 'UsrPasswordHistory' => 3, ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID => 0, UsersPropertiesPeer::USR_LAST_UPDATE_DATE => 1, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME => 2, UsersPropertiesPeer::USR_PASSWORD_HISTORY => 3, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_LAST_UPDATE_DATE' => 1, 'USR_LOGGED_NEXT_TIME' => 2, 'USR_PASSWORD_HISTORY' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
BasePeer::TYPE_PHPNAME => array ('UsrUid' => 0, 'UsrLastUpdateDate' => 1, 'UsrLoggedNextTime' => 2, 'UsrPasswordHistory' => 3, 'UsrSettingDesigner' => 4, ),
BasePeer::TYPE_COLNAME => array (UsersPropertiesPeer::USR_UID => 0, UsersPropertiesPeer::USR_LAST_UPDATE_DATE => 1, UsersPropertiesPeer::USR_LOGGED_NEXT_TIME => 2, UsersPropertiesPeer::USR_PASSWORD_HISTORY => 3, UsersPropertiesPeer::USR_SETTING_DESIGNER => 4, ),
BasePeer::TYPE_FIELDNAME => array ('USR_UID' => 0, 'USR_LAST_UPDATE_DATE' => 1, 'USR_LOGGED_NEXT_TIME' => 2, 'USR_PASSWORD_HISTORY' => 3, 'USR_SETTING_DESIGNER' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
);
/**
@@ -179,6 +182,8 @@ abstract class BaseUsersPropertiesPeer
$criteria->addSelectColumn(UsersPropertiesPeer::USR_PASSWORD_HISTORY);
$criteria->addSelectColumn(UsersPropertiesPeer::USR_SETTING_DESIGNER);
}
const COUNT = 'COUNT(USERS_PROPERTIES.USR_UID)';

View File

@@ -2305,6 +2305,7 @@
<column name="USR_LAST_UPDATE_DATE" type="TIMESTAMP"/>
<column name="USR_LOGGED_NEXT_TIME" type="INTEGER" default="0"/>
<column name="USR_PASSWORD_HISTORY" type="LONGVARCHAR" required="false"/>
<column name="USR_SETTING_DESIGNER" type="LONGVARCHAR"/>
</table>
<table name="ADDITIONAL_TABLES">
<vendor type="mysql">

View File

@@ -286,6 +286,17 @@ class Home extends Controller
$user = (isset($httpData->user)) ? $httpData->user : null;
$dateFrom = (isset($httpData->dateFrom)) ? $httpData->dateFrom : null;
$dateTo = (isset($httpData->dateTo)) ? $httpData->dateTo : null;
if (!empty($process)) {
$processTitle = Process::loadById($process)->getProTitle();
} else {
$processTitle = '';
}
if (!empty($user)) {
$userObject = Users::loadById($user);
$userName = $userObject->getUsrLastname()." ".$userObject->getUsrFirstname();
} else {
$userName = '';
}
$cases = $this->getAppsData( $httpData->t, null, null, $user, null, $search, $process, $status, $dateFrom, $dateTo, null, null, 'APP_CACHE_VIEW.APP_NUMBER', $category);
$arraySearch = array($process, $status, $search, $category, $user, $dateFrom, $dateTo );
@@ -294,9 +305,7 @@ class Home extends Controller
$processes = array();
$processes = $this->getProcessArray($httpData->t, $this->userID );
$this->setVar( 'statusValues', $this->getStatusArray( $httpData->t, $this->userID ) );
$this->setVar( 'processValues', $processes );
$this->setVar( 'categoryValues', $this->getCategoryArray() );
$this->setVar( 'userValues', $this->getUserArray( $httpData->t, $this->userID ) );
$this->setVar( 'allUsersValues', $this->getAllUsersArray( 'search' ) );
$this->setVar( 'categoryTitle', G::LoadTranslation("ID_CATEGORY") );
$this->setVar( 'processTitle', G::LoadTranslation("ID_PROCESS") );
@@ -316,6 +325,11 @@ class Home extends Controller
$this->setVar( 'appListLimit', 10 );
$this->setVar( 'listType', $httpData->t );
$this->setVar( 'processCurrentTitle', $processTitle );
$this->setVar( 'userCurrentName', $userName );
$this->setVar( 'currentUserLabel', G::LoadTranslation( "ID_ALL_USERS" ) );
$this->setVar( 'allProcessLabel', G::LoadTranslation("ID_ALL_PROCESS") );
$this->render();
}
@@ -545,7 +559,7 @@ class Home extends Controller
$this->render();
}
function getUserArray ($action, $userUid)
function getUserArray ($action, $userUid, $search = null)
{
global $oAppCache;
$status = array ();
@@ -561,6 +575,10 @@ class Home extends Controller
$cUsers->addSelectColumn( UsersPeer::USR_UID );
$cUsers->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$cUsers->addSelectColumn( UsersPeer::USR_LASTNAME );
if (!empty($search)) {
$cUsers->addOr(UsersPeer::USR_FIRSTNAME, "%$search%", Criteria::LIKE);
$cUsers->addOr(UsersPeer::USR_LASTNAME, "%$search%", Criteria::LIKE);
}
$oDataset = UsersPeer::doSelectRS( $cUsers );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
@@ -693,60 +711,75 @@ class Home extends Controller
}
return $status;
}
function getProcessArray($action, $userUid)
/**
* Get the list of active processes
*
* @global type $oAppCache
* @param type $action
* @param type $userUid
* @return array
*/
private function getProcessArray($action, $userUid, $search=null)
{
global $oAppCache;
$processes = array();
$processes[] = array("", G::LoadTranslation("ID_ALL_PROCESS"));
switch ($action) {
case "simple_search":
case "search":
//In search action, the query to obtain all process is too slow, so we need to query directly to
//process and content tables, and for that reason we need the current language in AppCacheView.
G::loadClass("configuration");
$oConf = new Configurations;
$oConf->loadConfig($x, "APP_CACHE_VIEW_ENGINE", "", "", "", "");
$appCacheViewEngine = $oConf->aConfig;
$lang = isset($appCacheViewEngine["LANG"])? $appCacheViewEngine["LANG"] : "en";
$cProcess = new Criteria("workflow");
$cProcess->clearSelectColumns();
$cProcess->addSelectColumn(ProcessPeer::PRO_UID);
$cProcess->addSelectColumn(ProcessPeer::PRO_TITLE);
$cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE");
$oDataset = ProcessPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$processes[] = array($aRow["PRO_UID"], $aRow["PRO_TITLE"]);
$oDataset->next();
}
return ($processes);
break;
case "consolidated":
default:
$cProcess = $oAppCache->getToDoListCriteria($userUid); //fast enough
break;
}
$cProcess = new Criteria("workflow");
$cProcess->clearSelectColumns();
$cProcess->setDistinct();
$cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
$cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
$oDataset = AppCacheViewPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$processes[] = array($aRow["PRO_UID"], $aRow["APP_PRO_TITLE"]);
$oDataset->next();
$cProcess->addSelectColumn(ProcessPeer::PRO_ID);
$cProcess->addSelectColumn(ProcessPeer::PRO_TITLE);
$cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE");
if (!empty($search)) {
$cProcess->add(ProcessPeer::PRO_TITLE, "%$search%", Criteria::LIKE);
}
$oDataset = ProcessPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$processes[] = array($aRow["PRO_ID"], $aRow["PRO_TITLE"]);
$oDataset->next();
}
return ($processes);
}
/**
* Get the list of processes
* @param type $httpData
*/
public function getProcesses($httpData)
{
$processes = [];
foreach ($this->getProcessArray($httpData->t, null, $httpData->term) as $row) {
$processes[] = [
'id' => $row[0],
'label' => $row[1],
'value' => $row[1],
];
}
print G::json_encode($processes);
}
/**
* Get the list of users
* @param type $httpData
*/
public function getUsers($httpData)
{
$users = [];
foreach ($this->getUserArray($httpData->t, null, $httpData->term) as $row) {
$users[] = [
'id' => $row[0],
'label' => $row[1],
'value' => $row[1],
];
}
print G::json_encode($users);
}
}

View File

@@ -1084,6 +1084,7 @@ CREATE TABLE `USERS_PROPERTIES`
`USR_LAST_UPDATE_DATE` DATETIME,
`USR_LOGGED_NEXT_TIME` INTEGER default 0,
`USR_PASSWORD_HISTORY` MEDIUMTEXT,
`USR_SETTING_DESIGNER` MEDIUMTEXT,
PRIMARY KEY (`USR_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------

View File

@@ -103,14 +103,6 @@ try {
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE');
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers;
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime;
$arrayInfoTriggerExecutionTime = [];
foreach ($_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_EXECUTION_TIME'] as $key => $value) {
$arrayInfoTriggerExecutionTime[] = ['triUid' => $key, 'triExecutionTime' => $value];
}
//Log
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $appFields['APP_DATA']['PROCESS'], 'tasUid' => $appFields['APP_DATA']['TASK'], 'appUid' => $appFields['APP_DATA']['APPLICATION'], 'before' => 'ASSIGN_TASK', 'triggerInfo' => $arrayInfoTriggerExecutionTime], SYS_SYS, 'processmaker.log');
}
unset($appFields['APP_STATUS']);
@@ -174,14 +166,6 @@ try {
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE');
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers;
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime;
$arrayInfoTriggerExecutionTimeAux = [];
foreach ($_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_EXECUTION_TIME'] as $key => $value) {
$arrayInfoTriggerExecutionTimeAux[] = ['triUid' => $key, 'triExecutionTime' => $value];
}
//Log
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $appFields['APP_DATA']['PROCESS'], 'tasUid' => $appFields['APP_DATA']['TASK'], 'appUid' => $appFields['APP_DATA']['APPLICATION'], 'after' => 'ASSIGN_TASK', 'triggerInfo' => $arrayInfoTriggerExecutionTimeAux], SYS_SYS, 'processmaker.log');
}
unset($appFields['APP_STATUS']);
unset($appFields['APP_PROC_STATUS']);

View File

@@ -90,7 +90,13 @@ try {
case 'DRAFT':
case 'TO_DO':
//Check if the case is in pause, check a valid record in table APP_DELAY
if (AppDelay::isPaused( $sAppUid, $iDelIndex )) {
$isPaused = AppDelay::isPaused($sAppUid, $iDelIndex);
//Check if the case is a waiting for a SYNCHRONOUS subprocess
$subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($sAppUid, $iDelIndex);
if ($isPaused || $caseSubprocessPending) {
//the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex;
@@ -109,19 +115,11 @@ try {
if ($_action == 'search') {
//verify if the case is with the current user
$c = new Criteria( 'workflow' );
$c->add( AppDelegationPeer::APP_UID, $sAppUid );
$c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
$c->add( AppDelegationPeer::DEL_INDEX, $iDelIndex );
$oDataset = AppDelegationPeer::doSelectRs( $c );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aData = $oDataset->getRow();
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && $aData['USR_UID'] !== '') {
$aData = AppDelegation::getCurrentUsers($sAppUid, $iDelIndex);
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($aData['USR_UID'])) {
//distinct "" for selfservice
//so we show just the resume
$_SESSION['alreadyDerivated'] = true;
//the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID'];

View File

@@ -183,14 +183,6 @@ try {
//Execute after triggers - End
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime;
$arrayInfoTriggerExecutionTime = [];
foreach ($_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] as $key => $value) {
$arrayInfoTriggerExecutionTime[] = ['triUid' => $key, 'triExecutionTime' => $value];
}
//Log
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $_SESSION['PROCESS'], 'tasUid' => $_SESSION['TASK'], 'appUid' => $_SESSION['APPLICATION'], 'after' => 'DYNAFORM', 'triggerInfo' => $arrayInfoTriggerExecutionTime], SYS_SYS, 'processmaker.log');
}
//save data in PM Tables if necessary

View File

@@ -219,16 +219,7 @@ if ($flagExecuteBeforeTriggers) {
//Execute before triggers - End
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime;
$arrayInfoTriggerExecutionTime = [];
foreach ($_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] as $key => $value) {
$arrayInfoTriggerExecutionTime[] = ['triUid' => $key, 'triExecutionTime' => $value];
}
//Log
if(sizeof($arrayInfoTriggerExecutionTime)>0){
Bootstrap::registerMonolog('triggerExecutionTime', 200, 'Trigger execution time', ['proUid' => $Fields['APP_DATA']['PROCESS'], 'tasUid' => $Fields['APP_DATA']['TASK'], 'appUid' => $Fields['APP_DATA']['APPLICATION'], 'before' => $_GET['TYPE'], 'triggerInfo' => $arrayInfoTriggerExecutionTime], SYS_SYS, 'processmaker.log');
}
} else {
unset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] );
}

View File

@@ -1,98 +1,118 @@
<?php
$request = isset( $_POST['request'] ) ? $_POST['request'] : '';
$request = isset($_POST['request']) ? $_POST['request'] : '';
switch ($request) {
case 'getRows':
$fieldname = $_POST['fieldname'];
G::LoadClass( 'case' );
G::LoadClass('case');
$oApp = new Cases();
$aFields = $oApp->loadCase( $_SESSION['APPLICATION'] );
$aVars = Array ();
for ($i = 0; $i < count( $_SESSION['TRIGGER_DEBUG']['DATA'] ); $i ++) {
$aFields = $oApp->loadCase($_SESSION['APPLICATION']);
$aVars = Array();
$count = count($_SESSION['TRIGGER_DEBUG']['DATA']);
for ($i = 0; $i < $count; $i++) {
$aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value'];
}
$aVars = array_merge( $aFields['APP_DATA'], $aVars );
$aVars = array_merge($aFields['APP_DATA'], $aVars);
$field = $aVars[$fieldname];
$response = new StdClass();
$response->headers = Array ();
$response->columns = Array ();
$response->rows = Array ();
$response->headers = Array();
$response->columns = Array();
$response->rows = Array();
$sw = true;
$j = 0;
if (is_array( $field )) {
if (is_array($field)) {
foreach ($field as $row) {
if ($sw) {
foreach ($row as $key => $value) {
$response->headers[] = Array ('name' => $key);
$response->columns[] = Array ('header' => $key,'width' => 100,'dataIndex' => $key);
$response->headers[] = Array('name' => $key);
$response->columns[] = Array('header' => $key, 'width' => 100, 'dataIndex' => $key);
}
$sw = false;
}
$tmp = Array ();
$tmp = Array();
foreach ($row as $key => $value) {
$tmp[] = $value;
}
$response->rows[$j ++] = $tmp;
$response->rows[$j++] = $tmp;
}
} else {
if (is_object( $field )) {
$response->headers = Array (Array ('name' => 'name'
),Array ('name' => 'value'
)
if (is_object($field)) {
$response->headers = Array(
Array('name' => 'name'),
Array('name' => 'value')
);
$response->columns = Array (Array ('header' => 'Property','width' => 100,'dataIndex' => 'name'
),Array ('header' => 'Value','width' => 100,'dataIndex' => 'value'
)
$response->columns = Array(
Array(
'header' => 'Property',
'width' => 100,
'dataIndex' => 'name'
),
Array(
'header' => 'Value',
'width' => 100,
'dataIndex' => 'value'
)
);
foreach ($field as $key => $value) {
$response->rows[] = Array ($key,$value);
$response->rows[] = Array($key, $value);
}
}
}
echo G::json_encode( $response );
echo G::json_encode($response);
break;
default:
G::LoadClass( 'case' );
G::LoadClass('case');
$oApp = new Cases();
$aFields = $oApp->loadCase( $_SESSION['APPLICATION'] );
$aFields = $oApp->loadCase($_SESSION['APPLICATION']);
$aVars = Array ();
for ($i = 0; $i < count( $_SESSION['TRIGGER_DEBUG']['DATA'] ); $i ++) {
$aVars = Array();
$count = count($_SESSION['TRIGGER_DEBUG']['DATA']);
for ($i = 0; $i < $count; $i++) {
$aVars[$_SESSION['TRIGGER_DEBUG']['DATA'][$i]['key']] = $_SESSION['TRIGGER_DEBUG']['DATA'][$i]['value'];
}
$aVars = array_merge( $aFields['APP_DATA'], $aVars );
$aVars = array_merge($aFields['APP_DATA'], $aVars);
if (isset( $_POST['filter'] ) && $_POST['filter'] == 'dyn') {
$sysVars = array_keys( G::getSystemConstants() );
$varNames = array_keys( $aVars );
$systemConstants = G::getSystemConstants();
//Add missing items
$systemConstants['PIN'] = $aVars['PIN'];
$systemConstants['APP_NUMBER'] = $aVars['APP_NUMBER'];
//when a case with dynaform is started there are no changed variables, this event is validated
if (isset($aVars['__VAR_CHANGED__'])) {
$systemConstants['__VAR_CHANGED__'] = $aVars['__VAR_CHANGED__'];
}
if (isset($_POST['filter']) && $_POST['filter'] == 'dyn') {
$sysVars = array_keys($systemConstants);
$varNames = array_keys($aVars);
foreach ($varNames as $var) {
if (in_array( $var, $sysVars )) {
unset( $aVars[$var] );
if (in_array($var, $sysVars)) {
unset($aVars[$var]);
}
}
}
if (isset( $_POST['filter'] ) && $_POST['filter'] == 'sys') {
$aVars = G::getSystemConstants();
if (isset($_POST['filter']) && $_POST['filter'] == 'sys') {
$aVars = $systemConstants;
}
ksort( $aVars );
ksort($aVars);
$return_object = new StdClass();
$return_object->totalCount = 1;
foreach ($aVars as $i => $var) {
if (is_array( $var ) || is_object( $var )) {
$aVars[$i] = print_r( $var, true );
if (is_array($var) || is_object($var)) {
$aVars[$i] = print_r($var, true);
}
}
$return_object->data[0] = $aVars;
echo G::json_encode( $return_object );
echo G::json_encode($return_object);
break;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* pluginsList.php
*
@@ -21,97 +22,8 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
// lets display the items
//$items = array ( 'id' => 'char', 'title' => 'char', 'type' => 'char', 'creator' => 'char' , 'modifiedBy' => 'char', 'filename' => 'char', 'size' => 'char', 'mime' => 'char');
$items = Array ();
//***************** Plugins **************************
G::LoadClass( 'plugin' );
//here we are loading all plugins registered
//krumo ($items); die;
$aPluginsPP = array ();
if (is_file( PATH_PLUGINS . 'enterprise/data/data' )) {
$aPlugins = unserialize( trim( file_get_contents( PATH_PLUGINS . 'enterprise/data/data' ) ) );
foreach ($aPlugins as $aPlugin) {
$aPluginsPP[] = substr( $aPlugin['sFilename'], 0, strpos( $aPlugin['sFilename'], '-' ) ) . '.php';
}
}
$oPluginRegistry = & PMPluginRegistry::getSingleton();
if ($handle = opendir( PATH_PLUGINS )) {
while (false !== ($file = readdir( $handle ))) {
if (in_array( $file, $aPluginsPP )) {
continue;
}
if (strpos( $file, '.php', 1 ) && is_file( PATH_PLUGINS . $file )) {
include_once (PATH_PLUGINS . $file);
$pluginDetail = $oPluginRegistry->getPluginDetails( $file );
//print_R ($pluginDetail );
//die;
//$status = $pluginDetail->enabled ? 'Enabled' : 'Disabled';
if ($pluginDetail == null)
continue; //When for some reason we gen NULL plugin
$status_label = $pluginDetail->enabled ? G::LoadTranslation( 'ID_ENABLED' ) : G::LoadTranslation( 'ID_DISABLED' );
$status = $pluginDetail->enabled ? 1 : 0;
if (isset( $pluginDetail->aWorkspaces )) {
if (!is_array($pluginDetail->aWorkspaces)) {
$pluginDetail->aWorkspaces = array();
}
if (! in_array( SYS_SYS, $pluginDetail->aWorkspaces ))
continue;
}
$linkEditValue = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? G::LoadTranslation( 'ID_SETUP' ) : ' ';
//g::pr($pluginDetail->sSetupPage);
$setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
$link = 'pluginsChange?id=' . $file . '&status=' . $pluginDetail->enabled;
$linkEdit = 'pluginsSetup?id=' . $file;
$pluginName = $pluginDetail->sFriendlyName;
$pluginId = $pluginDetail->sNamespace;
$removePluginMsg = str_replace( "\r\n", "<br>", G::LoadTranslation( 'ID_MSG_REMOVE_PLUGIN' ) );
$linkRemove = 'javascript:showMessage(\'' . $removePluginMsg . '<br>' . $pluginName . ' \',\'' . $pluginId . '\')';
// $linkRemove = 'pluginsRemove?id='.$pluginId.'.php&status=1';
if (isset( $pluginDetail )) {
if (! $pluginDetail->bPrivate) {
$items[] = array ('id' => (count( $items ) + 1),'namespace' => $pluginDetail->sNamespace,'title' => $pluginDetail->sFriendlyName . "\n(" . $pluginDetail->sNamespace . '.php)','className' => $pluginDetail->sNamespace,'description' => $pluginDetail->sDescription,'version' => $pluginDetail->iVersion,'setupPage' => $pluginDetail->sSetupPage,'status_label' => $status_label,'status' => $status,'setup' => $setup,
'sFile' => $file,'sStatusFile' => $pluginDetail->enabled
);
}
}
}
}
closedir( $handle );
}
$folders['items'] = $items;
//g::pr($items);
echo G::json_encode( $items );
die();
$_DBArray['plugins'] = $items;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass( 'ArrayPeer' );
$c = new Criteria( 'dbarray' );
$c->setDBArrayTable( 'plugins' );
//$c->addAscendingOrderByColumn ('id');
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
$G_ID_SUB_MENU_SELECTED = 'PLUGINS';
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addScriptFile( '/jscore/setup/pluginList.js' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'setup/pluginList', $c );
G::RenderPage( 'publishBlank', 'blank' );
G::LoadClass('plugin');
$items = \PMPlugin::getlist(SYS_SYS);
echo G::json_encode($items);

View File

@@ -232,11 +232,14 @@ class Cases
Validator::usrUid($dataList["userId"], "userId");
}
G::LoadClass("applications");
$solrEnabled = false;
$userUid = $dataList["userId"];
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER";
if ($sort === 'APP_CACHE_VIEW.APP_NUMBER') {
$sort = "APPLICATION.APP_NUMBER";
}
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "";
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
@@ -253,126 +256,36 @@ class Cases
$newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : '';
$oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : '';
$first = isset( $dataList["first"] ) ? true :false;
$filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : "";
$u = new \ProcessMaker\BusinessModel\User();
if ($action == "search" && !$u->checkPermission($dataList["userId"], "PM_ALLCASES")) {
throw new \Exception(\G::LoadTranslation("ID_CASE_USER_NOT_HAVE_PERMISSION", array($dataList["userId"])));
}
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
if (!in_array($action, $valuesCorrect)) {
throw (new \Exception(\G::LoadTranslation("ID_INCORRECT_VALUE_ACTION")));
}
$start = (int)$start;
$start = abs($start);
if ($start != 0) {
$start--;
}
$limit = (int)$limit;
$limit = abs($limit);
if ($limit == 0) {
G::LoadClass("configuration");
$conf = new \Configurations();
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfCasesList['casesListRowNumber'])) {
$limit = (int)$generalConfCasesList['casesListRowNumber'];
} else {
$limit = 25;
}
} else {
$limit = (int)$limit;
}
if ($sort != 'APP_CACHE_VIEW.APP_NUMBER') {
$sort = G::toUpper($sort);
$columnsAppCacheView = \AppCacheViewPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);
if (!(in_array($sort, $columnsAppCacheView))) {
$sort = 'APP_CACHE_VIEW.APP_NUMBER';
}
}
$dir = G::toUpper($dir);
if (!($dir == 'DESC' || $dir == 'ASC')) {
$dir = 'ASC';
}
if ($process != '') {
Validator::proUid($process, '$pro_uid');
}
if ($category != '') {
Validator::catUid($category, '$cat_uid');
}
$status = G::toUpper($status);
$listStatus = array('TO_DO', 'DRAFT', 'COMPLETED', 'CANCELLED', 'OPEN', 'CLOSE');
if (!(in_array($status, $listStatus))) {
$status = '';
}
if ($user != '') {
Validator::usrUid($user, '$usr_uid');
}
if ($dateFrom != '') {
Validator::isDate($dateFrom, 'Y-m-d', '$date_from');
}
if ($dateTo != '') {
Validator::isDate($dateTo, 'Y-m-d', '$date_to');
}
if ($action == 'search' || $action == 'to_reassign') {
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
if ($first) {
$result = array();
$result['totalCount'] = 0;
$result['data'] = array();
return $result;
}
}
G::LoadClass("applications");
$apps = new \Applications();
$result = $apps->getAll(
$response = $apps->searchAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$filterStatus,
$dir,
(strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort,
$sort,
$category,
true,
$paged,
$newerThan,
$oldestThan
$dateFrom,
$dateTo
);
if (!empty($result['data'])) {
foreach ($result['data'] as &$value) {
$value = array_change_key_case($value, CASE_LOWER);
}
}
if ($paged == false) {
$response = $result['data'];
} else {
$response['total'] = $result['totalCount'];
$response['start'] = $start+1;
$response['limit'] = $limit;
$response['sort'] = G::toLower($sort);
$response['dir'] = G::toLower($dir);
$response['cat_uid'] = $category;
$response['pro_uid'] = $process;
$response['search'] = $search;
if ($action == 'search') {
$response['app_status'] = G::toLower($status);
$response['usr_uid'] = $user;
$response['date_from'] = $dateFrom;
$response['date_to'] = $dateTo;
}
$response['data'] = $result['data'];
$response['total'] = 0;
$response['start'] = $start + 1;
$response['limit'] = $limit;
$response['sort'] = G::toLower($sort);
$response['dir'] = G::toLower($dir);
$response['cat_uid'] = $category;
$response['pro_uid'] = $process;
$response['search'] = $search;
if ($action == 'search') {
$response['app_status'] = G::toLower($status);
$response['usr_uid'] = $user;
$response['date_from'] = $dateFrom;
$response['date_to'] = $dateTo;
}
return $response;
}
@@ -1095,6 +1008,12 @@ class Cases
try {
if (!$delIndex) {
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
//Check if the next task is a subprocess SYNCHRONOUS with a thread Open
$subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex);
if ($caseSubprocessPending) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED")));
}
}
\G::LoadClass('wsBase');
$ws = new \wsBase();

View File

@@ -636,6 +636,7 @@ class MessageType
$criteriaMessageTypeVariable = $variable->getMessageTypeVariableCriteria();
$criteriaMessageTypeVariable->add(\MessageTypeVariablePeer::MSGT_UID, $row["MSGT_UID"], \Criteria::EQUAL);
$criteriaMessageTypeVariable->addAscendingOrderByColumn(\MessageTypeVariablePeer::MSGTV_NAME);
$rsCriteriaMessageTypeVariable = \MessageTypeVariablePeer::doSelectRS($criteriaMessageTypeVariable);
$rsCriteriaMessageTypeVariable->setFetchmode(\ResultSet::FETCHMODE_ASSOC);

View File

@@ -622,6 +622,7 @@ class ScriptTask
if (!is_null($trigger)) {
$pmScript = new \PMScript();
$pmScript->setDataTrigger($trigger->toArray(\BasePeer::TYPE_FIELDNAME));
$pmScript->setFields($arrayApplicationData["APP_DATA"]);
$pmScript->setScript($trigger->getTriWebbot());

View File

@@ -270,7 +270,7 @@ class Light extends Api
'PREVIOUS_USR_UID' => 'userId',
'PREVIOUS_USR_FIRSTNAME' => 'firstName',
'PREVIOUS_USR_LASTNAME' => 'lastName',
'PREVIOUS_USR_USERNAME' => 'fullName',
'PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -369,7 +369,7 @@ class Light extends Api
'USR_UID' => 'userId',
'USR_FIRSTNAME' => 'firstName',
'USR_LASTNAME' => 'lastName',
'USR_USERNAME' => 'fullName',
'USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -472,13 +472,13 @@ class Light extends Api
'USR_UID' => 'userId',
'USR_FIRSTNAME' => 'firstName',
'USR_LASTNAME' => 'lastName',
'USR_USERNAME' => 'fullName',
'USR_USERNAME' => 'userName',
),
'prevUser' => array(
'PREVIOUS_USR_UID' => 'userId',
'PREVIOUS_USR_FIRSTNAME' => 'firstName',
'PREVIOUS_USR_LASTNAME' => 'lastName',
'PREVIOUS_USR_USERNAME' => 'fullName',
'PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -572,13 +572,13 @@ class Light extends Api
'USR_UID' => 'userId',
'DEL_CURRENT_USR_FIRSTNAME' => 'firstName',
'DEL_CURRENT_USR_LASTNAME' => 'lastName',
'DEL_CURRENT_USR_USERNAME' => 'fullName',
'DEL_CURRENT_USR_USERNAME' => 'userName',
),
'prevUser' => array(
'DEL_PREVIOUS_USR_UID' => 'userId',
'DEL_PREVIOUS_USR_FIRSTNAME' => 'firstName',
'DEL_PREVIOUS_USR_LASTNAME' => 'lastName',
'DEL_PREVIOUS_USR_USERNAME' => 'fullName',
'DEL_PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -655,13 +655,13 @@ class Light extends Api
'usrcr_usr_uid' => 'userId',
'usrcr_usr_firstname' => 'firstName',
'usrcr_usr_lastname' => 'lastName',
'usrcr_usr_username' => 'fullName',
'usrcr_usr_username' => 'userName',
),
'prevUser' => array(
'previous_usr_uid' => 'userId',
'previous_usr_firstname' => 'firstName',
'previous_usr_lastname' => 'lastName',
'previous_usr_username' => 'fullName',
'previous_usr_username' => 'userName',
),
'process' => array(
'pro_uid' => 'processId',

View File

@@ -57,6 +57,9 @@ class Project extends Api
try {
$project = Adapter\BpmnWorkflow::getStruct($prj_uid);
$userProperty = new \UsersProperties();
$property = $userProperty->loadOrCreateIfNotExists($this->getUserId());
$project['usr_setting_designer'] = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER']) : null;
return DateTime::convertUtcToIso8601($project, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
@@ -96,6 +99,16 @@ class Project extends Api
public function doPutProject($prj_uid, $request_data)
{
try {
if (array_key_exists('usr_setting_designer', $request_data)) {
$oUserProperty = new \UsersProperties();
$property = $oUserProperty->loadOrCreateIfNotExists($this->getUserId());
$propertyArray = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER'], true) : [];
$usrSettingDesigner = array_merge($propertyArray, $request_data['usr_setting_designer']);
$property['USR_SETTING_DESIGNER'] = \G::json_encode($usrSettingDesigner);
$oUserProperty->update($property);
unset($request_data['usr_setting_designer']);
}
Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
return Adapter\BpmnWorkflow::updateFromStruct($prj_uid, DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
} catch (\Exception $e) {

View File

@@ -256,7 +256,6 @@
enableHdMenu: true,
frame:false,
//plugins: expander,
cls : 'grid_with_checkbox',
columnLines: true,
viewConfig: {
forceFit:true

View File

@@ -587,13 +587,16 @@ Ext.onReady ( function() {
}
//Render Full Name
full_name = function(v, x, s) {
full_name = function (v, x, s) {
var resp;
if (s.data.USR_UID && s.data.USR_USERNAME) {
return _FNF(s.data.USR_USERNAME, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME);
}
else {
return '[' + _('ID_UNASSIGNED').toUpperCase() + ']';
resp = _FNF(s.data.USR_USERNAME, s.data.USR_FIRSTNAME, s.data.USR_LASTNAME);
} else if (s && s.json && s.json["APP_TAS_TYPE"] === "SUBPROCESS") {
resp = '';
} else {
resp = '[' + _('ID_UNASSIGNED').toUpperCase() + ']';
}
return resp;
};
previous_full_name = function(v, x, s) {

View File

@@ -101,11 +101,11 @@
src = src.split("?");
var params = '?';
params += 'process='+$("#comboProcess option:selected").val();
params += 'process='+$("#comboProcess").val();
params += '&status='+$("#comboStatus option:selected").val();
params += '&search='+$("#searchText").val();
params += '&category='+$("#comboCategory option:selected").val();
params += '&user='+$("#comboUsers option:selected").val();
params += '&user='+$("#comboUsers").val();
params += '&dateFrom='+$("#dateFrom").val();
params += '&dateTo='+$("#dateTo").val();
@@ -261,7 +261,22 @@
$("#comboUsers").val(user);
$("#dateFrom").val(dateFrom);
$("#dateTo").val(dateTo);
$("#comboProcessAuto" ).autocomplete({
source: "getProcesses?t="+listType,
minLength: 1,
select: function( event, ui ) {
$("#comboProcess").val(ui.item.id);
$("#comboProcess").trigger("change");
}
});
$("#comboUsersAuto" ).autocomplete({
source: "getUsers?t="+listType,
minLength: 1,
select: function( event, ui ) {
$("#comboUsers").val(ui.item.id);
$("#comboUsers").trigger("change");
}
});
});
{/literal}
@@ -294,11 +309,8 @@
</select>
</div>
<div style = "float: right;"> <b>{$processTitle}:</b>
<select id="comboProcess" onchange="redirect();" style="width: 220px">
{foreach from=$processValues key=k item=VALUE}
<option value="{$VALUE[0]}">{$VALUE[1]}</option>
{/foreach}
</select>
<input id="comboProcessAuto" style="width: 220px" placeholder="{$allProcessLabel}" value="{$processCurrentTitle|htmlentities:2:"UTF-8"}">
<input id="comboProcess" onchange="redirect();" type="hidden">
</div>
<div style = "float: left;"> <b>{$statusTitle}:&nbsp;&nbsp;&nbsp;&nbsp;</b>
<select id="comboStatus" onchange="redirect();" style="width: 200px">
@@ -319,11 +331,8 @@
<div id='panelDown' style = "display: none; width: 95%;">
<div style = "float: left;"> <b>{$userTitle}:&nbsp;&nbsp;&nbsp;&nbsp;</b>
<select id="comboUsers" onchange="redirect();" style="width: 400px">
{foreach from=$userValues key=k item=VALUE}
<option value="{$VALUE[0]}">{$VALUE[1]}</option>
{/foreach}
</select>
<input id="comboUsersAuto" style="width: 400px" placeholder="{$currentUserLabel|htmlentities:2:'UTF-8'}" value="{$userCurrentName|htmlentities:2:'UTF-8'}">
<input id="comboUsers" onchange="redirect();" type="hidden">
</div>
<div style = "float: left;"><b>{$fromTitle} &nbsp;&nbsp;</b>
<input id="dateFrom" type="text" size="10">

View File

@@ -733,6 +733,9 @@ if (! is_file( PATH_LANGUAGECONT . 'translation.en' )) {
$pmTranslation = new Translation();
$fields = $pmTranslation->generateFileTranslation("en");
// Load Language Translation
Bootstrap::LoadTranslationObject("en");
}
// TODO: Verify if the language set into url is defined in translations env.
@@ -743,6 +746,9 @@ if (SYS_LANG != 'en' && ! is_file( PATH_LANGUAGECONT . 'translation.' . SYS_LANG
$pmTranslation = new Translation();
$fields = $pmTranslation->generateFileTranslation(SYS_LANG);
// Load Language Translation
Bootstrap::LoadTranslationObject(SYS_LANG);
}
// Setup plugins