Merged in release/3.3.4 (pull request #6782)
Release/3.3.4 Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
@@ -3484,8 +3484,19 @@ class Cases
|
|||||||
* @param string $stepUidObj
|
* @param string $stepUidObj
|
||||||
* @param string $triggerType
|
* @param string $triggerType
|
||||||
* @param string $labelAssignment
|
* @param string $labelAssignment
|
||||||
|
* @param bool $useGlobal, needs to have the value true if the same case in execution is affected with this trigger
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
*
|
||||||
|
* @see Cases::executeTriggers()
|
||||||
|
* @see Cases::getExecuteTriggerProcess()
|
||||||
|
* @see WsBase::executeTriggerFromDerivate()
|
||||||
|
* @see ScriptTask::execScriptByActivityUid()
|
||||||
|
*
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Triggers#Custom_Trigger
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Triggers
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Tasks#ScriptTask
|
||||||
*/
|
*/
|
||||||
public function executeTriggerFromList(
|
public function executeTriggerFromList(
|
||||||
array $triggersList,
|
array $triggersList,
|
||||||
@@ -3493,17 +3504,23 @@ class Cases
|
|||||||
$stepType,
|
$stepType,
|
||||||
$stepUidObj,
|
$stepUidObj,
|
||||||
$triggerType,
|
$triggerType,
|
||||||
$labelAssignment = ''
|
$labelAssignment = '',
|
||||||
|
$useGlobal = true
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (count($triggersList) > 0) {
|
if (count($triggersList) > 0) {
|
||||||
global $oPMScript;
|
if ($useGlobal) {
|
||||||
|
/**
|
||||||
|
* The global $oPMScript is necessary when the trigger can be update the appData related to the case
|
||||||
|
* in execution
|
||||||
|
*/
|
||||||
|
global $oPMScript;
|
||||||
|
}
|
||||||
|
|
||||||
$this->addTriggerMessageExecution("<br /><b>" . $labelAssignment . "</b><br />");
|
$this->addTriggerMessageExecution("<br /><b>" . $labelAssignment . "</b><br />");
|
||||||
if (!isset($oPMScript)) {
|
if (!isset($oPMScript)) {
|
||||||
$oPMScript = new PMScript();
|
$oPMScript = new PMScript();
|
||||||
}
|
}
|
||||||
$oPMScript->setFields($fieldsCase);
|
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$cs = new CodeScanner(config("system.workspace"));
|
$cs = new CodeScanner(config("system.workspace"));
|
||||||
@@ -3520,6 +3537,7 @@ class Cases
|
|||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
|
$oPMScript->setFields($fieldsCase);
|
||||||
$execute = true;
|
$execute = true;
|
||||||
//Check if the trigger has conditions for the execution
|
//Check if the trigger has conditions for the execution
|
||||||
if (!empty($trigger['ST_CONDITION'])) {
|
if (!empty($trigger['ST_CONDITION'])) {
|
||||||
@@ -3550,9 +3568,19 @@ class Cases
|
|||||||
//Other thread execution can be changed the variables
|
//Other thread execution can be changed the variables
|
||||||
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
|
$appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : '';
|
||||||
if (!empty($appUid)) {
|
if (!empty($appUid)) {
|
||||||
|
$lastFieldsCase = $this->loadCase($appUid)['APP_DATA'];
|
||||||
//Update $fieldsCase with the last appData
|
//Update $fieldsCase with the last appData
|
||||||
$fieldsCase = $this->loadCase($appUid)['APP_DATA'];
|
$fieldsCase = array_merge($fieldsCase, $lastFieldsCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Update the case with the fields changed in the trigger
|
||||||
|
if (!empty($fieldsTrigger)) {
|
||||||
|
$appFieldsTrigger = [];
|
||||||
|
$appFieldsTrigger['APP_DATA'] = $fieldsTrigger;
|
||||||
|
//Update the case
|
||||||
|
$this->updateCase($appUid, $appFieldsTrigger);
|
||||||
|
}
|
||||||
|
|
||||||
//Merge the appData with variables changed
|
//Merge the appData with variables changed
|
||||||
$fieldsCase = array_merge($fieldsCase, $fieldsTrigger);
|
$fieldsCase = array_merge($fieldsCase, $fieldsTrigger);
|
||||||
} else {
|
} else {
|
||||||
@@ -4338,14 +4366,15 @@ class Cases
|
|||||||
* @param string $appUid
|
* @param string $appUid
|
||||||
* @param integer $delIndex
|
* @param integer $delIndex
|
||||||
* @param string $usrUid
|
* @param string $usrUid
|
||||||
|
* @param bool $executeSameCase
|
||||||
|
*
|
||||||
|
* @see Ajax::cancelCase()
|
||||||
|
* @see cases_Ajax
|
||||||
|
* @see WsBase::cancelCase()
|
||||||
*
|
*
|
||||||
* @return boolean|string
|
|
||||||
*/
|
*/
|
||||||
public function cancelCase($appUid, $delIndex = null, $usrUid = null)
|
public function cancelCase($appUid, $delIndex = null, $usrUid = null, $executeSameCase = true)
|
||||||
{
|
{
|
||||||
/** Execute a trigger when a case is cancelled */
|
|
||||||
$this->getExecuteTriggerProcess($appUid, 'CANCELED');
|
|
||||||
|
|
||||||
$caseFields = $this->loadCase($appUid);
|
$caseFields = $this->loadCase($appUid);
|
||||||
$appStatusCurrent = $caseFields['APP_STATUS'];
|
$appStatusCurrent = $caseFields['APP_STATUS'];
|
||||||
|
|
||||||
@@ -4374,6 +4403,9 @@ class Cases
|
|||||||
);
|
);
|
||||||
$delay->create($rowDelay);
|
$delay->create($rowDelay);
|
||||||
|
|
||||||
|
/** Execute a trigger when a case is cancelled */
|
||||||
|
$this->getExecuteTriggerProcess($appUid, 'CANCELED', $executeSameCase);
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$dataList = [
|
$dataList = [
|
||||||
'APP_UID' => $appUid,
|
'APP_UID' => $appUid,
|
||||||
@@ -7249,40 +7281,56 @@ class Cases
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExecuteTriggerProcess($appUid, $action)
|
/**
|
||||||
|
* Execute triggers when committing an action in cases
|
||||||
|
*
|
||||||
|
* @param string $appUid
|
||||||
|
* @param string $action, can be [OPEN, CANCELED, PAUSED, REASSIGNED, DELETED, CREATE, UNPAUSE]
|
||||||
|
* @param bool $executeSameCase
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*
|
||||||
|
* @see cases_Open.php
|
||||||
|
* @see cancelCase/Cases.php pauseCase/Cases.php reassignCase/Cases.php removeCase/Cases.php unpauseCase/Cases.php on
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases
|
||||||
|
*/
|
||||||
|
public function getExecuteTriggerProcess($appUid, $action, $executeSameCase = true)
|
||||||
{
|
{
|
||||||
if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) {
|
if (empty($appUid) || empty($action)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aFields = $this->loadCase($appUid);
|
|
||||||
$proUid = $aFields['PRO_UID'];
|
|
||||||
|
|
||||||
require_once("classes/model/Process.php");
|
require_once("classes/model/Process.php");
|
||||||
|
$fieldsCase = $this->loadCase($appUid);
|
||||||
|
$proUid = $fieldsCase['PRO_UID'];
|
||||||
|
|
||||||
|
//Set some global system variables
|
||||||
|
$fieldsCase['APP_DATA']['APPLICATION'] = $appUid;
|
||||||
|
$fieldsCase['APP_DATA']['PROCESS'] = $proUid;
|
||||||
|
|
||||||
|
//Get the trigger configured in the process action
|
||||||
$appProcess = new Process();
|
$appProcess = new Process();
|
||||||
$arrayWebBotTrigger = $appProcess->getTriggerWebBotProcess($proUid, $action);
|
$triggersList = $appProcess->getTriggerWebBotProcess($proUid, $action);
|
||||||
|
|
||||||
if ($arrayWebBotTrigger['TRI_WEBBOT'] != false && $arrayWebBotTrigger['TRI_WEBBOT'] != '') {
|
if (!empty($triggersList)){
|
||||||
global $oPMScript;
|
//Execute the trigger defined in the process action
|
||||||
$aFields['APP_DATA']['APPLICATION'] = $appUid;
|
$fieldsCase['APP_DATA'] = $this->executeTriggerFromList(
|
||||||
$aFields['APP_DATA']['PROCESS'] = $proUid;
|
$triggersList,
|
||||||
$oPMScript = new PMScript();
|
$fieldsCase['APP_DATA'],
|
||||||
$oPMScript->setDataTrigger($arrayWebBotTrigger);
|
'PROCESS_ACTION',
|
||||||
$oPMScript->setFields($aFields['APP_DATA']);
|
'',
|
||||||
$oPMScript->setScript($arrayWebBotTrigger['TRI_WEBBOT']);
|
'',
|
||||||
$oPMScript->setExecutedOn(PMScript::PROCESS_ACTION);
|
'',
|
||||||
$oPMScript->execute();
|
$executeSameCase
|
||||||
|
);
|
||||||
|
|
||||||
$aFields['APP_DATA'] = array_merge($aFields['APP_DATA'], $oPMScript->aFields);
|
//Update the case
|
||||||
unset($aFields['APP_STATUS']);
|
$this->updateCase($appUid, $fieldsCase);
|
||||||
unset($aFields['APP_PROC_STATUS']);
|
|
||||||
unset($aFields['APP_PROC_CODE']);
|
|
||||||
unset($aFields['APP_PIN']);
|
|
||||||
$this->updateCase($aFields['APP_UID'], $aFields);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4211,21 +4211,37 @@ class ProcessMap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadFile($sProcessUID, $sMainDirectory, $sCurrentDirectory, $sFile)
|
/**
|
||||||
|
* Stream a file from "mailTemplates" or "public" directory thats belongs to a process
|
||||||
|
*
|
||||||
|
* @param string $processUid
|
||||||
|
* @param string $mainDirectory
|
||||||
|
* @param string $currentDirectory
|
||||||
|
* @param string $file
|
||||||
|
*/
|
||||||
|
public function downloadFile($processUid, $mainDirectory, $currentDirectory, $file)
|
||||||
{
|
{
|
||||||
switch ($sMainDirectory) {
|
// Validate directory and file requested
|
||||||
|
$filter = new InputFilter();
|
||||||
|
$currentDirectory = $filter->validatePath($currentDirectory);
|
||||||
|
$file = $filter->validatePath($file);
|
||||||
|
|
||||||
|
// Validate the main directory
|
||||||
|
switch ($mainDirectory) {
|
||||||
case 'mailTemplates':
|
case 'mailTemplates':
|
||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : '');
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $processUid . PATH_SEP . ($currentDirectory != '' ? $currentDirectory . PATH_SEP : '');
|
||||||
break;
|
break;
|
||||||
case 'public':
|
case 'public':
|
||||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : '');
|
$sDirectory = PATH_DATA_PUBLIC . $processUid . PATH_SEP . ($currentDirectory != '' ? $currentDirectory . PATH_SEP : '');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (file_exists($sDirectory . $sFile)) {
|
|
||||||
G::streamFile($sDirectory . $sFile, true);
|
// Stream the file if path exists
|
||||||
|
if (file_exists($sDirectory . $file)) {
|
||||||
|
G::streamFile($sDirectory . $file, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class WsBase
|
|||||||
{
|
{
|
||||||
public $stored_system_variables; //boolean
|
public $stored_system_variables; //boolean
|
||||||
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
|
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
|
||||||
|
private $flagSameCase = true;
|
||||||
|
|
||||||
public function __construct($params = null)
|
public function __construct($params = null)
|
||||||
{
|
{
|
||||||
@@ -23,6 +24,28 @@ class WsBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the flagSameCase
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getFlagSameCase()
|
||||||
|
{
|
||||||
|
return $this->flagSameCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the flagSameCase
|
||||||
|
*
|
||||||
|
* @param boolean $var
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setFlagSameCase($var)
|
||||||
|
{
|
||||||
|
$this->flagSameCase = $var;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function to start a web services session in ProcessMaker
|
* function to start a web services session in ProcessMaker
|
||||||
*
|
*
|
||||||
@@ -2071,57 +2094,72 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates a new case impersonating a user who has the proper privileges to create new cases
|
* Creates a new case impersonating a user who has the proper privileges to create new cases
|
||||||
*
|
*
|
||||||
* @param string $processId
|
* @param string $processId
|
||||||
* @param string $userId
|
* @param string $userId
|
||||||
* @param string $variables
|
* @param array $variables, that are set in the new case
|
||||||
* @param string $taskId , must be in the starting group.
|
* @param string $taskId, must be in the starting group.
|
||||||
*
|
*
|
||||||
* @return $result will return an object
|
* @return object
|
||||||
|
*
|
||||||
|
* @see PMFNewCaseImpersonate/class.pmFunctions.php on
|
||||||
|
* @link https://wiki.processmaker.com/3.1/ProcessMaker_Functions#PMFNewCaseImpersonate.28.29
|
||||||
|
*
|
||||||
|
* @see doPostCaseImpersonate/Api/Cases on
|
||||||
|
* @link https://wiki.processmaker.com/3.2/REST_API_Cases/Cases#New_Case_Impersonate_User:_POST_.2Fcases.2Fimpersonate
|
||||||
|
*
|
||||||
|
* @see NewCaseImpersonate/soap2.php on
|
||||||
|
* @link https://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services#newCaseImpersonate.28.29
|
||||||
*/
|
*/
|
||||||
public function newCaseImpersonate($processId, $userId, $variables, $taskId = '')
|
public function newCaseImpersonate($processId, $userId, $variables, $taskId = '')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (is_array($variables)) {
|
$g = new G();
|
||||||
if (count($variables) > 0) {
|
$g->sessionVarSave();
|
||||||
$c = count($variables);
|
|
||||||
$Fields = $variables;
|
|
||||||
} else {
|
|
||||||
if ($c == 0) {
|
|
||||||
$result = new WsResponse(10, G::loadTranslation('ID_ARRAY_VARIABLES_EMPTY'));
|
|
||||||
|
|
||||||
return $result;
|
$c = count($variables);
|
||||||
}
|
if (is_array($variables)) {
|
||||||
|
if ($c > 0) {
|
||||||
|
$fieldsVariables = $variables;
|
||||||
|
} elseif ($c === 0) {
|
||||||
|
$result = new WsResponse(10, G::loadTranslation('ID_ARRAY_VARIABLES_EMPTY'));
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = new WsResponse(10, G::loadTranslation('ID_VARIABLES_PARAM_NOT_ARRAY'));
|
$result = new WsResponse(10, G::loadTranslation('ID_VARIABLES_PARAM_NOT_ARRAY'));
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$processes = new Processes();
|
$processes = new Processes();
|
||||||
|
|
||||||
if (!$processes->processExists($processId)) {
|
if (!$processes->processExists($processId)) {
|
||||||
$result = new WsResponse(11, G::loadTranslation('ID_INVALID_PROCESS') . " " . $processId . "!!");
|
$result = new WsResponse(11, G::loadTranslation('ID_INVALID_PROCESS') . " " . $processId . "!!");
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new Users();
|
$user = new Users();
|
||||||
|
|
||||||
if (!$user->userExists($userId)) {
|
if (!$user->userExists($userId)) {
|
||||||
$result = new WsResponse(11, G::loadTranslation('ID_USER_NOT_REGISTERED') . " " . $userId . "!!");
|
$result = new WsResponse(11, G::loadTranslation('ID_USER_NOT_REGISTERED') . " " . $userId . "!!");
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
} else {
|
||||||
|
$user->load($userId);
|
||||||
|
$userName = $user->getUsrUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCase = new Cases();
|
$caseInstance = new Cases();
|
||||||
|
|
||||||
$numTasks = 0;
|
$numTasks = 0;
|
||||||
if ($taskId != '') {
|
if (!empty($taskId)) {
|
||||||
$aTasks = $processes->getStartingTaskForUser($processId, null);
|
$startTasks = $processes->getStartingTaskForUser($processId, null);
|
||||||
foreach ($aTasks as $task) {
|
foreach ($startTasks as $task) {
|
||||||
if ($task['TAS_UID'] == $taskId) {
|
if ($task['TAS_UID'] == $taskId) {
|
||||||
$arrayTask[0]['TAS_UID'] = $taskId;
|
$arrayTask[0]['TAS_UID'] = $taskId;
|
||||||
$numTasks = 1;
|
$numTasks = 1;
|
||||||
@@ -2132,38 +2170,47 @@ class WsBase
|
|||||||
$numTasks = count($arrayTask);
|
$numTasks = count($arrayTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($numTasks == 1) {
|
if ($numTasks === 1) {
|
||||||
$case = $oCase->startCase($arrayTask[0]['TAS_UID'], $userId);
|
//@todo Find a better way to define session variables
|
||||||
$caseId = $case['APPLICATION'];
|
$_SESSION["PROCESS"] = $processId;
|
||||||
$caseNumber = $case['CASE_NUMBER'];
|
$_SESSION["TASK"] = $arrayTask[0]['TAS_UID'];
|
||||||
|
$_SESSION["USER_LOGGED"] = $userId;
|
||||||
|
$_SESSION["INDEX"] = 1;
|
||||||
|
$_SESSION["USR_USERNAME"] = $userName;
|
||||||
|
|
||||||
$oldFields = $oCase->loadCase($caseId);
|
//Create a newCase
|
||||||
|
$infoCase = $caseInstance->startCase($arrayTask[0]['TAS_UID'], $userId);
|
||||||
$oldFields['APP_DATA'] = array_merge($oldFields['APP_DATA'], $Fields);
|
$_SESSION["APPLICATION"] = $caseId = $infoCase['APPLICATION'];
|
||||||
|
$oldFields = $caseInstance->loadCase($caseId);
|
||||||
$up_case = $oCase->updateCase($caseId, $oldFields);
|
//Merge the data with the $fieldsVariables that are set in the new case
|
||||||
|
$oldFields['APP_DATA'] = array_merge($oldFields['APP_DATA'], $fieldsVariables);
|
||||||
|
|
||||||
|
//Update the case
|
||||||
|
$res = $caseInstance->updateCase($caseId, $oldFields);
|
||||||
$result = new WsResponse(0, G::loadTranslation('ID_COMMAND_EXECUTED_SUCCESSFULLY'));
|
$result = new WsResponse(0, G::loadTranslation('ID_COMMAND_EXECUTED_SUCCESSFULLY'));
|
||||||
|
|
||||||
$result->caseId = $caseId;
|
$result->caseId = $caseId;
|
||||||
$result->caseNumber = $caseNumber;
|
$result->caseNumber = $infoCase['CASE_NUMBER'];
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
if ($numTasks == 0) {
|
if ($numTasks === 0) {
|
||||||
$result = new WsResponse(12, G::loadTranslation('ID_NO_STARTING_TASK'));
|
$result = new WsResponse(12, G::loadTranslation('ID_NO_STARTING_TASK'));
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($numTasks > 1) {
|
if ($numTasks > 1) {
|
||||||
$result = new WsResponse(13, G::loadTranslation('ID_MULTIPLE_STARTING_TASKS'));
|
$result = new WsResponse(13, G::loadTranslation('ID_MULTIPLE_STARTING_TASKS'));
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result = new WsResponse(100, $e->getMessage());
|
$result = new WsResponse(100, $e->getMessage());
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -2182,6 +2229,8 @@ class WsBase
|
|||||||
* @param string $labelAssignment , label related to the triggerType
|
* @param string $labelAssignment , label related to the triggerType
|
||||||
*
|
*
|
||||||
* @return string $varTriggers updated
|
* @return string $varTriggers updated
|
||||||
|
*
|
||||||
|
* @see WsBase::derivateCase()
|
||||||
*/
|
*/
|
||||||
public function executeTriggerFromDerivate(
|
public function executeTriggerFromDerivate(
|
||||||
$appUid,
|
$appUid,
|
||||||
@@ -2247,10 +2296,14 @@ class WsBase
|
|||||||
*
|
*
|
||||||
* @param string $userId
|
* @param string $userId
|
||||||
* @param string $caseId
|
* @param string $caseId
|
||||||
* @param string $delIndex
|
* @param integer $delIndex
|
||||||
* @param array $tasks
|
|
||||||
* @param bool $bExecuteTriggersBeforeAssignment
|
* @param bool $bExecuteTriggersBeforeAssignment
|
||||||
|
* @param array $tasks
|
||||||
|
*
|
||||||
* @return $result will return an object
|
* @return $result will return an object
|
||||||
|
*
|
||||||
|
* @see PMFDerivateCase()/class.pmFunctions.php on
|
||||||
|
* @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions/Case_Routing_Functions#PMFDerivateCase.28.29
|
||||||
*/
|
*/
|
||||||
public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = [])
|
public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = [])
|
||||||
{
|
{
|
||||||
@@ -3065,6 +3118,10 @@ class WsBase
|
|||||||
public function cancelCase($caseUid, $delIndex, $userUid)
|
public function cancelCase($caseUid, $delIndex, $userUid)
|
||||||
{
|
{
|
||||||
$g = new G();
|
$g = new G();
|
||||||
|
//We will to review if the current case in execution will be execute the same
|
||||||
|
if (isset($_SESSION["APPLICATION"]) && $_SESSION["APPLICATION"] !== $caseUid){
|
||||||
|
$this->setFlagSameCase(false);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$g->sessionVarSave();
|
$g->sessionVarSave();
|
||||||
@@ -3090,7 +3147,7 @@ class WsBase
|
|||||||
/** If those parameters are null we will to force the cancelCase */
|
/** If those parameters are null we will to force the cancelCase */
|
||||||
if (is_null($delIndex) && is_null($userUid)) {
|
if (is_null($delIndex) && is_null($userUid)) {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$case->cancelCase($caseUid, null, null);
|
$case->cancelCase($caseUid, null, null, $this->getFlagSameCase());
|
||||||
$result = self::messageExecuteSuccessfully();
|
$result = self::messageExecuteSuccessfully();
|
||||||
$g->sessionVarRestore();
|
$g->sessionVarRestore();
|
||||||
|
|
||||||
@@ -3127,7 +3184,7 @@ class WsBase
|
|||||||
|
|
||||||
|
|
||||||
/** Cancel case */
|
/** Cancel case */
|
||||||
$case->cancelCase($caseUid, (int)$delIndex, $userUid);
|
$case->cancelCase($caseUid, (int)$delIndex, $userUid, $this->getFlagSameCase());
|
||||||
|
|
||||||
//Define the result of the cancelCase
|
//Define the result of the cancelCase
|
||||||
$result = self::messageExecuteSuccessfully();
|
$result = self::messageExecuteSuccessfully();
|
||||||
@@ -3151,6 +3208,11 @@ class WsBase
|
|||||||
* @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause
|
* @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause
|
||||||
* the case.
|
* the case.
|
||||||
*
|
*
|
||||||
|
* @see workflow/engine/classes/class.pmFunctions.php::PMFPauseCase()
|
||||||
|
* @see workflow/engine/methods/services/soap2.php::pauseCase()
|
||||||
|
*
|
||||||
|
* @link https://wiki.processmaker.com/3.3/ProcessMaker_Functions/Case_Functions#PMFPauseCase.28.29
|
||||||
|
*
|
||||||
* @return $result will return an object
|
* @return $result will return an object
|
||||||
*/
|
*/
|
||||||
public function pauseCase($caseUid, $delIndex, $userUid, $unpauseDate = null)
|
public function pauseCase($caseUid, $delIndex, $userUid, $unpauseDate = null)
|
||||||
@@ -3186,6 +3248,22 @@ class WsBase
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
//Validate if status is closed
|
||||||
|
$appDelegation = new AppDelegation();
|
||||||
|
$rows = $appDelegation->LoadParallel($caseUid, $delIndex);
|
||||||
|
if (empty($rows)) {
|
||||||
|
$result = new WsResponse(100, G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED'));
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
//Validate if the case is paused
|
||||||
|
$appDelay = new AppDelay();
|
||||||
|
$sw = $appDelay->isPaused($caseUid, $delIndex);
|
||||||
|
if ($sw === true) {
|
||||||
|
$result = new WsResponse(19, G::LoadTranslation('ID_CASE_IN_STATUS') . " " . AppDelay::APP_TYPE_PAUSE);
|
||||||
|
$g->sessionVarRestore();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
if (strlen($unpauseDate) >= 10) {
|
if (strlen($unpauseDate) >= 10) {
|
||||||
if (!preg_match("/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate)) {
|
if (!preg_match("/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate)) {
|
||||||
$result = new WsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate");
|
$result = new WsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate");
|
||||||
|
|||||||
@@ -2825,7 +2825,7 @@ function PMFPauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null)
|
|||||||
{
|
{
|
||||||
$ws = new WsBase();
|
$ws = new WsBase();
|
||||||
$result = $ws->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate);
|
$result = $ws->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate);
|
||||||
|
$result = (object) $result;
|
||||||
if ($result->status_code == 0) {
|
if ($result->status_code == 0) {
|
||||||
if (isset($_SESSION['APPLICATION']) && isset($_SESSION['INDEX'])) {
|
if (isset($_SESSION['APPLICATION']) && isset($_SESSION['INDEX'])) {
|
||||||
if ($_SESSION['APPLICATION'] == $caseUid && $_SESSION['INDEX'] == $delIndex) {
|
if ($_SESSION['APPLICATION'] == $caseUid && $_SESSION['INDEX'] == $delIndex) {
|
||||||
|
|||||||
@@ -281,15 +281,22 @@ class PMScript
|
|||||||
self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN;
|
self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN;
|
||||||
break;
|
break;
|
||||||
case 'ASSIGN_TASK':
|
case 'ASSIGN_TASK':
|
||||||
|
$stepUidObj = (int)$stepUidObj;
|
||||||
if ($stepUidObj === -1) {
|
if ($stepUidObj === -1) {
|
||||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ASSIGNMENT : self::UNDEFINED_ORIGIN;
|
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ASSIGNMENT : self::UNDEFINED_ORIGIN;
|
||||||
} elseif ($stepUidObj === -2) {
|
} elseif ($stepUidObj === -2) {
|
||||||
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ROUTING : $triggerType === 'AFTER' ?
|
$executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ROUTING : ($triggerType === 'AFTER' ?
|
||||||
self::AFTER_ROUTING : self::UNDEFINED_ORIGIN;
|
self::AFTER_ROUTING : self::UNDEFINED_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
$executedOn = self::UNDEFINED_ORIGIN;
|
$executedOn = self::UNDEFINED_ORIGIN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'PROCESS_ACTION':
|
||||||
|
$executedOn = self::PROCESS_ACTION;
|
||||||
|
break;
|
||||||
|
case 'SCRIPT_TASK':
|
||||||
|
$executedOn = self::SCRIPT_TASK;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$executedOn = self::UNDEFINED_ORIGIN;
|
$executedOn = self::UNDEFINED_ORIGIN;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -775,11 +775,22 @@ class Process extends BaseProcess
|
|||||||
return $aProc;
|
return $aProc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the trigger configured in committing an action in cases
|
||||||
|
*
|
||||||
|
* @param string $proUid
|
||||||
|
* @param string $action
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @see Cases::getExecuteTriggerProcess()
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases
|
||||||
|
*/
|
||||||
public function getTriggerWebBotProcess($proUid, $action)
|
public function getTriggerWebBotProcess($proUid, $action)
|
||||||
{
|
{
|
||||||
require_once("classes/model/Triggers.php");
|
require_once("classes/model/Triggers.php");
|
||||||
|
|
||||||
if ((! isset($proUid) && $proUid == '') || (! isset($action) && $action == '')) {
|
if (empty($proUid) || empty($action)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,40 +799,41 @@ class Process extends BaseProcess
|
|||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'CREATE':
|
case 'CREATE':
|
||||||
$var = ProcessPeer::PRO_TRI_CREATE;
|
$columnName = ProcessPeer::PRO_TRI_CREATE;
|
||||||
break;
|
break;
|
||||||
case 'OPEN':
|
case 'OPEN':
|
||||||
$var = ProcessPeer::PRO_TRI_OPEN;
|
$columnName = ProcessPeer::PRO_TRI_OPEN;
|
||||||
break;
|
break;
|
||||||
case 'DELETED':
|
case 'DELETED':
|
||||||
$var = ProcessPeer::PRO_TRI_DELETED;
|
$columnName = ProcessPeer::PRO_TRI_DELETED;
|
||||||
break;
|
break;
|
||||||
case 'CANCELED':
|
case 'CANCELED':
|
||||||
$var = ProcessPeer::PRO_TRI_CANCELED;
|
$columnName = ProcessPeer::PRO_TRI_CANCELED;
|
||||||
break;
|
break;
|
||||||
case 'PAUSED':
|
case 'PAUSED':
|
||||||
$var = ProcessPeer::PRO_TRI_PAUSED;
|
$columnName = ProcessPeer::PRO_TRI_PAUSED;
|
||||||
break;
|
break;
|
||||||
case 'REASSIGNED':
|
case 'REASSIGNED':
|
||||||
$var = ProcessPeer::PRO_TRI_REASSIGNED;
|
$columnName = ProcessPeer::PRO_TRI_REASSIGNED;
|
||||||
break;
|
break;
|
||||||
case "UNPAUSE":
|
case "UNPAUSE":
|
||||||
$var = ProcessPeer::PRO_TRI_UNPAUSED;
|
$columnName = ProcessPeer::PRO_TRI_UNPAUSED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn($var);
|
$criteria->addSelectColumn($columnName);
|
||||||
$oCriteria->addSelectColumn(TriggersPeer::TRI_UID);
|
$criteria->addSelectColumn(TriggersPeer::TRI_UID);
|
||||||
$oCriteria->addSelectColumn(TriggersPeer::TRI_WEBBOT);
|
$criteria->addSelectColumn(TriggersPeer::TRI_WEBBOT);
|
||||||
$oCriteria->addJoin($var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);
|
$criteria->addSelectColumn(TriggersPeer::TRI_TITLE);
|
||||||
$oCriteria->add(ProcessPeer::PRO_UID, $proUid);
|
$criteria->addJoin($columnName, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);
|
||||||
$oDataSet = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
|
$criteria->add(ProcessPeer::PRO_UID, $proUid);
|
||||||
|
$criteria->add($columnName, '', Criteria::NOT_EQUAL);
|
||||||
|
$dataSet = ProcessPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro'));
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
if ($dataSet->next()) {
|
||||||
if ($oDataSet->next()) {
|
$arrayWebBotTrigger[] = $dataSet->getRow();
|
||||||
$row = $oDataSet->getRow();
|
|
||||||
$arrayWebBotTrigger = ['TRI_UID' => $row['TRI_UID'], 'TRI_WEBBOT' => $row['TRI_WEBBOT']];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
|
|||||||
@@ -152,5 +152,29 @@ class SubApplication extends BaseSubApplication
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all cases with the same parent case
|
||||||
|
*
|
||||||
|
* @param $appUid
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function loadByAppUidParent($appUid)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(SubApplicationPeer::APP_PARENT, $appUid);
|
||||||
|
$dataSet = SubApplicationPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
while ($dataSet->next()) {
|
||||||
|
$result[] = $dataSet->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,82 +3,110 @@
|
|||||||
use ProcessMaker\Util\DateTime;
|
use ProcessMaker\Util\DateTime;
|
||||||
|
|
||||||
switch ($RBAC->userCanAccess('PM_CASES')) {
|
switch ($RBAC->userCanAccess('PM_CASES')) {
|
||||||
case - 2:
|
case -2:
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||||
G::header('location: ../login/login');
|
G::header('location: ../login/login');
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
case - 1:
|
case -1:
|
||||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||||
G::header('location: ../login/login');
|
G::header('location: ../login/login');
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCase = new Cases();
|
/** Render page */
|
||||||
$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']);
|
|
||||||
|
|
||||||
/* Render page */
|
|
||||||
require_once 'classes/model/Process.php';
|
require_once 'classes/model/Process.php';
|
||||||
require_once 'classes/model/Task.php';
|
require_once 'classes/model/Task.php';
|
||||||
|
|
||||||
|
//Get information about the case
|
||||||
|
$case = new Cases();
|
||||||
|
$fieldsCase = $case->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']);
|
||||||
|
|
||||||
|
//Get the user logged
|
||||||
|
$userLogged = isset($RBAC->aUserInfo['USER_INFO']['USR_UID']) ? $RBAC->aUserInfo['USER_INFO']['USR_UID'] : '';
|
||||||
|
|
||||||
|
//Check the authorization
|
||||||
|
$objCase = new \ProcessMaker\BusinessModel\Cases();
|
||||||
|
$userCanAccess = $objCase->userAuthorization(
|
||||||
|
$userLogged,
|
||||||
|
$fieldsCase['PRO_UID'],
|
||||||
|
$fieldsCase['APP_UID'],
|
||||||
|
['PM_ALLCASES'],
|
||||||
|
['SUMMARY_FORM' => 'VIEW']
|
||||||
|
);
|
||||||
|
|
||||||
$objProc = new Process();
|
$objProc = new Process();
|
||||||
$aProc = $objProc->load($Fields['PRO_UID']);
|
$fieldsProcess = $objProc->load($fieldsCase['PRO_UID']);
|
||||||
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
|
$fieldsCase['PRO_TITLE'] = $fieldsProcess['PRO_TITLE'];
|
||||||
|
|
||||||
$objTask = new Task();
|
if (
|
||||||
$aTask = $objTask->load($Fields['TAS_UID']);
|
isset($fieldsProcess['PRO_DYNAFORMS']['PROCESS']) &&
|
||||||
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
|
!empty($fieldsProcess['PRO_DYNAFORMS']['PROCESS']) &&
|
||||||
|
$userCanAccess['objectPermissions']['SUMMARY_FORM'] &&
|
||||||
|
$objProc->isBpmnProcess($fieldsCase['PRO_UID'])
|
||||||
|
) {
|
||||||
|
/**We will to show the custom summary form only for BPMN process*/
|
||||||
|
$_REQUEST['APP_UID'] = $fieldsCase['APP_UID'];
|
||||||
|
$_REQUEST['DEL_INDEX'] = $fieldsCase['DEL_INDEX'];
|
||||||
|
$_REQUEST['DYN_UID'] = $fieldsProcess['PRO_DYNAFORMS']['PROCESS'];
|
||||||
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'summary.php');
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
/**We will to show the default claim case form*/
|
||||||
|
$objTask = new Task();
|
||||||
|
$fieldsTask = $objTask->load($fieldsCase['TAS_UID']);
|
||||||
|
$fieldsCase['TAS_TITLE'] = $fieldsTask['TAS_TITLE'];
|
||||||
|
$fieldsCase['STATUS'] .= ' ( ' . G::LoadTranslation('ID_UNASSIGNED') . ' )';
|
||||||
|
|
||||||
$Fields['STATUS'] .= ' ( ' . G::LoadTranslation('ID_UNASSIGNED') . ' )';
|
//Now getting information about the PREVIOUS task. If is the first task then no previous, use 1
|
||||||
|
$appDelegation = new AppDelegation();
|
||||||
|
$appDelegation->Load(
|
||||||
|
$fieldsCase['APP_UID'],
|
||||||
|
($fieldsCase['DEL_PREVIOUS'] == 0 ? $fieldsCase['DEL_PREVIOUS'] = 1 : $fieldsCase['DEL_PREVIOUS'])
|
||||||
|
);
|
||||||
|
$fieldsDelegation = $appDelegation->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
//now getting information about the PREVIOUS task. If is the first task then no preious, use 1
|
try {
|
||||||
$oAppDel = new AppDelegation();
|
$userInfo = new Users();
|
||||||
$oAppDel->Load($Fields['APP_UID'], ($Fields['DEL_PREVIOUS'] == 0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS']));
|
$userInfo->load($fieldsDelegation['USR_UID']);
|
||||||
|
$fieldsCase['PREVIOUS_USER'] = $userInfo->getUsrFirstname() . ' ' . $userInfo->getUsrLastname();
|
||||||
|
} catch (Exception $error) {
|
||||||
|
$fieldsCase['PREVIOUS_USER'] = G::LoadTranslation('ID_NO_PREVIOUS_USR_UID');
|
||||||
|
}
|
||||||
|
|
||||||
$aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);
|
//To enable information (dynaforms, steps) before claim a case
|
||||||
try {
|
$_SESSION['bNoShowSteps'] = true;
|
||||||
$oCurUser = new Users();
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$oCurUser->load($aAppDel['USR_UID']);
|
$G_SUB_MENU = 'caseOptions';
|
||||||
$Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname();
|
$G_ID_MENU_SELECTED = 'CASES';
|
||||||
} catch (Exception $oError) {
|
$G_ID_SUB_MENU_SELECTED = '_';
|
||||||
$Fields['PREVIOUS_USER'] = G::LoadTranslation('ID_NO_PREVIOUS_USR_UID');
|
$headPublisher = headPublisher::getSingleton();
|
||||||
}
|
$headPublisher->addScriptCode("
|
||||||
|
if (typeof parent != 'undefined') {
|
||||||
$objTask = new Task();
|
if (parent.showCaseNavigatorPanel) {
|
||||||
$aTask = $objTask->load($aAppDel['TAS_UID']);
|
parent.showCaseNavigatorPanel('{$fieldsCase['APP_STATUS']}');
|
||||||
$Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE'];
|
}
|
||||||
|
}
|
||||||
//To enable information (dynaforms, steps) before claim a case
|
");
|
||||||
$_SESSION['bNoShowSteps'] = true;
|
$headPublisher->addScriptCode('
|
||||||
$G_MAIN_MENU = 'processmaker';
|
var Cse = {};
|
||||||
$G_SUB_MENU = 'caseOptions';
|
Cse.panels = {};
|
||||||
$G_ID_MENU_SELECTED = 'CASES';
|
var leimnud = new maborak();
|
||||||
$G_ID_SUB_MENU_SELECTED = '_';
|
leimnud.make();
|
||||||
$oHeadPublisher = headPublisher::getSingleton();
|
leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"});
|
||||||
$oHeadPublisher->addScriptCode("
|
leimnud.Package.Load("cases",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases.js"});
|
||||||
if (typeof parent != 'undefined') {
|
leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"});
|
||||||
if (parent.showCaseNavigatorPanel) {
|
leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"});
|
||||||
parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}');
|
leimnud.exec(leimnud.fix.memoryLeak);
|
||||||
}
|
|
||||||
}");
|
|
||||||
$oHeadPublisher->addScriptCode('
|
|
||||||
var Cse = {};
|
|
||||||
Cse.panels = {};
|
|
||||||
var leimnud = new maborak();
|
|
||||||
leimnud.make();
|
|
||||||
leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"});
|
|
||||||
leimnud.Package.Load("cases",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases.js"});
|
|
||||||
leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"});
|
|
||||||
leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"});
|
|
||||||
leimnud.exec(leimnud.fix.memoryLeak);
|
|
||||||
');
|
');
|
||||||
$oHeadPublisher = headPublisher::getSingleton();
|
$headPublisher = headPublisher::getSingleton();
|
||||||
$oHeadPublisher->addScriptFile('/jscore/cases/core/cases_Step.js');
|
$headPublisher->addScriptFile('/jscore/cases/core/cases_Step.js');
|
||||||
|
|
||||||
$Fields['isIE'] = Bootstrap::isIE();
|
$fieldsCase['isIE'] = Bootstrap::isIE();
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$Fields = DateTime::convertUtcToTimeZone($Fields);
|
$fieldsCase = DateTime::convertUtcToTimeZone($fieldsCase);
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute');
|
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $fieldsCase, 'cases_CatchExecute');
|
||||||
G::RenderPage('publish', 'blank');
|
G::RenderPage('publish', 'blank');
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,32 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* open.php Open Case main processor
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
|
||||||
* @date Jan 3th, 2010
|
|
||||||
*/
|
|
||||||
|
|
||||||
$tBarGmail = false;
|
$tBarGmail = false;
|
||||||
if (isset($_GET['gmail']) && $_GET['gmail'] == 1) {
|
if (isset($_GET['gmail']) && $_GET['gmail'] == 1) {
|
||||||
@@ -121,22 +93,29 @@ if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise'))
|
|||||||
$script = 'cases_Open?';
|
$script = 'cases_Open?';
|
||||||
}
|
}
|
||||||
|
|
||||||
// getting bpmn projects
|
$process = new Process();
|
||||||
$c = new Criteria('workflow');
|
$fields = $process->load($case['PRO_UID']);
|
||||||
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
|
$isBpmn = $fields['PRO_BPMN'] === 1 ? true : false;
|
||||||
$ds = ProcessPeer::doSelectRS($c);
|
|
||||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$bpmnProjects = array();
|
|
||||||
|
|
||||||
while ($ds->next()) {
|
$showCustomForm = false;
|
||||||
$row = $ds->getRow();
|
|
||||||
$bpmnProjects[] = $row['PRJ_UID'];
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
|
$respView = $oCase->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW');
|
||||||
|
$viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false;
|
||||||
|
$isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']);
|
||||||
|
|
||||||
|
if ($isBpmn && $viewSummaryForm && $isNoEmpty) {
|
||||||
|
$showCustomForm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
$oStep = new Step();
|
$oStep = new Step();
|
||||||
$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1);
|
$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1);
|
||||||
$oHeadPublisher->assign('uri', $script . $uri);
|
$oHeadPublisher->assign('uri', $script . $uri);
|
||||||
$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']);
|
$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']);
|
||||||
$oHeadPublisher->assign('_PROJECT_TYPE', in_array($case['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic');
|
$oHeadPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic');
|
||||||
$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']);
|
$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']);
|
||||||
$oHeadPublisher->assign('_APP_UID', $appUid);
|
$oHeadPublisher->assign('_APP_UID', $appUid);
|
||||||
$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
||||||
@@ -144,6 +123,7 @@ $oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A'));
|
|||||||
$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj());
|
$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj());
|
||||||
$oHeadPublisher->assign('appStatus', $case['APP_STATUS']);
|
$oHeadPublisher->assign('appStatus', $case['APP_STATUS']);
|
||||||
$oHeadPublisher->assign('tbarGmail', $tBarGmail);
|
$oHeadPublisher->assign('tbarGmail', $tBarGmail);
|
||||||
|
$oHeadPublisher->assign('showCustomForm', $showCustomForm);
|
||||||
|
|
||||||
if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
|
if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
|
||||||
$_SESSION['PROCESS'] = $case['PRO_UID'];
|
$_SESSION['PROCESS'] = $case['PRO_UID'];
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method defined and copied from processmaker/workflow/engine/classes/class.configuration.php
|
* Get default configuration for Cases List.
|
||||||
*
|
*
|
||||||
|
* @param string $action
|
||||||
|
* @param int $translation
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
*/
|
*/
|
||||||
function casesListDefaultFieldsAndConfig($action, $translation = 1)
|
function casesListDefaultFieldsAndConfig($action, $translation = 1)
|
||||||
{
|
{
|
||||||
@@ -322,6 +329,16 @@ function casesListDefaultFieldsAndConfig($action, $translation = 1)
|
|||||||
return array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => 20, "dateformat" => "M d, Y");
|
return array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => 20, "dateformat" => "M d, Y");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default configuration and verify if casesListDefaultFieldsAndConfig method exist.
|
||||||
|
*
|
||||||
|
* @param string $action
|
||||||
|
* @param int $translation
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function getDefaultConfig($action, $translation)
|
function getDefaultConfig($action, $translation)
|
||||||
{
|
{
|
||||||
$config = new Configurations();
|
$config = new Configurations();
|
||||||
@@ -335,6 +352,16 @@ function getDefaultConfig($action, $translation)
|
|||||||
return $arrayConfig;
|
return $arrayConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default fields configuration.
|
||||||
|
*
|
||||||
|
* @param string $action
|
||||||
|
* @param int $translation
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function getDefaultFields($action, $translation)
|
function getDefaultFields($action, $translation)
|
||||||
{
|
{
|
||||||
$config = new Configurations();
|
$config = new Configurations();
|
||||||
@@ -405,6 +432,16 @@ function getDefaultFields($action, $translation)
|
|||||||
return $arrayField;
|
return $arrayField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set available fields.
|
||||||
|
*
|
||||||
|
* @param array $arrayAvailableField
|
||||||
|
* @param array $arrayField
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function setAvailableFields($arrayAvailableField, $arrayField)
|
function setAvailableFields($arrayAvailableField, $arrayField)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -427,6 +464,16 @@ function setAvailableFields($arrayAvailableField, $arrayField)
|
|||||||
return $arrayFieldResult;
|
return $arrayFieldResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Cases List fields.
|
||||||
|
*
|
||||||
|
* @param array $arrayCasesListField
|
||||||
|
* @param array $arrayField
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function setCasesListFields($arrayCasesListField, $arrayField)
|
function setCasesListFields($arrayCasesListField, $arrayField)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -462,32 +509,56 @@ function setCasesListFields($arrayCasesListField, $arrayField)
|
|||||||
return $arrayFieldResult;
|
return $arrayFieldResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Custom Case List configuration data.
|
||||||
|
*
|
||||||
|
* @global string $action
|
||||||
|
* @global array $confCasesList
|
||||||
|
* @global string $tabUid
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function fieldSet()
|
function fieldSet()
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
global $confCasesList;
|
|
||||||
global $action;
|
global $action;
|
||||||
|
global $confCasesList;
|
||||||
|
global $tabUid;
|
||||||
|
|
||||||
if (is_array($confCasesList)) {
|
$arrayField = getDefaultFields($action, 0);
|
||||||
$validConfig = isset($confCasesList["first"]) && isset($confCasesList["second"]);
|
$arrayConfig = getDefaultConfig($action, 0);
|
||||||
} else {
|
$result = genericJsonResponse($tabUid, [], $arrayField, $arrayConfig["rowsperpage"], $arrayConfig["dateformat"]);
|
||||||
$validConfig = false;
|
$result['first']['data'] = getFieldsByTabUid($tabUid);
|
||||||
|
|
||||||
|
$confCasesList = (array) $confCasesList;
|
||||||
|
|
||||||
|
if (!empty($confCasesList)) {
|
||||||
|
if (!empty($tabUid) && empty($confCasesList['PMTable'])) {
|
||||||
|
$confCasesList['PMTable'] = $tabUid;
|
||||||
|
$confCasesList['first']['data'] = getFieldsByTabUid($tabUid);
|
||||||
|
}
|
||||||
|
if (!empty($confCasesList['PMTable']) && empty($tabUid)) {
|
||||||
|
$result = $confCasesList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$validConfig) {
|
if (is_array($result) && isset($result['second']['data'])) {
|
||||||
$arrayField = getDefaultFields($action, 0);
|
foreach ($result['second']['data'] as $key => $value) {
|
||||||
$arrayConfig = getDefaultConfig($action, 0);
|
$result['second']['data'][$key]['align_label'] = $result['second']['data'][$key]['align'];
|
||||||
|
}
|
||||||
$result = genericJsonResponse("", array(), $arrayField, $arrayConfig["rowsperpage"], $arrayConfig["dateformat"]);
|
|
||||||
|
|
||||||
$conf->saveObject($result, "casesList", $action, "", "", "");
|
|
||||||
|
|
||||||
echo G::json_encode($result);
|
|
||||||
} else {
|
|
||||||
echo G::json_encode($confCasesList);
|
|
||||||
}
|
}
|
||||||
|
echo G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset fields configuration.
|
||||||
|
*
|
||||||
|
* @global string $action
|
||||||
|
* @param int $translation
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function fieldReset($translation)
|
function fieldReset($translation)
|
||||||
{
|
{
|
||||||
global $action;
|
global $action;
|
||||||
@@ -500,6 +571,15 @@ function fieldReset($translation)
|
|||||||
echo G::json_encode($result);
|
echo G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complete a field.
|
||||||
|
*
|
||||||
|
* @global string $action
|
||||||
|
* @param int $translation
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function fieldComplete($translation)
|
function fieldComplete($translation)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -565,6 +645,15 @@ function fieldComplete($translation)
|
|||||||
echo G::json_encode($result);
|
echo G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset field label.
|
||||||
|
*
|
||||||
|
* @global string $action
|
||||||
|
* @param int $translation
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function fieldLabelReset($translation)
|
function fieldLabelReset($translation)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -604,6 +693,15 @@ function fieldLabelReset($translation)
|
|||||||
echo G::json_encode($result);
|
echo G::json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save a field.
|
||||||
|
*
|
||||||
|
* @global object $conf
|
||||||
|
* @global string $action
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function fieldSave()
|
function fieldSave()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -690,11 +788,6 @@ try {
|
|||||||
|
|
||||||
switch ($xaction) {
|
switch ($xaction) {
|
||||||
case "FIELD_SET":
|
case "FIELD_SET":
|
||||||
if (is_array($confCasesList) && isset($confCasesList['second']['data'])) {
|
|
||||||
foreach ($confCasesList['second']['data'] as $key => $value) {
|
|
||||||
$confCasesList['second']['data'][$key]['align_label'] = $confCasesList['second']['data'][$key]['align'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldSet();
|
fieldSet();
|
||||||
break;
|
break;
|
||||||
case "FIELD_RESET":
|
case "FIELD_RESET":
|
||||||
@@ -722,14 +815,20 @@ try {
|
|||||||
G::outRes( G::json_encode( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ) );
|
G::outRes( G::json_encode( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the generic Json Response, using two array for the grid stores and a string for the pmtable name
|
* Set the generic Json Response, using two array for the grid stores and a string for the pmtable name.
|
||||||
* @param string $pmtable
|
*
|
||||||
* @param array $first
|
* @param string $pmtable
|
||||||
* @param array $second
|
* @param array $first
|
||||||
* @return $response a json string
|
* @param array $second
|
||||||
*/
|
* @param array $rowsPerPage
|
||||||
function genericJsonResponse($pmtable, $first, $second, $rowsperpage, $dateFormat)
|
* @param string $dateFormat
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
|
function genericJsonResponse($pmtable, $first, $second, $rowsPerPage, $dateFormat)
|
||||||
{
|
{
|
||||||
$firstGrid['totalCount'] = count($first);
|
$firstGrid['totalCount'] = count($first);
|
||||||
$firstGrid['data'] = $first;
|
$firstGrid['data'] = $first;
|
||||||
@@ -739,54 +838,72 @@ function genericJsonResponse($pmtable, $first, $second, $rowsperpage, $dateForma
|
|||||||
$result['first'] = $firstGrid;
|
$result['first'] = $firstGrid;
|
||||||
$result['second'] = $secondGrid;
|
$result['second'] = $secondGrid;
|
||||||
$result['PMTable'] = isset($pmtable) ? $pmtable : '';
|
$result['PMTable'] = isset($pmtable) ? $pmtable : '';
|
||||||
$result['rowsperpage'] = isset($rowsperpage) ? $rowsperpage : 20;
|
$result['rowsperpage'] = isset($rowsPerPage) ? $rowsPerPage : 20;
|
||||||
$result['dateformat'] = isset($dateFormat) && $dateFormat != '' ? $dateFormat : 'M d, Y';
|
$result['dateformat'] = isset($dateFormat) && $dateFormat != '' ? $dateFormat : 'M d, Y';
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get row from PM Table.
|
||||||
|
*
|
||||||
|
* @param string $tabUid
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function xgetFieldsFromPMTable($tabUid)
|
function xgetFieldsFromPMTable($tabUid)
|
||||||
{
|
{
|
||||||
$rows = array();
|
$result = [];
|
||||||
$result = array();
|
$result['data'] = getFieldsByTabUid($tabUid);
|
||||||
// $rows[] = array ( 'name' => 'val 1', 'gridIndex' => '21', 'fieldType' => 'PM Table' );
|
print G::json_encode($result);
|
||||||
// $rows[] = array ( 'name' => 'val 2', 'gridIndex' => '22', 'fieldType' => 'PM Table' );
|
|
||||||
// $rows[] = array ( 'name' => 'val 3', 'gridIndex' => '23', 'fieldType' => 'PM Table' );
|
|
||||||
//$result['success'] = true;
|
|
||||||
//$result['totalCount'] = count($rows);
|
|
||||||
$oCriteria = new Criteria('workflow');
|
|
||||||
$oCriteria->clearSelectColumns ( );
|
|
||||||
$oCriteria->setDistinct();
|
|
||||||
$oCriteria->addSelectColumn ( FieldsPeer::FLD_NAME );
|
|
||||||
$oCriteria->addSelectColumn ( FieldsPeer::FLD_UID );
|
|
||||||
$oCriteria->addSelectColumn ( FieldsPeer::FLD_INDEX );
|
|
||||||
$oCriteria->add (FieldsPeer::ADD_TAB_UID, $tabUid , CRITERIA::EQUAL );
|
|
||||||
$oCriteria->add (FieldsPeer::FLD_NAME, 'APP_UID' , CRITERIA::NOT_EQUAL );
|
|
||||||
$oCriteria->addAnd (FieldsPeer::FLD_NAME, 'APP_NUMBER' , CRITERIA::NOT_EQUAL );
|
|
||||||
$oCriteria->addDescendingOrderByColumn('FLD_INDEX');
|
|
||||||
$oDataset = FieldsPeer::doSelectRS($oCriteria);
|
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset->next();
|
|
||||||
$index = count($rows);
|
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
|
||||||
$aRow['index'] = ++$index;
|
|
||||||
$aTempRow['name'] = $aRow['FLD_NAME'];
|
|
||||||
$aTempRow['gridIndex'] = $aRow['index'];
|
|
||||||
$aTempRow['fieldType'] = 'PM Table';
|
|
||||||
$rows[] = $aTempRow;
|
|
||||||
$oDataset->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
$result['data'] = $rows;
|
|
||||||
print G::json_encode( $result ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get rows from Fields table.
|
||||||
* @param Array $fields
|
*
|
||||||
* @return Array
|
* @param string $tabUid
|
||||||
*
|
* @return array
|
||||||
*/
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
|
function getFieldsByTabUid($tabUid)
|
||||||
|
{
|
||||||
|
$rows = [];
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->clearSelectColumns();
|
||||||
|
$criteria->setDistinct();
|
||||||
|
$criteria->addSelectColumn(FieldsPeer::FLD_NAME);
|
||||||
|
$criteria->addSelectColumn(FieldsPeer::FLD_UID);
|
||||||
|
$criteria->addSelectColumn(FieldsPeer::FLD_INDEX);
|
||||||
|
$criteria->add(FieldsPeer::ADD_TAB_UID, $tabUid, CRITERIA::EQUAL);
|
||||||
|
$criteria->add(FieldsPeer::FLD_NAME, 'APP_UID', CRITERIA::NOT_EQUAL);
|
||||||
|
$criteria->addAnd(FieldsPeer::FLD_NAME, 'APP_NUMBER', CRITERIA::NOT_EQUAL);
|
||||||
|
$criteria->addDescendingOrderByColumn('FLD_INDEX');
|
||||||
|
$dataSet = FieldsPeer::doSelectRS($criteria);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$dataSet->next();
|
||||||
|
$index = 0;
|
||||||
|
while ($row = $dataSet->getRow()) {
|
||||||
|
$row['index'] = ++$index;
|
||||||
|
$tempRow['name'] = $row['FLD_NAME'];
|
||||||
|
$tempRow['gridIndex'] = $row['index'];
|
||||||
|
$tempRow['fieldType'] = 'PM Table';
|
||||||
|
$rows[] = $tempRow;
|
||||||
|
$dataSet->next();
|
||||||
|
}
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Grid index.
|
||||||
|
*
|
||||||
|
* @param array $fields
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @see workflow/engine/methods/cases/proxyPMTablesFieldList.php
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
function calculateGridIndex($fields)
|
function calculateGridIndex($fields)
|
||||||
{
|
{
|
||||||
for ($i=0; $i<count( $fields ); $i++) {
|
for ($i=0; $i<count( $fields ); $i++) {
|
||||||
|
|||||||
@@ -1,28 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* processes_Ajax.php
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*/
|
|
||||||
try {
|
try {
|
||||||
|
// Validate the access to the actions of this file
|
||||||
|
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'load') {
|
||||||
|
// Validate if exists the session variable "PROCESS", this action is requested from case tracker and running cases
|
||||||
|
$cannotAccess = empty($_SESSION['PROCESS']);
|
||||||
|
} else {
|
||||||
|
// Validate PM_FACTORY permission
|
||||||
|
global $RBAC;
|
||||||
|
$cannotAccess = $RBAC->userCanAccess('PM_FACTORY') !== 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cannotAccess) {
|
||||||
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
|
G::header( 'Location: ../login/login' );
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$_GET = $filter->xssFilterHard($_GET);
|
$_GET = $filter->xssFilterHard($_GET);
|
||||||
$_POST = $filter->xssFilterHard($_POST);
|
$_POST = $filter->xssFilterHard($_POST);
|
||||||
@@ -693,41 +687,38 @@ try {
|
|||||||
$_REQUEST['filename'] = $filter->xssFilterHard($_REQUEST['filename']);
|
$_REQUEST['filename'] = $filter->xssFilterHard($_REQUEST['filename']);
|
||||||
global $G_PUBLISH;
|
global $G_PUBLISH;
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
global $RBAC;
|
$app = new Processes();
|
||||||
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
|
if (!$app->processExists($_REQUEST['pro_uid'])) {
|
||||||
$app = new Processes();
|
echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
|
||||||
if (!$app->processExists($_REQUEST['pro_uid'])) {
|
die;
|
||||||
echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sDir = "";
|
|
||||||
if (isset($_REQUEST['MAIN_DIRECTORY'])) {
|
|
||||||
$_REQUEST['MAIN_DIRECTORY'] = $filter->xssFilterHard($_REQUEST['MAIN_DIRECTORY']);
|
|
||||||
$sDir = $_REQUEST['MAIN_DIRECTORY'];
|
|
||||||
}
|
|
||||||
switch ($sDir) {
|
|
||||||
case 'mailTemplates':
|
|
||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
|
||||||
G::auditLog('ProcessFileManager', 'Save template (' . $_REQUEST['filename'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
|
|
||||||
break;
|
|
||||||
case 'public':
|
|
||||||
$sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
|
||||||
G::auditLog('ProcessFileManager', 'Save public template (' . $_REQUEST['filename'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$fp = fopen($sDirectory, 'w');
|
|
||||||
$content = stripslashes($_REQUEST['fcontent']);
|
|
||||||
$content = str_replace("@amp@", "&", $content);
|
|
||||||
$content = base64_decode($content);
|
|
||||||
fwrite($fp, $content);
|
|
||||||
fclose($fp);
|
|
||||||
$sDirectory = $filter->xssFilterHard($sDirectory);
|
|
||||||
echo 'saved: ' . $sDirectory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sDir = "";
|
||||||
|
if (isset($_REQUEST['MAIN_DIRECTORY'])) {
|
||||||
|
$_REQUEST['MAIN_DIRECTORY'] = $filter->xssFilterHard($_REQUEST['MAIN_DIRECTORY']);
|
||||||
|
$sDir = $_REQUEST['MAIN_DIRECTORY'];
|
||||||
|
}
|
||||||
|
switch ($sDir) {
|
||||||
|
case 'mailTemplates':
|
||||||
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
||||||
|
G::auditLog('ProcessFileManager', 'Save template (' . $_REQUEST['filename'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
|
||||||
|
break;
|
||||||
|
case 'public':
|
||||||
|
$sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
||||||
|
G::auditLog('ProcessFileManager', 'Save public template (' . $_REQUEST['filename'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$fp = fopen($sDirectory, 'w');
|
||||||
|
$content = stripslashes($_REQUEST['fcontent']);
|
||||||
|
$content = str_replace("@amp@", "&", $content);
|
||||||
|
$content = base64_decode($content);
|
||||||
|
fwrite($fp, $content);
|
||||||
|
fclose($fp);
|
||||||
|
$sDirectory = $filter->xssFilterHard($sDirectory);
|
||||||
|
echo 'saved: ' . $sDirectory;
|
||||||
break;
|
break;
|
||||||
case 'getSessid':
|
case 'getSessid':
|
||||||
if (isset($_SESSION['USER_LOGGED'])) {
|
if (isset($_SESSION['USER_LOGGED'])) {
|
||||||
|
|||||||
@@ -4,14 +4,11 @@ $RBAC->allows(basename(__FILE__), $_GET['MAIN_DIRECTORY']);
|
|||||||
|
|
||||||
$mainDirectory = !empty($_GET['MAIN_DIRECTORY']) ? $_GET['MAIN_DIRECTORY'] : '';
|
$mainDirectory = !empty($_GET['MAIN_DIRECTORY']) ? $_GET['MAIN_DIRECTORY'] : '';
|
||||||
$proUid = !empty($_GET['PRO_UID']) ? $_GET['PRO_UID'] : '';
|
$proUid = !empty($_GET['PRO_UID']) ? $_GET['PRO_UID'] : '';
|
||||||
$currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? realpath($_GET['CURRENT_DIRECTORY']) . PATH_SEP : '';
|
$currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : '';
|
||||||
$file = !empty($_GET['FILE']) ? realpath($_GET['FILE']) : '';
|
$file = !empty($_GET['FILE']) ? $_GET['FILE'] : '';
|
||||||
$extension = (!empty($_GET['sFilextension']) && $_GET['sFilextension'] === 'javascript') ? '.js' : '';
|
$extension = (!empty($_GET['sFilextension']) && $_GET['sFilextension'] === 'javascript') ? '.js' : '';
|
||||||
|
|
||||||
//validated process exists, return throw if not exists.
|
// Validate the main directory
|
||||||
$process = new Process();
|
|
||||||
$process->load($proUid);
|
|
||||||
|
|
||||||
switch ($mainDirectory) {
|
switch ($mainDirectory) {
|
||||||
case 'mailTemplates':
|
case 'mailTemplates':
|
||||||
$directory = PATH_DATA_MAILTEMPLATES;
|
$directory = PATH_DATA_MAILTEMPLATES;
|
||||||
@@ -24,9 +21,20 @@ switch ($mainDirectory) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate if process exists, an exception is throwed if not exists
|
||||||
|
$process = new Process();
|
||||||
|
$process->load($proUid);
|
||||||
|
|
||||||
|
// Validate directory and file requested
|
||||||
|
$filter = new InputFilter();
|
||||||
|
$currentDirectory = $filter->validatePath($currentDirectory);
|
||||||
|
$file = $filter->validatePath($file);
|
||||||
|
|
||||||
|
// Build requested path
|
||||||
$directory .= $proUid . PATH_SEP . $currentDirectory;
|
$directory .= $proUid . PATH_SEP . $currentDirectory;
|
||||||
$file .= $extension;
|
$file .= $extension;
|
||||||
|
|
||||||
|
// Stream the file if path exists
|
||||||
if (file_exists($directory . $file)) {
|
if (file_exists($directory . $file)) {
|
||||||
G::streamFile($directory . $file, true);
|
G::streamFile($directory . $file, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1603,3 +1603,73 @@ padding:3px 3px 3px 5px;
|
|||||||
white-space:normal;
|
white-space:normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.cancelSummary {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
border:1px #ccc solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #337ab7;
|
||||||
|
border:1px #2e6da4 solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary .x-btn-text {
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 28px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.cancelSummary .x-btn-text {
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 25px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.claimCaseSummary td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #337ab7;
|
||||||
|
border-color: #2e6da4;
|
||||||
|
}
|
||||||
|
.claimCaseSummary tbody:hover td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #286090;
|
||||||
|
border-color: #204d74;
|
||||||
|
}
|
||||||
|
.cancelSummary td {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.cancelSummary tbody:hover td {
|
||||||
|
color: #333333;
|
||||||
|
background: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
|
.cancelSummary .claimCaseSummary {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
background-image: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.navPanelBottom .x-toolbar-cell {
|
||||||
|
clear: both;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
@@ -1795,3 +1795,73 @@ white-space:normal;
|
|||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cancelSummary {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
border:1px #ccc solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #337ab7;
|
||||||
|
border:1px #2e6da4 solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary .x-btn-text {
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 28px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.cancelSummary .x-btn-text {
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 25px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.claimCaseSummary td {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #337ab7;
|
||||||
|
border-color: #2e6da4;
|
||||||
|
}
|
||||||
|
.claimCaseSummary tbody:hover td {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #286090;
|
||||||
|
border-color: #204d74;
|
||||||
|
}
|
||||||
|
.cancelSummary td {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.cancelSummary tbody:hover td {
|
||||||
|
color: #333333;
|
||||||
|
background-color: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
|
.cancelSummary .claimCaseSummary {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
background-image: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.navPanelBottom .x-toolbar-cell {
|
||||||
|
clear: both;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1631,3 +1631,74 @@ td.x-cnotes-label {
|
|||||||
color:#848484;
|
color:#848484;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.cancelSummary {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
border:1px #ccc solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #337ab7;
|
||||||
|
border:1px #2e6da4 solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary .x-btn-text {
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 28px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.cancelSummary .x-btn-text {
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 25px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.claimCaseSummary td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #337ab7;
|
||||||
|
border-color: #2e6da4;
|
||||||
|
}
|
||||||
|
.claimCaseSummary tbody:hover td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #286090;
|
||||||
|
border-color: #204d74;
|
||||||
|
}
|
||||||
|
.cancelSummary td {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.cancelSummary tbody:hover td {
|
||||||
|
color: #333333;
|
||||||
|
background: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
|
.cancelSummary .claimCaseSummary {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
background-image: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.navPanelBottom .x-toolbar-cell {
|
||||||
|
clear: both;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
@@ -1176,3 +1176,74 @@ td.x-cnotes-label {
|
|||||||
font: 11px arial,tahoma,helvetica,sans-serif;
|
font: 11px arial,tahoma,helvetica,sans-serif;
|
||||||
color: #465070;
|
color: #465070;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.cancelSummary {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
border:1px #ccc solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #337ab7;
|
||||||
|
border:1px #2e6da4 solid;
|
||||||
|
}
|
||||||
|
.claimCaseSummary .x-btn-text {
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 28px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.cancelSummary .x-btn-text {
|
||||||
|
padding: 6px 6px 6px 6px;
|
||||||
|
height: 25px !important;
|
||||||
|
-moz-border-radius: 20px;
|
||||||
|
-webkit-border-radius: 20px;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.claimCaseSummary td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #337ab7;
|
||||||
|
border-color: #2e6da4;
|
||||||
|
}
|
||||||
|
.claimCaseSummary tbody:hover td {
|
||||||
|
color: #ffffff;
|
||||||
|
background: #286090;
|
||||||
|
border-color: #204d74;
|
||||||
|
}
|
||||||
|
.cancelSummary td {
|
||||||
|
color: #333;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.cancelSummary tbody:hover td {
|
||||||
|
color: #333333;
|
||||||
|
background: #e6e6e6;
|
||||||
|
border-color: #adadad;
|
||||||
|
}
|
||||||
|
.cancelSummary .claimCaseSummary {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px 12px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.42857143;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
-ms-touch-action: manipulation;
|
||||||
|
touch-action: manipulation;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
background-image: none;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.navPanelBottom .x-toolbar-cell {
|
||||||
|
clear: both;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
@@ -61,6 +61,8 @@ class Cases
|
|||||||
{
|
{
|
||||||
private $formatFieldNameInUppercase = true;
|
private $formatFieldNameInUppercase = true;
|
||||||
private $messageResponse = [];
|
private $messageResponse = [];
|
||||||
|
private $solr = null;
|
||||||
|
private $solrEnv = null;
|
||||||
const MB_IN_KB = 1024;
|
const MB_IN_KB = 1024;
|
||||||
const UNIT_MB = 'MB';
|
const UNIT_MB = 'MB';
|
||||||
|
|
||||||
@@ -237,26 +239,11 @@ class Cases
|
|||||||
public function getListCounters($userUid, array $arrayType)
|
public function getListCounters($userUid, array $arrayType)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$solrEnabled = false;
|
|
||||||
$solrConf = System::solrEnv();
|
|
||||||
|
|
||||||
if ($solrConf !== false) {
|
|
||||||
$ApplicationSolrIndex = new AppSolr(
|
|
||||||
$solrConf['solr_enabled'],
|
|
||||||
$solrConf['solr_host'],
|
|
||||||
$solrConf['solr_instance']
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
|
|
||||||
$solrEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$appCacheView = new AppCacheView();
|
$appCacheView = new AppCacheView();
|
||||||
|
|
||||||
if ($solrEnabled) {
|
if ($this->isSolrEnabled()) {
|
||||||
$arrayListCounter = array_merge(
|
$arrayListCounter = array_merge(
|
||||||
$ApplicationSolrIndex->getCasesCount($userUid),
|
$this->solr->getCasesCount($userUid),
|
||||||
$appCacheView->getAllCounters(['completed', 'cancelled'], $userUid)
|
$appCacheView->getAllCounters(['completed', 'cancelled'], $userUid)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -422,6 +409,28 @@ class Cases
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if Solr is Enabled
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function isSolrEnabled()
|
||||||
|
{
|
||||||
|
$solrEnabled = false;
|
||||||
|
$this->solrEnv = !empty($this->solrEnv) ? $this->solrEnv : System::solrEnv();
|
||||||
|
if ($this->solrEnv !== false) {
|
||||||
|
$this->solr = !empty($this->solr) ? $this->solr : new AppSolr(
|
||||||
|
$this->solrEnv['solr_enabled'],
|
||||||
|
$this->solrEnv['solr_host'],
|
||||||
|
$this->solrEnv['solr_instance']
|
||||||
|
);
|
||||||
|
if ($this->solr->isSolrEnabled() && $this->solrEnv["solr_enabled"] == true) {
|
||||||
|
$solrEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $solrEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data of a Case
|
* Get data of a Case
|
||||||
*
|
*
|
||||||
@@ -434,21 +443,11 @@ class Cases
|
|||||||
public function getCaseInfo($applicationUid, $userUid)
|
public function getCaseInfo($applicationUid, $userUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$solrEnabled = 0;
|
if ($this->isSolrEnabled()) {
|
||||||
if (($solrEnv = System::solrEnv()) !== false) {
|
|
||||||
$appSolr = new AppSolr(
|
|
||||||
$solrEnv["solr_enabled"],
|
|
||||||
$solrEnv["solr_host"],
|
|
||||||
$solrEnv["solr_instance"]
|
|
||||||
);
|
|
||||||
if ($appSolr->isSolrEnabled() && $solrEnv["solr_enabled"] == true) {
|
|
||||||
//Check if there are missing records to reindex and reindex them
|
|
||||||
$appSolr->synchronizePendingApplications();
|
|
||||||
$solrEnabled = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($solrEnabled == 1) {
|
|
||||||
try {
|
try {
|
||||||
|
//Check if there are missing records to reindex and reindex them
|
||||||
|
$this->solr->synchronizePendingApplications();
|
||||||
|
|
||||||
$arrayData = array();
|
$arrayData = array();
|
||||||
$delegationIndexes = array();
|
$delegationIndexes = array();
|
||||||
$columsToInclude = array("APP_UID");
|
$columsToInclude = array("APP_UID");
|
||||||
@@ -464,7 +463,7 @@ class Cases
|
|||||||
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
$columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes);
|
||||||
$solrRequestData = EntitySolrRequestData::createForRequestPagination(
|
$solrRequestData = EntitySolrRequestData::createForRequestPagination(
|
||||||
array(
|
array(
|
||||||
"workspace" => $solrEnv["solr_instance"],
|
"workspace" => $this->solrEnv["solr_instance"],
|
||||||
"startAfter" => 0,
|
"startAfter" => 0,
|
||||||
"pageSize" => 1000,
|
"pageSize" => 1000,
|
||||||
"searchText" => $solrSearchText,
|
"searchText" => $solrSearchText,
|
||||||
@@ -476,7 +475,7 @@ class Cases
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
//Use search index to return list of cases
|
//Use search index to return list of cases
|
||||||
$searchIndex = new BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]);
|
$searchIndex = new BpmnEngineServicesSearchIndex($this->solr->isSolrEnabled(), $this->solrEnv["solr_host"]);
|
||||||
//Execute query
|
//Execute query
|
||||||
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
||||||
//Get the missing data from database
|
//Get the missing data from database
|
||||||
@@ -484,7 +483,7 @@ class Cases
|
|||||||
foreach ($solrQueryResult->aaData as $i => $data) {
|
foreach ($solrQueryResult->aaData as $i => $data) {
|
||||||
$arrayApplicationUid[] = $data["APP_UID"];
|
$arrayApplicationUid[] = $data["APP_UID"];
|
||||||
}
|
}
|
||||||
$aaappsDBData = $appSolr->getListApplicationDelegationData($arrayApplicationUid);
|
$aaappsDBData = $this->solr->getListApplicationDelegationData($arrayApplicationUid);
|
||||||
foreach ($solrQueryResult->aaData as $i => $data) {
|
foreach ($solrQueryResult->aaData as $i => $data) {
|
||||||
//Initialize array
|
//Initialize array
|
||||||
$delIndexes = array(); //Store all the delegation indexes
|
$delIndexes = array(); //Store all the delegation indexes
|
||||||
@@ -513,7 +512,7 @@ class Cases
|
|||||||
$aRow["APP_UID"] = $data["APP_UID"];
|
$aRow["APP_UID"] = $data["APP_UID"];
|
||||||
//Get delegation data from DB
|
//Get delegation data from DB
|
||||||
//Filter data from db
|
//Filter data from db
|
||||||
$indexes = $appSolr->aaSearchRecords($aaappsDBData, array(
|
$indexes = $this->solr->aaSearchRecords($aaappsDBData, array(
|
||||||
"APP_UID" => $applicationUid,
|
"APP_UID" => $applicationUid,
|
||||||
"DEL_INDEX" => $delIndex
|
"DEL_INDEX" => $delIndex
|
||||||
));
|
));
|
||||||
@@ -662,6 +661,31 @@ class Cases
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a sub-process case
|
||||||
|
*
|
||||||
|
* @param string $applicationUid Unique Case Id
|
||||||
|
* @param string $userUid Unique User Id
|
||||||
|
*
|
||||||
|
* @return array Return an array with information of Cases
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function getCaseInfoSubProcess($applicationUid, $userUid)
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = [];
|
||||||
|
$subApplication = new SubApplication();
|
||||||
|
$data = $subApplication->loadByAppUidParent($applicationUid);
|
||||||
|
foreach ($data as $item) {
|
||||||
|
$response[] = $this->getCaseInfo($item['APP_UID'], $userUid);
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data Task Case
|
* Get data Task Case
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -415,6 +415,7 @@ class Light
|
|||||||
|
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
$Fields = $oCase->loadCase($cas_uid);
|
$Fields = $oCase->loadCase($cas_uid);
|
||||||
|
//@todo Find a better way to define session variables
|
||||||
$_SESSION["APPLICATION"] = $cas_uid;
|
$_SESSION["APPLICATION"] = $cas_uid;
|
||||||
$_SESSION["PROCESS"] = $prj_uid;
|
$_SESSION["PROCESS"] = $prj_uid;
|
||||||
$_SESSION["TASK"] = $act_uid;
|
$_SESSION["TASK"] = $act_uid;
|
||||||
@@ -453,6 +454,7 @@ class Light
|
|||||||
try {
|
try {
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
$Fields = $oCase->loadCase($app_uid);
|
$Fields = $oCase->loadCase($app_uid);
|
||||||
|
//@todo Find a better way to define session variables
|
||||||
$_SESSION["APPLICATION"] = $app_uid;
|
$_SESSION["APPLICATION"] = $app_uid;
|
||||||
$_SESSION["PROCESS"] = $Fields['PRO_UID'];
|
$_SESSION["PROCESS"] = $Fields['PRO_UID'];
|
||||||
$_SESSION["TASK"] = $tas_uid;
|
$_SESSION["TASK"] = $tas_uid;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace ProcessMaker\BusinessModel;
|
|||||||
|
|
||||||
use AdditionalTables;
|
use AdditionalTables;
|
||||||
use AdditionalTablesPeer;
|
use AdditionalTablesPeer;
|
||||||
|
use Configurations;
|
||||||
use G;
|
use G;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
@@ -329,6 +330,11 @@ class ReportTable
|
|||||||
* @param array $arrayData
|
* @param array $arrayData
|
||||||
* @param bool $flagAlterTable
|
* @param bool $flagAlterTable
|
||||||
*
|
*
|
||||||
|
* @see pmTablesProxy->save()
|
||||||
|
* @see ProcessMaker\BusinessModel\ReportTable->createStructureOfTables()
|
||||||
|
* @see Table->validateTableBeforeUpdate()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Report_Tables
|
||||||
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function saveStructureOfTable($arrayData, $flagAlterTable = true)
|
public function saveStructureOfTable($arrayData, $flagAlterTable = true)
|
||||||
@@ -560,6 +566,7 @@ class ReportTable
|
|||||||
//Delete Report Table
|
//Delete Report Table
|
||||||
$resultDeleteReportTable = $pmTablesProxy->delete($obj);
|
$resultDeleteReportTable = $pmTablesProxy->delete($obj);
|
||||||
}
|
}
|
||||||
|
$this->updateConfigurationCaseList($additionalTableUid, $columns);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$buildResult = ob_get_contents();
|
$buildResult = ob_get_contents();
|
||||||
|
|
||||||
@@ -578,11 +585,126 @@ class ReportTable
|
|||||||
|
|
||||||
$result->trace = $e->getTraceAsString();
|
$result->trace = $e->getTraceAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Custom Case List fields configuration.
|
||||||
|
*
|
||||||
|
* @param array $columns
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\BusinessModel\ReportTable->saveStructureOfTable()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Report_Tables
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
|
public function updateConfigurationCaseList($addTabUid, $columns)
|
||||||
|
{
|
||||||
|
$actions = [
|
||||||
|
"todo", "draft", "sent", "unassigned", "paused", "completed", "cancelled"
|
||||||
|
];
|
||||||
|
$conf = new Configurations();
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$confCasesList = $conf->loadObject("casesList", $action, "", "", "");
|
||||||
|
$sw = is_array($confCasesList) && !empty($confCasesList) && !empty($confCasesList['PMTable']) && $confCasesList['PMTable'] === $addTabUid;
|
||||||
|
if ($sw) {
|
||||||
|
$this->addFieldsToCustomCaseList($confCasesList['first']['data'], $confCasesList['second']['data'], $columns);
|
||||||
|
$this->removeFieldsFromCustomCaseList($confCasesList['first']['data'], $columns);
|
||||||
|
$this->removeFieldsFromCustomCaseList($confCasesList['second']['data'], $columns);
|
||||||
|
$conf->saveObject($confCasesList, "casesList", $action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add fields to Custom Case List.
|
||||||
|
* @param array $data1
|
||||||
|
* @param array $data2
|
||||||
|
* @param array $columns
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\BusinessModel\ReportTable->saveStructureOfTable()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Report_Tables
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
|
public function addFieldsToCustomCaseList(&$data1, $data2, $columns)
|
||||||
|
{
|
||||||
|
$all = [];
|
||||||
|
$type = 'PM Table';
|
||||||
|
$this->loadFieldTypeValues($data1, $all, $type);
|
||||||
|
$this->loadFieldTypeValues($data2, $all, $type);
|
||||||
|
foreach ($all as $value) {
|
||||||
|
foreach ($columns as $index => $column) {
|
||||||
|
if ($value['name'] === $column->field_name) {
|
||||||
|
unset($columns[$index]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$defaults = ["APP_UID", "APP_NUMBER", "APP_STATUS"];
|
||||||
|
foreach ($defaults as $value) {
|
||||||
|
foreach ($columns as $index => $column) {
|
||||||
|
if ($value === $column->field_name) {
|
||||||
|
unset($columns[$index]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($columns as $value) {
|
||||||
|
$data1[] = [
|
||||||
|
"name" => $column->field_name,
|
||||||
|
"fieldType" => $type
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load field type values.
|
||||||
|
*
|
||||||
|
* @param array $fields
|
||||||
|
* @param array $all
|
||||||
|
* @param string $type
|
||||||
|
*/
|
||||||
|
private function loadFieldTypeValues($fields, array &$all, $type)
|
||||||
|
{
|
||||||
|
foreach ($fields as $value) {
|
||||||
|
if ($value['fieldType'] === $type) {
|
||||||
|
$all[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove fields from Custom Cases List.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @param array $columns
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\BusinessModel\ReportTable->saveStructureOfTable()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Report_Tables
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases_List_Builder#Installation_and_Configuration
|
||||||
|
*/
|
||||||
|
public function removeFieldsFromCustomCaseList(&$data, $columns)
|
||||||
|
{
|
||||||
|
$n = count($data);
|
||||||
|
for ($key = 0; $key < $n; $key++) {
|
||||||
|
if ($data[$key]['fieldType'] === 'PM Table') {
|
||||||
|
$remove = true;
|
||||||
|
foreach ($columns as $column) {
|
||||||
|
if ($data[$key]['name'] === $column->field_name) {
|
||||||
|
$remove = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($remove === true) {
|
||||||
|
unset($data[$key]);
|
||||||
|
$data = array_values($data);
|
||||||
|
$key = 0;
|
||||||
|
$n = count($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the structure of tables
|
* Create the structure of tables
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use PMScript;
|
|||||||
use ResultSet;
|
use ResultSet;
|
||||||
use ScriptTaskPeer;
|
use ScriptTaskPeer;
|
||||||
use TaskPeer;
|
use TaskPeer;
|
||||||
|
use Triggers as ModelTriggers;
|
||||||
use TriggersPeer;
|
use TriggersPeer;
|
||||||
|
|
||||||
class ScriptTask
|
class ScriptTask
|
||||||
@@ -602,13 +603,16 @@ class ScriptTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute Script
|
* Execute the trigger related to the script task
|
||||||
*
|
*
|
||||||
* @param string $activityUid Unique id of task
|
* @param string $activityUid Unique id of task
|
||||||
* @param array $arrayApplicationData Case data
|
* @param array $arrayApplicationData Case data
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Derivation::derivate()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Tasks#ScriptTask
|
||||||
*/
|
*/
|
||||||
public function execScriptByActivityUid($activityUid, array $arrayApplicationData)
|
public function execScriptByActivityUid($activityUid, array $arrayApplicationData)
|
||||||
{
|
{
|
||||||
@@ -625,34 +629,35 @@ class ScriptTask
|
|||||||
if ($rsCriteria->next()) {
|
if ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
$scriptTasObjUid = $row["SCRTAS_OBJ_UID"];
|
$scriptTasObjUid = $row["SCRTAS_OBJ_UID"];
|
||||||
$trigger = TriggersPeer::retrieveByPK($scriptTasObjUid);
|
$trigger = new ModelTriggers();
|
||||||
|
$triggersList[] = $trigger->load($scriptTasObjUid);
|
||||||
|
|
||||||
if (!is_null($trigger)) {
|
if (!empty($triggersList)){
|
||||||
//We will be update the status before execute the trigger related to the script task
|
|
||||||
$case = new ClassesCases();
|
$case = new ClassesCases();
|
||||||
$result = $case->updateCase($arrayApplicationData["APP_UID"], $arrayApplicationData);
|
//We will be update the status before execute the trigger related to the script task
|
||||||
|
$case->updateCase($arrayApplicationData["APP_UID"], $arrayApplicationData);
|
||||||
|
|
||||||
//Some Pmf functions uses this global variable $oPMScript for review the aFields defined
|
//Execute the trigger defined in the script task
|
||||||
global $oPMScript;
|
$arrayApplicationData['APP_DATA'] = $case->executeTriggerFromList(
|
||||||
$oPMScript = new PMScript();
|
$triggersList,
|
||||||
$oPMScript->setDataTrigger($trigger->toArray(BasePeer::TYPE_FIELDNAME));
|
$arrayApplicationData['APP_DATA'],
|
||||||
$oPMScript->setFields($arrayApplicationData["APP_DATA"]);
|
'SCRIPT_TASK',
|
||||||
$oPMScript->setScript($trigger->getTriWebbot());
|
'',
|
||||||
$oPMScript->setExecutedOn(PMScript::SCRIPT_TASK);
|
''
|
||||||
$oPMScript->execute();
|
);
|
||||||
|
|
||||||
if (isset($oPMScript->aFields["__ERROR__"])) {
|
$case->updateCase($arrayApplicationData['APP_UID'], $arrayApplicationData);
|
||||||
G::log("Case Uid: " . $arrayApplicationData["APP_UID"] . ", Error: " . $oPMScript->aFields["__ERROR__"],
|
|
||||||
|
if (isset($arrayApplicationData['APP_DATA']['__ERROR__'])) {
|
||||||
|
G::log("Case Uid: " . $arrayApplicationData["APP_UID"] . ", Error: " . $arrayApplicationData['APP_DATA']['__ERROR__'],
|
||||||
PATH_DATA, "ScriptTask.log");
|
PATH_DATA, "ScriptTask.log");
|
||||||
}
|
}
|
||||||
$arrayApplicationData["APP_DATA"] = $oPMScript->aFields;
|
|
||||||
$result = $case->updateCase($arrayApplicationData["APP_UID"], $arrayApplicationData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $arrayApplicationData["APP_DATA"];
|
return $arrayApplicationData['APP_DATA'];
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1427,4 +1427,31 @@ class Cases extends Api
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return information for sub process cases
|
||||||
|
*
|
||||||
|
* @url GET /:app_uid/sub-process-cases
|
||||||
|
*
|
||||||
|
* @param string $app_uid {@min 32}{@max 32}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@permission PM_CASES}
|
||||||
|
*/
|
||||||
|
public function doGetCaseSubProcess($app_uid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$case = new BmCases();
|
||||||
|
$case->setFormatFieldNameInUppercase(false);
|
||||||
|
|
||||||
|
$caseInfo = $case->getCaseInfoSubProcess($app_uid, $this->getUserId());
|
||||||
|
$caseInfo = DateTime::convertUtcToIso8601($caseInfo, $this->arrayFieldIso8601);
|
||||||
|
|
||||||
|
return $caseInfo;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1038,6 +1038,7 @@ class Light extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
|
//@todo Find a better way to define session variables
|
||||||
$_SESSION["APPLICATION"] = $app_uid;
|
$_SESSION["APPLICATION"] = $app_uid;
|
||||||
$_SESSION["PROCESS"] = $pro_uid;
|
$_SESSION["PROCESS"] = $pro_uid;
|
||||||
//$_SESSION["TASK"] = "";
|
//$_SESSION["TASK"] = "";
|
||||||
@@ -2009,6 +2010,7 @@ class Light extends Api
|
|||||||
if ($alreadyRouted) {
|
if ($alreadyRouted) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED')));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED')));
|
||||||
}
|
}
|
||||||
|
//@todo Find a better way to define session variables
|
||||||
$_SESSION["APPLICATION"] = $app_uid;
|
$_SESSION["APPLICATION"] = $app_uid;
|
||||||
$_SESSION["PROCESS"] = $pro_uid;
|
$_SESSION["PROCESS"] = $pro_uid;
|
||||||
$_SESSION["INDEX"] = $app_index;
|
$_SESSION["INDEX"] = $app_index;
|
||||||
|
|||||||
@@ -309,6 +309,7 @@ function pauseCase(date){
|
|||||||
buttons: [{
|
buttons: [{
|
||||||
text: _('ID_OK'),
|
text: _('ID_OK'),
|
||||||
handler: function(){
|
handler: function(){
|
||||||
|
this.setDisabled(true);
|
||||||
if (Ext.getCmp('noteReason').getValue() != '') {
|
if (Ext.getCmp('noteReason').getValue() != '') {
|
||||||
var noteReasonTxt = _('ID_CASE_PAUSE_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
|
var noteReasonTxt = _('ID_CASE_PAUSE_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ Ext.onReady(function () {
|
|||||||
|
|
||||||
success: function (response, opts)
|
success: function (response, opts)
|
||||||
{
|
{
|
||||||
var dataResponse = eval("(" + response.responseText + ")"); //json
|
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||||
|
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case "FIELD_SET":
|
case "FIELD_SET":
|
||||||
@@ -85,8 +85,11 @@ Ext.onReady(function () {
|
|||||||
break;
|
break;
|
||||||
case "FIELD_SAVE":
|
case "FIELD_SAVE":
|
||||||
configDefaultResponseText = response.responseText;
|
configDefaultResponseText = response.responseText;
|
||||||
Ext.Msg.alert(_("ID_INFO"), _("ID_SAVED"));
|
var windowAlert = Ext.Msg.alert(_("ID_INFO"), _("ID_SAVED"));
|
||||||
location.reload(true);
|
fieldSet(dataResponse);
|
||||||
|
setTimeout(function () {
|
||||||
|
windowAlert.getDialog().close();
|
||||||
|
}, 500);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -150,75 +153,55 @@ Ext.onReady(function () {
|
|||||||
{name: 'align', mapping : 'align'}
|
{name: 'align', mapping : 'align'}
|
||||||
];
|
];
|
||||||
|
|
||||||
//Dropdown to select the PMTable
|
//Dropdown to select the PMTable
|
||||||
var PmTableStore = new Ext.data.JsonStore({
|
var PmTableStore = new Ext.data.JsonStore({
|
||||||
root : 'data',
|
root: 'data',
|
||||||
url : 'proxyPMTablesList',
|
url: 'proxyPMTablesList',
|
||||||
totalProperty : 'totalCount',
|
totalProperty: 'totalCount',
|
||||||
idProperty : 'gridIndex',
|
idProperty: 'gridIndex',
|
||||||
remoteSort : false, //true,
|
remoteSort: false, //true,
|
||||||
autoLoad : false,
|
autoLoad: false,
|
||||||
fields : [
|
fields: [
|
||||||
'ADD_TAB_UID', 'ADD_TAB_NAME'
|
'ADD_TAB_UID', 'ADD_TAB_NAME'
|
||||||
],
|
],
|
||||||
listeners : {load: function() {
|
listeners: {
|
||||||
tabs.setActiveTab(tabIndex);
|
load: function () {
|
||||||
}}
|
tabs.setActiveTab(tabIndex);
|
||||||
});
|
|
||||||
|
|
||||||
// create the Data Store to list PMTables in the dropdown
|
|
||||||
var pmTablesDropdown = new Ext.form.ComboBox ({
|
|
||||||
width : '180',
|
|
||||||
xtype : 'combo',
|
|
||||||
emptyText: _("ID_EMPTY_PMTABLE"),
|
|
||||||
displayField : 'ADD_TAB_NAME',
|
|
||||||
valueField : 'ADD_TAB_UID',
|
|
||||||
triggerAction: 'all',
|
|
||||||
store : PmTableStore,
|
|
||||||
listeners: {
|
|
||||||
'select': function() {
|
|
||||||
var tableUid = this.value;
|
|
||||||
Ext.Ajax.request({
|
|
||||||
url: 'proxyPMTablesFieldList',
|
|
||||||
success: function(response) {
|
|
||||||
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
|
||||||
var rec = Ext.data.Record.create(pmFields);
|
|
||||||
//alert(firstGrid.store);
|
|
||||||
var index;
|
|
||||||
var record;
|
|
||||||
var count = firstGrid.store.getTotalCount();
|
|
||||||
|
|
||||||
// removing all the PM Table fields from the first grid
|
|
||||||
do {
|
|
||||||
index = firstGrid.store.find('fieldType','PM Table');
|
|
||||||
record = firstGrid.store.getAt(index);
|
|
||||||
if (index>=0) {
|
|
||||||
firstGrid.store.remove(record);
|
|
||||||
}
|
|
||||||
} while (index>=0);
|
|
||||||
|
|
||||||
// removing all the PM Table fields from the second grid
|
|
||||||
do {
|
|
||||||
index = secondGrid.store.find('fieldType','PM Table');
|
|
||||||
record = secondGrid.store.getAt(index);
|
|
||||||
if (index>=0) {
|
|
||||||
secondGrid.store.remove(record);
|
|
||||||
}
|
|
||||||
} while (index>=0);
|
|
||||||
|
|
||||||
for (var i = 0; i <= dataResponse.data.length-1; i++) {
|
|
||||||
var d = new rec( dataResponse.data[i] );
|
|
||||||
firstGrid.store.add(d);
|
|
||||||
}
|
}
|
||||||
firstGrid.store.commitChanges();
|
}
|
||||||
},
|
});
|
||||||
failure: function(){},
|
|
||||||
params: {xaction: 'getFieldsFromPMTable', table: tableUid }
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
// create the Data Store to list PMTables in the dropdown
|
||||||
}
|
var pmTablesDropdown = new Ext.form.ComboBox({
|
||||||
});
|
width: '180',
|
||||||
|
xtype: 'combo',
|
||||||
|
emptyText: _("ID_EMPTY_PMTABLE"),
|
||||||
|
displayField: 'ADD_TAB_NAME',
|
||||||
|
valueField: 'ADD_TAB_UID',
|
||||||
|
triggerAction: 'all',
|
||||||
|
store: PmTableStore,
|
||||||
|
listeners: {
|
||||||
|
focus: function(){
|
||||||
|
PmTableStore.load();
|
||||||
|
},
|
||||||
|
'select': function () {
|
||||||
|
var tableUid = this.value;
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'proxyPMTablesFieldList',
|
||||||
|
params: {
|
||||||
|
xaction: 'FIELD_SET',
|
||||||
|
action: currentAction,
|
||||||
|
table: tableUid
|
||||||
|
},
|
||||||
|
success: function (response) {
|
||||||
|
var dataResponse = Ext.util.JSON.decode(response.responseText);
|
||||||
|
fieldSet(dataResponse);
|
||||||
|
},
|
||||||
|
failure: function () {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// COMPONENT DEPRECATED remove it in the next revision of the enterprise plugin
|
// COMPONENT DEPRECATED remove it in the next revision of the enterprise plugin
|
||||||
// create the Dropdown for rows per page
|
// create the Dropdown for rows per page
|
||||||
@@ -501,6 +484,20 @@ Ext.onReady(function () {
|
|||||||
height : screen.height-245,
|
height : screen.height-245,
|
||||||
layout : 'hbox',
|
layout : 'hbox',
|
||||||
layoutConfig : {align : 'stretch'},
|
layoutConfig : {align : 'stretch'},
|
||||||
|
listeners: {
|
||||||
|
render: function (target) {
|
||||||
|
var el;
|
||||||
|
if (target.container && target.container.dom) {
|
||||||
|
el = target.container.dom;
|
||||||
|
el.style.cssText = 'overflow:hidden;position:absolute;top:28px;bottom:0px;left:0px;right:0px;';
|
||||||
|
target.setHeight(el.clientHeight);
|
||||||
|
Ext.EventManager.onWindowResize(function () {
|
||||||
|
mainPanel.setHeight(el.clientHeight);
|
||||||
|
mainPanel.doLayout();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
tbar : new Ext.Toolbar({
|
tbar : new Ext.Toolbar({
|
||||||
items: [
|
items: [
|
||||||
_("ID_PM_TABLE"),
|
_("ID_PM_TABLE"),
|
||||||
@@ -573,7 +570,7 @@ Ext.onReady(function () {
|
|||||||
text: _("ID_RESET"),
|
text: _("ID_RESET"),
|
||||||
handler: function ()
|
handler: function ()
|
||||||
{
|
{
|
||||||
var dataResponse = eval("(" + configDefaultResponseText + ")"); //json
|
var dataResponse = Ext.util.JSON.decode(configDefaultResponseText);
|
||||||
|
|
||||||
fieldSet(dataResponse);
|
fieldSet(dataResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
var Actions = {};
|
var Actions = {},
|
||||||
var showCaseNavigatorPanel;
|
hideCaseNavigatorPanel,
|
||||||
var hideCaseNavigatorPanel;
|
informationMenu,
|
||||||
var informationMenu;
|
caseMenuOpen = false,
|
||||||
var caseMenuOpen = false;
|
menuSelectedTitle = [],
|
||||||
var menuSelectedTitle = [];
|
_ENV_CURRENT_DATE,
|
||||||
var _ENV_CURRENT_DATE;
|
winTree,
|
||||||
var winTree;
|
buttonCancel,
|
||||||
|
buttonClaimCase,
|
||||||
|
navPanelBottom,
|
||||||
|
navPanel;
|
||||||
|
|
||||||
historyGridListChangeLogGlobal = {};
|
historyGridListChangeLogGlobal = {};
|
||||||
historyGridListChangeLogGlobal.idHistory = '';
|
historyGridListChangeLogGlobal.idHistory = '';
|
||||||
@@ -351,109 +354,217 @@ Ext.onReady(function(){
|
|||||||
setNode(idfirstform);
|
setNode(idfirstform);
|
||||||
}
|
}
|
||||||
|
|
||||||
var navPanelWest = {
|
var navPanelWest = {
|
||||||
id: 'navPanelWest',
|
id: 'navPanelWest',
|
||||||
region: 'west',
|
region: 'west',
|
||||||
xtype:'panel',
|
xtype:'panel',
|
||||||
width: 250,
|
width: 250,
|
||||||
height: 500,
|
height: 500,
|
||||||
maxSize: 400,
|
maxSize: 400,
|
||||||
split: true,
|
split: true,
|
||||||
collapsible: false,
|
collapsible: false,
|
||||||
margins: '0 0 0 0',
|
margins: '0 0 0 0',
|
||||||
items:[casesStepTree]
|
items:[casesStepTree]
|
||||||
}
|
|
||||||
|
|
||||||
var fnChangeStatus =function(){
|
|
||||||
alert('loaded');
|
|
||||||
}
|
|
||||||
|
|
||||||
var screenWidth = (PMExt.getBrowser().screen.width-140).toString() + 'px';
|
|
||||||
|
|
||||||
var navPanelCenter = {
|
|
||||||
id: 'navPanelCenter',
|
|
||||||
region: 'center', layout:'fit',forceLayout: true,
|
|
||||||
xtype:'panel',
|
|
||||||
items:[{
|
|
||||||
xtype:"tabpanel",
|
|
||||||
id: 'caseTabPanel',
|
|
||||||
deferredRender:false,
|
|
||||||
defaults:{autoScroll: true},
|
|
||||||
defaultType:"iframepanel",
|
|
||||||
activeTab: 0,
|
|
||||||
enableTabScroll: true,
|
|
||||||
//defaults: Ext.apply({}, Ext.isGecko? {style:{position:'absolute'},hideMode:'visibility'}:false),
|
|
||||||
|
|
||||||
items:[{
|
|
||||||
id: 'casesTab',
|
|
||||||
title: _('ID_CASE') +' ' + _APP_NUM,
|
|
||||||
frameConfig:{name:'openCaseFrame', id:'openCaseFrame'},
|
|
||||||
defaultSrc : uri,
|
|
||||||
loadMask:{msg: _('ID_LOADING_GRID') },
|
|
||||||
bodyStyle:{height: (PMExt.getBrowser().screen.height-60) + 'px', overflow:'hidden'},
|
|
||||||
width:screenWidth
|
|
||||||
|
|
||||||
}
|
|
||||||
],
|
|
||||||
listeners: {
|
|
||||||
tabchange: function(panel){
|
|
||||||
panel.ownerCt.doLayout();
|
|
||||||
},
|
|
||||||
render : function(panel){
|
|
||||||
Ext.each([this.el, this[this.collapseEl]] ,
|
|
||||||
function( elm ) {
|
|
||||||
elm.setVisibilityMode(Ext.Element.VISIBILITY).originalDisplay ='visible';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
|
|
||||||
var navPanel = {
|
|
||||||
id: 'navPanel',
|
|
||||||
region: 'center',
|
|
||||||
layout: 'border',
|
|
||||||
items:[navPanelWest, navPanelCenter],
|
|
||||||
tbar:[{
|
|
||||||
id: 'stepsMenu',
|
|
||||||
text: ' '+_('ID_STEPS'),
|
|
||||||
pressed: false,
|
|
||||||
enableToggle:true,
|
|
||||||
tooltip: {
|
|
||||||
title: _('ID_CASES_STEPS'),
|
|
||||||
text:_('ID_SHOW_HIDE_CASES_STEPS')
|
|
||||||
},
|
|
||||||
iconCls: 'ICON_STEPS',
|
|
||||||
toggleHandler: togglePreview,
|
|
||||||
disabled: true
|
|
||||||
}, {
|
|
||||||
id: 'informationMenu',
|
|
||||||
text: _('ID_INFORMATION'),
|
|
||||||
menu: []
|
|
||||||
}, {
|
|
||||||
id: 'actionMenu',
|
|
||||||
text: _('ID_ACTIONS'),
|
|
||||||
menu: []
|
|
||||||
}, {
|
|
||||||
id: 'caseNotes',
|
|
||||||
pressed: false,
|
|
||||||
enableToggle:true,
|
|
||||||
text: ' '+_('ID_CASES_NOTES'),
|
|
||||||
iconCls: 'button_menu_ext ICON_CASES_NOTES',
|
|
||||||
tooltip: {
|
|
||||||
title: _('ID_CASES_NOTES'),
|
|
||||||
text:_('ID_SHOW_CASES_NOTES')
|
|
||||||
},
|
|
||||||
toggleHandler:function(btn, pressed){
|
|
||||||
if(pressed){
|
|
||||||
openCaseNotesWindow();
|
|
||||||
}else{
|
|
||||||
closeCaseNotesWindow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}]
|
var fnChangeStatus =function(){
|
||||||
}
|
alert('loaded');
|
||||||
|
}
|
||||||
|
|
||||||
|
var screenWidth = (PMExt.getBrowser().screen.width-140).toString() + 'px';
|
||||||
|
|
||||||
|
var navPanelCenter = {
|
||||||
|
id: 'navPanelCenter',
|
||||||
|
region: 'center', layout:'fit',forceLayout: true,
|
||||||
|
xtype:'panel',
|
||||||
|
items:[{
|
||||||
|
xtype:"tabpanel",
|
||||||
|
id: 'caseTabPanel',
|
||||||
|
deferredRender:false,
|
||||||
|
defaults:{autoScroll: true},
|
||||||
|
defaultType:"iframepanel",
|
||||||
|
activeTab: 0,
|
||||||
|
enableTabScroll: true,
|
||||||
|
//defaults: Ext.apply({}, Ext.isGecko? {style:{position:'absolute'},hideMode:'visibility'}:false),
|
||||||
|
|
||||||
|
items:[{
|
||||||
|
id: 'casesTab',
|
||||||
|
title: _('ID_CASE') +' ' + _APP_NUM,
|
||||||
|
frameConfig:{name:'openCaseFrame', id:'openCaseFrame'},
|
||||||
|
defaultSrc : uri,
|
||||||
|
loadMask:{msg: _('ID_LOADING_GRID') },
|
||||||
|
bodyStyle:{height: (PMExt.getBrowser().screen.height-60) + 'px', overflow:'hidden'},
|
||||||
|
width:screenWidth
|
||||||
|
|
||||||
|
}
|
||||||
|
],
|
||||||
|
listeners: {
|
||||||
|
tabchange: function(panel){
|
||||||
|
panel.ownerCt.doLayout();
|
||||||
|
},
|
||||||
|
render : function(panel){
|
||||||
|
Ext.each([this.el, this[this.collapseEl]] ,
|
||||||
|
function( elm ) {
|
||||||
|
elm.setVisibilityMode(Ext.Element.VISIBILITY).originalDisplay ='visible';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonCancel = new Ext.Button({
|
||||||
|
buttonAlign: 'center',
|
||||||
|
text: 'Cancel',
|
||||||
|
handler: redirectHistory,
|
||||||
|
cls: 'cancelSummary',
|
||||||
|
width: '100px',
|
||||||
|
flex: 1,
|
||||||
|
style: "height:36px"
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonClaimCase = new Ext.Button({
|
||||||
|
buttonAlign: 'center',
|
||||||
|
ui: 'round',
|
||||||
|
text: 'Claim this case',
|
||||||
|
handler: claimCase,
|
||||||
|
cls: 'claimCaseSummary',
|
||||||
|
width: '120px',
|
||||||
|
flex: 1,
|
||||||
|
style: "height:36px"
|
||||||
|
});
|
||||||
|
|
||||||
|
navPanelBottom = {
|
||||||
|
id: 'navPanelBottom',
|
||||||
|
name: 'navPanelBottom',
|
||||||
|
cls: 'navPanelBottom',
|
||||||
|
region: 'south',
|
||||||
|
layout: 'column',
|
||||||
|
dock: 'bottom',
|
||||||
|
border: false,
|
||||||
|
margin: '0 0 0 0',
|
||||||
|
split: false,
|
||||||
|
collapsible: false,
|
||||||
|
hidden: false,
|
||||||
|
buttonAlign: 'center',
|
||||||
|
buttonHeight: 200,
|
||||||
|
buttons: [buttonCancel, buttonClaimCase]
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Claim the case.
|
||||||
|
*/
|
||||||
|
function claimCase() {
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'cases_CatchExecute',
|
||||||
|
success: function (response, opts) {
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'ajaxListener',
|
||||||
|
params: {action : 'steps'},
|
||||||
|
success: function (response, opts) {
|
||||||
|
Ext.getCmp('navPanelBottom').hide();
|
||||||
|
Ext.getCmp('navPanel').doLayout();
|
||||||
|
//Reload frame pmDynaform
|
||||||
|
if (isBrowserIE()) {
|
||||||
|
document.getElementById('openCaseFrame').contentWindow.location.reload(true);
|
||||||
|
} else {
|
||||||
|
Ext.getCmp('navPanelCenter').getUpdater().getEl().update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to unassigned inbox.
|
||||||
|
*/
|
||||||
|
function redirectHistory() {
|
||||||
|
if (isBrowserIE()) {
|
||||||
|
if (top.opener) {
|
||||||
|
//Is open the claim case in another tab
|
||||||
|
top.opener.location.reload();
|
||||||
|
top.close();
|
||||||
|
} else {
|
||||||
|
//When isIE with ux skin is not open another tab
|
||||||
|
javascript:history.back();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
javascript:history.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
navPanel = {
|
||||||
|
id: 'navPanel',
|
||||||
|
region: 'center',
|
||||||
|
layout: 'border',
|
||||||
|
items: [navPanelWest, navPanelCenter],
|
||||||
|
tbar: [{
|
||||||
|
id: 'stepsMenu',
|
||||||
|
text: ' ' + _('ID_STEPS'),
|
||||||
|
pressed: false,
|
||||||
|
enableToggle: true,
|
||||||
|
tooltip: {
|
||||||
|
title: _('ID_CASES_STEPS'),
|
||||||
|
text: _('ID_SHOW_HIDE_CASES_STEPS')
|
||||||
|
},
|
||||||
|
iconCls: 'ICON_STEPS',
|
||||||
|
toggleHandler: togglePreview,
|
||||||
|
disabled: true
|
||||||
|
}, {
|
||||||
|
id: 'informationMenu',
|
||||||
|
text: _('ID_INFORMATION'),
|
||||||
|
menu: []
|
||||||
|
}, {
|
||||||
|
id: 'actionMenu',
|
||||||
|
text: _('ID_ACTIONS'),
|
||||||
|
menu: []
|
||||||
|
}, {
|
||||||
|
id: 'caseNotes',
|
||||||
|
pressed: false,
|
||||||
|
enableToggle: true,
|
||||||
|
text: ' ' + _('ID_CASES_NOTES'),
|
||||||
|
iconCls: 'button_menu_ext ICON_CASES_NOTES',
|
||||||
|
tooltip: {
|
||||||
|
title: _('ID_CASES_NOTES'),
|
||||||
|
text: _('ID_SHOW_CASES_NOTES')
|
||||||
|
},
|
||||||
|
toggleHandler: function (btn, pressed) {
|
||||||
|
if (pressed) {
|
||||||
|
openCaseNotesWindow();
|
||||||
|
} else {
|
||||||
|
closeCaseNotesWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Parameters from URL
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function getParameterURL() {
|
||||||
|
var item,
|
||||||
|
key = false,
|
||||||
|
result = {},
|
||||||
|
url = location.search.substring(1),
|
||||||
|
regExp = /([^&=]+)=([^&]*)/g;
|
||||||
|
if (arguments.length > 0 && arguments[0].length > 1) {
|
||||||
|
key = arguments[0];
|
||||||
|
}
|
||||||
|
while (item = regExp.exec(url)) {
|
||||||
|
if (key !== false && decodeURIComponent(item[1]) === key) {
|
||||||
|
return decodeURIComponent(item[2]);
|
||||||
|
}
|
||||||
|
else if (key === false) {
|
||||||
|
result[decodeURIComponent(item[1])] = decodeURIComponent(item[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return key === false ? result : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.showCustomForm && this.showCustomForm === true && getParameterURL('action') === 'unassigned') {
|
||||||
|
navPanel.items[navPanel.items.length] = navPanelBottom;
|
||||||
|
}
|
||||||
|
|
||||||
var viewport = new Ext.Viewport({
|
var viewport = new Ext.Viewport({
|
||||||
layout: 'border',
|
layout: 'border',
|
||||||
@@ -1359,6 +1470,7 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
Actions.pauseCase = function()
|
Actions.pauseCase = function()
|
||||||
{
|
{
|
||||||
|
Ext.getCmp('submitPauseCase').setDisabled(true);
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url : 'ajaxListener' ,
|
url : 'ajaxListener' ,
|
||||||
params : {action : 'verifySession'},
|
params : {action : 'verifySession'},
|
||||||
@@ -1390,6 +1502,7 @@ Ext.onReady(function(){
|
|||||||
var paramsNote = '&NOTE_REASON=' + noteReasonTxt + '&NOTIFY_PAUSE=' + notifyReasonVal;
|
var paramsNote = '&NOTE_REASON=' + noteReasonTxt + '&NOTIFY_PAUSE=' + notifyReasonVal;
|
||||||
var unpauseDate = Ext.getCmp('unpauseDate').getValue();
|
var unpauseDate = Ext.getCmp('unpauseDate').getValue();
|
||||||
if( unpauseDate == '') {
|
if( unpauseDate == '') {
|
||||||
|
Ext.getCmp('submitPauseCase').setDisabled(false);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
unpauseDate = unpauseDate.format('Y-m-d');
|
unpauseDate = unpauseDate.format('Y-m-d');
|
||||||
@@ -1420,6 +1533,7 @@ Ext.onReady(function(){
|
|||||||
},
|
},
|
||||||
failure: function ( res, req) {
|
failure: function ( res, req) {
|
||||||
PMExt.error(_('ID_ERROR'), req.result.msg);
|
PMExt.error(_('ID_ERROR'), req.result.msg);
|
||||||
|
Ext.getCmp('submitPauseCase').setDisabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1428,6 +1542,7 @@ Ext.onReady(function(){
|
|||||||
if (typeof(result.responseText) != 'undefined') {
|
if (typeof(result.responseText) != 'undefined') {
|
||||||
Ext.MessageBox.alert( _('ID_FAILED'), result.responseText);
|
Ext.MessageBox.alert( _('ID_FAILED'), result.responseText);
|
||||||
}
|
}
|
||||||
|
Ext.getCmp('submitPauseCase').setDisabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1892,4 +2007,3 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
node.select();
|
node.select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user