Merged in enriquecolosa/processmaker/RM-11 (pull request #2808)

RM-11
This commit is contained in:
Julio Cesar Laura Avendaño
2015-09-18 13:18:27 -04:00
36 changed files with 5336 additions and 2042 deletions

View File

@@ -56,7 +56,7 @@ class Derivation
* *
* return array Return array * return array Return array
*/ */
public function prepareInformationTask(array $arrayTaskData) private function prepareInformationTask(array $arrayTaskData)
{ {
try { try {
$task = new Task(); $task = new Task();
@@ -112,7 +112,9 @@ class Derivation
$arrayTaskData["NEXT_TASK"]["TAS_PARENT"] = ""; $arrayTaskData["NEXT_TASK"]["TAS_PARENT"] = "";
} }
$arrayTaskData["NEXT_TASK"]["USER_ASSIGNED"] = (!in_array($arrayTaskData["NEXT_TASK"]["TAS_TYPE"], array("GATEWAYTOGATEWAY", "END-MESSAGE-EVENT", "SCRIPT-TASK", "INTERMEDIATE-CATCH-TIMER-EVENT", "END-EMAIL-EVENT")))? $this->getNextAssignedUser($arrayTaskData) : array("USR_UID" => "", "USR_FULLNAME" => ""); $regexpTaskTypeToExclude = "GATEWAYTOGATEWAY|END-MESSAGE-EVENT|SCRIPT-TASK|INTERMEDIATE-CATCH-TIMER-EVENT|END-EMAIL-EVENT";
$arrayTaskData["NEXT_TASK"]["USER_ASSIGNED"] = (!preg_match("/^(?:" . $regexpTaskTypeToExclude . ")$/", $arrayTaskData["NEXT_TASK"]["TAS_TYPE"]))? $this->getNextAssignedUser($arrayTaskData) : array("USR_UID" => "", "USR_FULLNAME" => "");
} }
//Return //Return
@@ -226,7 +228,7 @@ class Derivation
} }
} }
if (empty($arrayNextTask) && !empty($arrayNextTaskDefault)) { if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) {
$arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault); $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault);
} }
@@ -480,10 +482,26 @@ class Derivation
//} //}
///* End - Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */ ///* End - Verify if the next Task is set with the option "TAS_ASSIGN_LOCATION == TRUE" */
$uidUser = ''; $taskNext = TaskPeer::retrieveByPK($nextAssignedTask["TAS_UID"]);
switch ($nextAssignedTask['TAS_ASSIGN_TYPE']) { $bpmnActivityNext = BpmnActivityPeer::retrieveByPK($nextAssignedTask["TAS_UID"]);
$flagTaskNextIsMultipleInstance = false;
$flagTaskNextAssignTypeIsMultipleInstance = false;
if (!is_null($taskNext) && !is_null($bpmnActivityNext)) {
$flagTaskNextIsMultipleInstance = $bpmnActivityNext->getActType() == "TASK" && preg_match("/^(?:EMPTY|USERTASK|MANUALTASK)$/", $bpmnActivityNext->getActTaskType()) && $bpmnActivityNext->getActLoopType() == "PARALLEL";
$flagTaskNextAssignTypeIsMultipleInstance = preg_match("/^(?:MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED)$/", $taskNext->getTasAssignType());
}
$taskNextAssignType = $taskNext->getTasAssignType();
$taskNextAssignType = ($flagTaskNextIsMultipleInstance && !$flagTaskNextAssignTypeIsMultipleInstance)? "" : $taskNextAssignType;
$taskNextAssignType = (!$flagTaskNextIsMultipleInstance && $flagTaskNextAssignTypeIsMultipleInstance)? "" : $taskNextAssignType;
switch ($taskNextAssignType) {
case 'BALANCED': case 'BALANCED':
$users = $this->getAllUsersFromAnyTask( $sTasUid ); $users = $this->getAllUsersFromAnyTask( $sTasUid );
$uidUser = "";
if (is_array( $users ) && count( $users ) > 0) { if (is_array( $users ) && count( $users ) > 0) {
//to do apply any filter like LOCATION assignment //to do apply any filter like LOCATION assignment
$uidUser = $users[0]; $uidUser = $users[0];
@@ -553,8 +571,25 @@ class Derivation
$userFields['USR_LASTNAME'] = ''; $userFields['USR_LASTNAME'] = '';
$userFields['USR_EMAIL'] = ''; $userFields['USR_EMAIL'] = '';
break; break;
case "MULTIPLE_INSTANCE":
$userFields = $this->getUsersFullNameFromArray($this->getAllUsersFromAnyTask($nextAssignedTask["TAS_UID"]));
break;
case "MULTIPLE_INSTANCE_VALUE_BASED":
$arrayApplicationData = $this->case->loadCase($tasInfo["APP_UID"]);
$nextTaskAssignVariable = trim($nextAssignedTask["TAS_ASSIGN_VARIABLE"], " @#");
if ($nextTaskAssignVariable != "" &&
isset($arrayApplicationData["APP_DATA"][$nextTaskAssignVariable]) && !empty($arrayApplicationData["APP_DATA"][$nextTaskAssignVariable]) && is_array($arrayApplicationData["APP_DATA"][$nextTaskAssignVariable])
) {
$userFields = $this->getUsersFullNameFromArray($arrayApplicationData["APP_DATA"][$nextTaskAssignVariable]);
} else {
throw new Exception(G::LoadTranslation("ID_ACTIVITY_INVALID_USER_DATA_VARIABLE_FOR_MULTIPLE_INSTANCE_ACTIVITY", array(strtolower("ACT_UID"), $nextAssignedTask["TAS_UID"], $nextTaskAssignVariable)));
}
break;
default: default:
throw (new Exception( 'Invalid Task Assignment method for Next Task ' )); throw (new Exception( 'Invalid Task Assignment method for Next Task ' ));
break;
} }
return $userFields; return $userFields;
} }
@@ -595,6 +630,86 @@ class Derivation
} }
} }
/**
* Update counters
*
* @param array $arrayCurrentDelegationData
* @param array $arrayNextDelegationData
* @param mixed $taskNextDelegation
* @param array $arrayApplicationData
* @param int $delIndexNew
* @param mixed $aSp
* @param bool $removeList
*
* return void
*/
private function derivateUpdateCounters(array $arrayCurrentDelegationData, array $arrayNextDelegationData, $taskNextDelegation, array $arrayApplicationData, $delIndexNew, $aSp, $removeList)
{
/*----------------------------------********---------------------------------*/
try {
$user = new Users();
if ($arrayNextDelegationData["TAS_UID"] == "-2") {
$application = ApplicationPeer::retrieveByPK($arrayApplicationData["APP_UID"]);
if ($application->getAppStatus() == "DRAFT") {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "draft");
} else {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "inbox");
}
} else {
if ($arrayNextDelegationData["TAS_UID"] != "-1") {
$regexpTaskTypeToExclude = "WEBENTRYEVENT|END-MESSAGE-EVENT|START-MESSAGE-EVENT|INTERMEDIATE-THROW-MESSAGE-EVENT|INTERMEDIATE-CATCH-MESSAGE-EVENT|SCRIPT-TASK|INTERMEDIATE-CATCH-TIMER-EVENT";
if (!preg_match("/^(?:" . $regexpTaskTypeToExclude . ")$/", $taskNextDelegation->getTasType())) {
if (!empty($delIndexNew) && empty($aSp)) {
$appDelegation = AppDelegationPeer::retrieveByPK($arrayApplicationData["APP_UID"], $delIndexNew);
$arrayApplicationData2 = $appDelegation->toArray(BasePeer::TYPE_FIELDNAME);
$arrayApplicationData2["APP_STATUS"] = $arrayCurrentDelegationData["APP_STATUS"];
$taskCurrent = TaskPeer::retrieveByPK($arrayCurrentDelegationData["TAS_UID"]);
if ($taskCurrent->getTasType() == "INTERMEDIATE-CATCH-MESSAGE-EVENT") {
$removeList = false;
}
$arrayApplicationData2["REMOVED_LIST"] = $removeList;
$inbox = new ListInbox();
$inbox->newRow($arrayApplicationData2, $arrayApplicationData["CURRENT_USER_UID"], false, array(), (($arrayNextDelegationData["TAS_ASSIGN_TYPE"] == "SELF_SERVICE")? true : false));
} else {
if (empty($aSp)) {
$application = ApplicationPeer::retrieveByPK($arrayApplicationData["APP_UID"]);
if ($application->getAppStatus() == "DRAFT") {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "draft");
} else {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "inbox");
}
}
}
} else {
$regexpTaskTypeToExclude = "SCRIPT-TASK";
if (!preg_match("/^(?:" . $regexpTaskTypeToExclude . ")$/", $taskNextDelegation->getTasType()) && $removeList) {
$application = ApplicationPeer::retrieveByPK($arrayApplicationData["APP_UID"]);
if ($application->getAppStatus() == "DRAFT") {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "draft");
} else {
$user->refreshTotal($arrayApplicationData["CURRENT_USER_UID"], "remove", "inbox");
}
}
}
}
}
} catch (Exception $e) {
throw $e;
}
/*----------------------------------********---------------------------------*/
}
/* derivate /* derivate
* *
* @param array $currentDelegation * @param array $currentDelegation
@@ -621,6 +736,15 @@ class Derivation
//Get data for current delegation (current Task) //Get data for current delegation (current Task)
$task = TaskPeer::retrieveByPK($currentDelegation["TAS_UID"]); $task = TaskPeer::retrieveByPK($currentDelegation["TAS_UID"]);
$bpmnActivity = BpmnActivityPeer::retrieveByPK($currentDelegation["TAS_UID"]);
$flagTaskIsMultipleInstance = false;
$flagTaskAssignTypeIsMultipleInstance = false;
if (!is_null($task) && !is_null($bpmnActivity)) {
$flagTaskIsMultipleInstance = $bpmnActivity->getActType() == "TASK" && preg_match("/^(?:EMPTY|USERTASK|MANUALTASK)$/", $bpmnActivity->getActTaskType()) && $bpmnActivity->getActLoopType() == "PARALLEL";
$flagTaskAssignTypeIsMultipleInstance = preg_match("/^(?:MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED)$/", $task->getTasAssignType());
}
$currentDelegation["TAS_ASSIGN_TYPE"] = $task->getTasAssignType(); $currentDelegation["TAS_ASSIGN_TYPE"] = $task->getTasAssignType();
$currentDelegation["TAS_MI_COMPLETE_VARIABLE"] = $task->getTasMiCompleteVariable(); $currentDelegation["TAS_MI_COMPLETE_VARIABLE"] = $task->getTasMiCompleteVariable();
@@ -666,6 +790,17 @@ class Derivation
} }
$taskNextDel = TaskPeer::retrieveByPK($nextDel["TAS_UID"]); //Get data for next delegation (next Task) $taskNextDel = TaskPeer::retrieveByPK($nextDel["TAS_UID"]); //Get data for next delegation (next Task)
$bpmnActivityNextDel = BpmnActivityPeer::retrieveByPK($nextDel["TAS_UID"]);
$flagTaskNextDelIsMultipleInstance = false;
$flagTaskNextDelAssignTypeIsMultipleInstance = false;
if (!is_null($taskNextDel) && !is_null($bpmnActivityNextDel)) {
$flagTaskNextDelIsMultipleInstance = $bpmnActivityNextDel->getActType() == "TASK" && preg_match("/^(?:EMPTY|USERTASK|MANUALTASK)$/", $bpmnActivityNextDel->getActTaskType()) && $bpmnActivityNextDel->getActLoopType() == "PARALLEL";
$flagTaskNextDelAssignTypeIsMultipleInstance = preg_match("/^(?:MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED)$/", $taskNextDel->getTasAssignType());
}
$flagUpdateCounters = true;
switch ($nextDel['TAS_UID']) { switch ($nextDel['TAS_UID']) {
case TASK_FINISH_PROCESS: case TASK_FINISH_PROCESS:
@@ -699,12 +834,13 @@ class Derivation
$this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex );
break; break;
default: default:
// get all siblingThreads //Get all siblingThreads
//if($currentDelegation['TAS_ASSIGN_TYPE'] == 'STATIC_MI') $canDerivate = false;
switch ($currentDelegation['TAS_ASSIGN_TYPE']) { switch ($currentDelegation['TAS_ASSIGN_TYPE']) {
case 'CANCEL_MI': case 'CANCEL_MI':
case 'STATIC_MI': case 'STATIC_MI':
$siblingThreads = $this->case->GetAllOpenDelegation( $currentDelegation ); $arrayOpenThread = $this->case->GetAllOpenDelegation($currentDelegation);
$aData = $this->case->loadCase( $currentDelegation['APP_UID'] ); $aData = $this->case->loadCase( $currentDelegation['APP_UID'] );
if (isset( $aData['APP_DATA'][str_replace( '@@', '', $currentDelegation['TAS_MI_INSTANCE_VARIABLE'] )] )) { if (isset( $aData['APP_DATA'][str_replace( '@@', '', $currentDelegation['TAS_MI_INSTANCE_VARIABLE'] )] )) {
@@ -722,21 +858,29 @@ class Derivation
$discriminateThread = $sMIinstanceVar - $sMIcompleteVar; $discriminateThread = $sMIinstanceVar - $sMIcompleteVar;
// -1 because One App Delegation is closed by above Code // -1 because One App Delegation is closed by above Code
if ($discriminateThread == count( $siblingThreads )) { if ($discriminateThread == count($arrayOpenThread)) {
$canDerivate = true; $canDerivate = true;
} else { } else {
$canDerivate = false; $canDerivate = false;
} }
break; break;
default: default:
if ($currentDelegation["ROU_TYPE"] == "SEC-JOIN") { $routeType = $currentDelegation["ROU_TYPE"];
$siblingThreads = $this->case->getOpenSiblingThreads($nextDel["TAS_UID"], $currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"], $currentDelegation["TAS_UID"]); $routeType = ($flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance)? "SEC-JOIN" : $routeType;
$canDerivate = empty($siblingThreads); switch ($routeType) {
} else { case "SEC-JOIN":
$canDerivate = true; $arrayOpenThread = ($flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance)? $this->case->searchOpenPreviousTasks($currentDelegation["TAS_UID"], $currentDelegation["APP_UID"]) : array();
$arrayOpenThread = array_merge($arrayOpenThread, $this->case->getOpenSiblingThreads($nextDel["TAS_UID"], $currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"], $currentDelegation["TAS_UID"]));
$canDerivate = empty($arrayOpenThread);
break;
default:
$canDerivate = true;
break;
} }
} //end switch break;
}
if ($canDerivate) { if ($canDerivate) {
//Throw Message-Events //Throw Message-Events
@@ -750,9 +894,35 @@ class Derivation
$emailEvent->emailEventBetweenElementOriginAndElementDest($currentDelegation["TAS_UID"], $nextDel["TAS_UID"], $appFields); $emailEvent->emailEventBetweenElementOriginAndElementDest($currentDelegation["TAS_UID"], $nextDel["TAS_UID"], $appFields);
//Derivate //Derivate
$aSP = isset( $aSP ) ? $aSP : null; $aSP = (isset($aSP))? $aSP : null;
$iNewDelIndex = $this->doDerivation( $currentDelegation, $nextDel, $appFields, $aSP ); $taskNextDelAssignType = ($flagTaskNextDelIsMultipleInstance && $flagTaskNextDelAssignTypeIsMultipleInstance)? $taskNextDel->getTasAssignType() : "";
switch ($taskNextDelAssignType) {
case "MULTIPLE_INSTANCE":
case "MULTIPLE_INSTANCE_VALUE_BASED":
$arrayUser = $this->getNextAssignedUser(array("APP_UID" => $currentDelegation["APP_UID"], "NEXT_TASK" => $taskNextDel->toArray(BasePeer::TYPE_FIELDNAME)));
if (empty($arrayUser)) {
throw new Exception(G::LoadTranslation("ID_NO_USERS"));
}
foreach ($arrayUser as $value2) {
$currentDelegationAux = array_merge($currentDelegation, array("ROU_TYPE" => "PARALLEL"));
$nextDelAux = array_merge($nextDel, array("USR_UID" => $value2["USR_UID"]));
$iNewDelIndex = $this->doDerivation($currentDelegationAux, $nextDelAux, $appFields, $aSP);
$this->derivateUpdateCounters($currentDelegationAux, $nextDelAux, $taskNextDel, $appFields, $iNewDelIndex, $aSP, $removeList);
$flagUpdateCounters = false;
$removeList = false;
}
break;
default:
$iNewDelIndex = $this->doDerivation($currentDelegation, $nextDel, $appFields, $aSP);
break;
}
//Execute Script-Task //Execute Script-Task
$scriptTask = new \ProcessMaker\BusinessModel\ScriptTask(); $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
@@ -760,9 +930,9 @@ class Derivation
$appFields["APP_DATA"] = $scriptTask->execScriptByActivityUid($nextDel["TAS_UID"], $appFields); $appFields["APP_DATA"] = $scriptTask->execScriptByActivityUid($nextDel["TAS_UID"], $appFields);
//Create record in table APP_ASSIGN_SELF_SERVICE_VALUE //Create record in table APP_ASSIGN_SELF_SERVICE_VALUE
$arrayTaskTypeToExclude = array("SCRIPT-TASK"); $regexpTaskTypeToExclude = "SCRIPT-TASK";
if (!in_array($taskNextDel->getTasType(), $arrayTaskTypeToExclude)) { if (!is_null($taskNextDel) && !preg_match("/^(?:" . $regexpTaskTypeToExclude . ")$/", $taskNextDel->getTasType())) {
if ($taskNextDel->getTasAssignType() == "SELF_SERVICE" && trim($taskNextDel->getTasGroupVariable()) != "") { if ($taskNextDel->getTasAssignType() == "SELF_SERVICE" && trim($taskNextDel->getTasGroupVariable()) != "") {
$nextTaskGroupVariable = trim($taskNextDel->getTasGroupVariable(), " @#"); $nextTaskGroupVariable = trim($taskNextDel->getTasGroupVariable(), " @#");
@@ -780,7 +950,7 @@ class Derivation
} }
//Check if $taskNextDel is Script-Task //Check if $taskNextDel is Script-Task
if ($taskNextDel->getTasType() == "SCRIPT-TASK") { if (!is_null($taskNextDel) && $taskNextDel->getTasType() == "SCRIPT-TASK") {
$this->case->CloseCurrentDelegation($currentDelegation["APP_UID"], $iNewDelIndex); $this->case->CloseCurrentDelegation($currentDelegation["APP_UID"], $iNewDelIndex);
//Get for $nextDel["TAS_UID"] your next Task //Get for $nextDel["TAS_UID"] your next Task
@@ -807,7 +977,11 @@ class Derivation
} else { } else {
//when the task doesnt generate a new AppDelegation //when the task doesnt generate a new AppDelegation
$iAppThreadIndex = $appFields['DEL_THREAD']; $iAppThreadIndex = $appFields['DEL_THREAD'];
switch ($currentDelegation['ROU_TYPE']) {
$routeType = $currentDelegation["ROU_TYPE"];
$routeType = ($flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance)? "SEC-JOIN" : $routeType;
switch ($routeType) {
case 'SEC-JOIN': case 'SEC-JOIN':
$this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex );
break; break;
@@ -816,74 +990,19 @@ class Derivation
$this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex );
} }
break; break;
} //switch }
} }
break;
} }
//SETS THE APP_PROC_CODE if ($flagUpdateCounters) {
//if (isset($nextDel['TAS_DEF_PROC_CODE'])) $this->derivateUpdateCounters($currentDelegation, $nextDel, $taskNextDel, $appFields, (isset($iNewDelIndex))? $iNewDelIndex : 0, (isset($aSP))? $aSP : null, $removeList);
//$appFields['APP_PROC_CODE'] = $nextDel['TAS_DEF_PROC_CODE'];
/*----------------------------------********---------------------------------*/
if ($nextDel['TAS_UID'] == '-2') {
$oRow = ApplicationPeer::retrieveByPK($appFields['APP_UID']);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$users = new Users();
if ($aFields['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($appFields['CURRENT_USER_UID'], 'remove', 'draft');
} else {
$users->refreshTotal($appFields['CURRENT_USER_UID'], 'remove', 'inbox');
}
} elseif ($nextDel['TAS_UID'] != '-1') {
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT", "SCRIPT-TASK", "INTERMEDIATE-CATCH-TIMER-EVENT");
if (!in_array($taskNextDel->getTasType(), $arrayTaskTypeToExclude)) {
if (!empty($iNewDelIndex) && empty($aSP)) {
$oAppDel = AppDelegationPeer::retrieveByPK( $appFields['APP_UID'], $iNewDelIndex );
$aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$aFields['APP_STATUS'] = $currentDelegation['APP_STATUS'];
$taskCur = TaskPeer::retrieveByPK($currentDelegation['TAS_UID']);
$aTaskCur = $taskCur->toArray( BasePeer::TYPE_FIELDNAME );
if ($aTaskCur['TAS_TYPE'] == "INTERMEDIATE-CATCH-MESSAGE-EVENT") {
$removeList = false;
}
$aFields['REMOVED_LIST'] = $removeList;
$inbox = new ListInbox();
$inbox->newRow($aFields, $appFields['CURRENT_USER_UID'], false, array(), ($nextDel['TAS_ASSIGN_TYPE'] == 'SELF_SERVICE' ? true : false));
} else {
if (empty($aSP)) {
$oRow = ApplicationPeer::retrieveByPK($appFields['APP_UID']);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$users = new Users();
if ($aFields['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($appFields['CURRENT_USER_UID'], 'remove', 'draft');
} else {
$users->refreshTotal($appFields['CURRENT_USER_UID'], 'remove', 'inbox');
}
}
}
} else {
$arrayTaskTypeToExclude = array("SCRIPT-TASK");
if ($removeList && !in_array($taskNextDel->getTasType(), $arrayTaskTypeToExclude)) {
$oRow = ApplicationPeer::retrieveByPK($appFields["APP_UID"]);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
$users = new Users();
if ($aFields["APP_STATUS"] == "DRAFT") {
$users->refreshTotal($appFields["CURRENT_USER_UID"], "remove", "draft");
} else {
$users->refreshTotal($appFields["CURRENT_USER_UID"], "remove", "inbox");
}
}
}
} }
/*----------------------------------********---------------------------------*/
unset( $aSP );
$removeList = false; $removeList = false;
} //end foreach
unset($aSP);
}
/* Start Block : UPDATES APPLICATION */ /* Start Block : UPDATES APPLICATION */
@@ -893,7 +1012,7 @@ class Derivation
$openThreads = $this->case->GetOpenThreads( $currentDelegation['APP_UID'] ); $openThreads = $this->case->GetOpenThreads( $currentDelegation['APP_UID'] );
/////// ///////
$sw = 0; $flag = false;
if ($openThreads == 0) { if ($openThreads == 0) {
//Close case //Close case
@@ -901,17 +1020,17 @@ class Derivation
$appFields["APP_FINISH_DATE"] = "now"; $appFields["APP_FINISH_DATE"] = "now";
$this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]); $this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]);
$sw = 1; $flag = true;
} }
if (isset( $iNewDelIndex )) { if (isset( $iNewDelIndex )) {
$appFields["DEL_INDEX"] = $iNewDelIndex; $appFields["DEL_INDEX"] = $iNewDelIndex;
$appFields["TAS_UID"] = $nextDel["TAS_UID"]; $appFields["TAS_UID"] = $nextDel["TAS_UID"];
$sw = 1; $flag = true;
} }
if ($sw == 1) { if ($flag) {
//Start Block : UPDATES APPLICATION //Start Block : UPDATES APPLICATION
$this->case->updateCase( $currentDelegation["APP_UID"], $appFields ); $this->case->updateCase( $currentDelegation["APP_UID"], $appFields );
//End Block : UPDATES APPLICATION //End Block : UPDATES APPLICATION

View File

@@ -379,6 +379,17 @@ class PMPlugin
$oPluginRegistry =& PMPluginRegistry::getSingleton(); $oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->enableRestService($this->sNamespace, $enable); $oPluginRegistry->enableRestService($this->sNamespace, $enable);
} }
/**
* With this function we can register new options to designer menu
* param string $menuOptionsFile
* @return void
*/
public function registerDesignerNewOption($menuOptionsFile)
{
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerDesignerNewOption($this->sNamespace, $menuOptionsFile);
}
} }
class menuDetail class menuDetail
@@ -718,3 +729,21 @@ class cronFile
$this->cronFile = $cronFile; $this->cronFile = $cronFile;
} }
} }
class menuOptionFile
{
public $namespace;
public $menuOptionFile;
/**
* This function is the constructor of the cronFile class
* param string $namespace
* param string $menuOptionFile
* @return void
*/
public function __construct($namespace, $menuOptionFile)
{
$this->namespace = $namespace;
$this->menuOptionFile = $menuOptionFile;
}
}

View File

@@ -101,6 +101,7 @@ class PMPluginRegistry
private $_aTaskExtendedProperties = array (); private $_aTaskExtendedProperties = array ();
private $_aDashboardPages = array (); private $_aDashboardPages = array ();
private $_aCronFiles = array (); private $_aCronFiles = array ();
private $_aDesignerMenuFiles = array ();
/** /**
* Registry a plugin javascript to include with js core at same runtime * Registry a plugin javascript to include with js core at same runtime
@@ -391,6 +392,11 @@ class PMPluginRegistry
unset( $this->_aDashboardPages[$key] ); unset( $this->_aDashboardPages[$key] );
} }
} }
foreach ($this->_aDesignerMenuFiles as $key => $detail) {
if ($detail->namespace == $sNamespace) {
unset( $this->_aDesignerMenuFiles[$key] );
}
}
//unregistering javascripts from this plugin //unregistering javascripts from this plugin
$this->unregisterJavascripts( $sNamespace ); $this->unregisterJavascripts( $sNamespace );
@@ -1601,4 +1607,35 @@ class PMPluginRegistry
throw $e; throw $e;
} }
} }
/**
* Register new options to designer menu
*
* @param unknown_type $namespace
* @param unknown_type $cronFile
*/
public function registerDesignerNewOption ($namespace, $menuOptionFile)
{
$found = false;
foreach ($this->_aDesignerMenuFiles as $row => $detail) {
if ($menuOptionFile == $detail->menuOptionFile && $namespace == $detail->namespace) {
$detail->menuOptionFile = $menuOptionFile;
$found = true;
}
}
if (!$found) {
$menuOptionFile = new menuOptionFile( $namespace, $menuOptionFile );
$this->_aDesignerMenuFiles[] = $menuOptionFile;
}
}
/**
* Return all designer menu Option files registered
*
* @return array
*/
public function getDesignerNewOption()
{
return $this->_aDesignerMenuFiles;
}
} }

View File

@@ -182,7 +182,7 @@ class pmDynaform
array_push($json->optionsSql, $option); array_push($json->optionsSql, $option);
} }
} catch (Exception $e) { } catch (Exception $e) {
} }
} }
if (isset($json->options[0])) { if (isset($json->options[0])) {
@@ -475,6 +475,55 @@ class pmDynaform
exit(); exit();
} }
public function printEditSupervisor()
{
ob_clean();
$json = G::json_decode($this->record["DYN_CONTENT"]);
$this->jsonr($json);
$msg = "";
if (isset($_SESSION["G_MESSAGE_TYPE"]) && isset($_SESSION["G_MESSAGE"])) {
$msg = "<div style=\"margin: 1.2em; border: 1px solid #3C763D; padding: 0.5em; background: #B2D3B3;\"><strong>" . G::LoadTranslation("ID_INFO") . "</strong>: " . $_SESSION["G_MESSAGE"] . "</div>";
unset($_SESSION["G_MESSAGE_TYPE"]);
unset($_SESSION["G_MESSAGE"]);
}
$javascrip = "
<script type=\"text/javascript\">
var jsondata = " . G::json_encode($json) . ";
var pm_run_outside_main_app = null;
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
var __DynaformName__ = \"" . $this->fields["PRO_UID"] . "_" . $this->fields["CURRENT_DYNAFORM"] . "\";
var app_uid = \"" . $this->fields["APP_UID"] . "\";
var prj_uid = \"" . $this->fields["PRO_UID"] . "\";
var step_mode = null;
var workspace = \"" . SYS_SYS . "\";
var credentials = " . G::json_encode($this->credentials) . ";
var filePost = \"cases_SaveDataSupervisor?UID=" . $this->fields["CURRENT_DYNAFORM"] . "\";
var fieldsRequired = null;
var triggerDebug = null;
</script>
<script type=\"text/javascript\" src=\"/jscore/cases/core/pmDynaform.js\"></script>
<div>
$msg
<div style=\"display: none;\">
<a id=\"dyn_forward\" href=\"javascript:;\"></a>
</div>
</div>
";
$file = file_get_contents(PATH_HOME . "public_html" . PATH_SEP . "lib" . PATH_SEP . "pmdynaform" . PATH_SEP . "build" . PATH_SEP . "pmdynaform.html");
$file = str_replace("{javascript}", $javascrip, $file);
echo $file;
exit(0);
}
public function printWebEntry($filename) public function printWebEntry($filename)
{ {
ob_clean(); ob_clean();
@@ -967,3 +1016,4 @@ class pmDynaform
} }
} }

View File

@@ -1409,7 +1409,7 @@ function WSUnpauseCase ($caseUid, $delIndex, $userUid)
* *
* Add a case note. * Add a case note.
* *
* @name WSAddACaseNote * @name WSAddCaseNote
* @label WS Add a case note * @label WS Add a case note
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSAddCaseNote.28.29 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSAddCaseNote.28.29
* *
@@ -1546,7 +1546,7 @@ function PMFUserList () //its test was successfull
* *
* Add an Input Document. * Add an Input Document.
* *
* @name PMFAddAnInputDocument * @name PMFAddInputDocument
* @label PMF Add an input document * @label PMF Add an input document
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddInputDocument.28.29 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddInputDocument.28.29
* *
@@ -2780,7 +2780,7 @@ function PMFUnpauseCase ($caseUid, $delIndex, $userUid)
* *
* Add a case note. * Add a case note.
* *
* @name PMFAddACaseNote * @name PMFAddCaseNote
* @label PMF Add a case note * @label PMF Add a case note
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddCaseNote.28.29 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFAddCaseNote.28.29
* *

View File

@@ -240,7 +240,7 @@ class ReportTables
if (! isset( $aData[$aField['sFieldName']] )) { if (! isset( $aData[$aField['sFieldName']] )) {
$aData[$aField['sFieldName']] = ''; $aData[$aField['sFieldName']] = '';
} }
$sQuery .= ",'" . (isset( $aData[$aField['sFieldName']] ) ? mysql_real_escape_string( $aData[$aField['sFieldName']] ) : '') . "'"; $sQuery .= ",'" . (isset( $aData[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aData[$aField['sFieldName']] ) : '') . "'";
break; break;
case 'date': case 'date':
$value = (isset( $aData[$aField['sFieldName']] ) && trim( $aData[$aField['sFieldName']] )) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL'; $value = (isset( $aData[$aField['sFieldName']] ) && trim( $aData[$aField['sFieldName']] )) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
@@ -599,12 +599,15 @@ class ReportTables
case 'text': case 'text':
if (! isset( $aFields[$aField['sFieldName']] )) { if (! isset( $aFields[$aField['sFieldName']] )) {
$aFields[$aField['sFieldName']] = ''; $aFields[$aField['sFieldName']] = '';
} }
if(is_array($aFields[$aField['sFieldName']])){ if(is_array($aFields[$aField['sFieldName']])){
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']][0] : '') . "',"; $sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? $aFields[$aField['sFieldName']][0] : '') . "',";
}else{ }else{
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "',"; if($aFields[$aField['sFieldName']] == $aFields[$aField['sFieldName'].'_label']){
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aFields[$aField['sFieldName']] ) : '') . "',";
}else{
$sQuery .= "'" . (isset( $aFields[$aField['sFieldName']] ) ? @mysql_real_escape_string( $aFields[$aField['sFieldName'].'_label'] ) : '') . "',";
}
} }
break; break;
case 'date': case 'date':

View File

@@ -129,6 +129,21 @@ class Language extends BaseLanguage
public function import ($sLanguageFile, $updateXml = true, $updateDB = true, $generateMafe = true) public function import ($sLanguageFile, $updateXml = true, $updateDB = true, $generateMafe = true)
{ {
try { try {
//get labels MichelangeloFE
try {
$oTranslation = new Translation();
$MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js";
if (file_exists($MichelangeloFE)) {
$labels = self::readLabelsDirectory($MichelangeloFE, true);
foreach ($labels as $label) {
$oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label);
}
}
} catch (Exception $e) {
error_log($e->getMessage());
}
G::LoadSystem( 'i18n_po' ); G::LoadSystem( 'i18n_po' );
$POFile = new i18n_PO( $sLanguageFile ); $POFile = new i18n_PO( $sLanguageFile );
$POFile->readInit(); $POFile->readInit();
@@ -297,8 +312,8 @@ class Language extends BaseLanguage
try { try {
$oTranslation = new Translation(); $oTranslation = new Translation();
$MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js"; $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js";
if ($_GET['LOCALE'] === "en" & file_exists($MichelangeloFE)) { if (file_exists($MichelangeloFE)) {
$labels = $this->readLabelsDirectory($MichelangeloFE, true); $labels = self::readLabelsDirectory($MichelangeloFE, true);
foreach ($labels as $label) { foreach ($labels as $label) {
$oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label);
} }
@@ -824,23 +839,23 @@ class Language extends BaseLanguage
} }
} }
public function readLabelsDirectory($path, $unique = false) public static function readLabelsDirectory($path, $unique = false)
{ {
$labels = array(); $labels = array();
$items = opendir($path); $items = opendir($path);
while (false !== ($item = readdir($items))) { while (false !== ($item = readdir($items))) {
$a = $path . "/" . $item; $a = $path . "/" . $item;
if ($item !== "." && $item !== ".." && is_dir($a)) { if ($item !== "." && $item !== ".." && is_dir($a)) {
$labels = array_merge($labels, $this->readLabelsDirectory($a, false)); $labels = array_merge($labels, self::readLabelsDirectory($a, false));
} }
if (is_file($a)) { if (is_file($a)) {
$info = pathinfo($a); $info = pathinfo($a);
if ($info["extension"] === "js" || $info["extension"] === "JS") { if ($info["extension"] === "js" || $info["extension"] === "JS") {
$file = file_get_contents($a); $file = file_get_contents($a);
//search string 'xx\'xx\'xx'.translate() //search string 'xx\'xx\'xx'.translate()
$labels = array_merge($labels, $this->readLabelsFile($file, "'")); $labels = array_merge($labels, self::readLabelsFile($file, "'"));
//search string "xx\"xx\"xx".translate() //search string "xx\"xx\"xx".translate()
$labels = array_merge($labels, $this->readLabelsFile($file, "\"")); $labels = array_merge($labels, self::readLabelsFile($file, "\""));
} }
} }
} }
@@ -851,7 +866,7 @@ class Language extends BaseLanguage
return $labels; return $labels;
} }
public function readLabelsFile($file, $sep) public static function readLabelsFile($file, $sep)
{ {
$labels = array(); $labels = array();
$k = 0; $k = 0;

View File

@@ -121,7 +121,9 @@ class ListInbox extends BaseListInbox
$users->refreshTotal($data['USR_UID'], 'add', 'participated'); $users->refreshTotal($data['USR_UID'], 'add', 'participated');
} }
$data['DEL_PRIORITY'] = $this->getTaskPriority($data['TAS_UID'], $data['PRO_UID'], $data["APP_UID"]); if((array_key_exists('TAS_UID', $data) && isset($data['TAS_UID'])) && (array_key_exists('TAS_UID', $data) && isset($data['PRO_UID'])) && isset($data['APP_UID'])) {
$data['DEL_PRIORITY'] = $this->getTaskPriority($data['TAS_UID'], $data['PRO_UID'], $data["APP_UID"]);
}
$con = Propel::getConnection( ListInboxPeer::DATABASE_NAME ); $con = Propel::getConnection( ListInboxPeer::DATABASE_NAME );
try { try {

View File

@@ -103,6 +103,31 @@ class Users extends BaseUsers
} }
} }
public function loadByEmail ($sUsrEmail)
{
$c = new Criteria( 'workflow' );
$c->clearSelectColumns();
$c->addSelectColumn( UsersPeer::USR_UID );
$c->addSelectColumn( UsersPeer::USR_USERNAME );
$c->addSelectColumn( UsersPeer::USR_STATUS );
$c->addSelectColumn( UsersPeer::USR_FIRSTNAME );
$c->addSelectColumn( UsersPeer::USR_LASTNAME );
$c->add( UsersPeer::USR_EMAIL, $sUsrEmail );
return $c;
}
public function loadByUserEmailInArray ($sUsrEmail)
{
$c = $this->loadByEmail( $sUsrEmail );
$rs = UsersPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
return $row;
}
public function loadDetails ($UsrUid) public function loadDetails ($UsrUid)
{ {
try { try {

View File

@@ -165,7 +165,7 @@ class TaskMapBuilder
$tMap->addValidator('TAS_ALERT', 'validValues', 'propel.validator.ValidValuesValidator', 'TRUE|FALSE', 'Please select a valid value for TAS_ALERT.'); $tMap->addValidator('TAS_ALERT', 'validValues', 'propel.validator.ValidValuesValidator', 'TRUE|FALSE', 'Please select a valid value for TAS_ALERT.');
$tMap->addValidator('TAS_ASSIGN_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'BALANCED|MANUAL|EVALUATE|REPORT_TO|SELF_SERVICE|STATIC_MI|CANCEL_MI', 'Please select a valid value for TAS_ASSIGN_TYPE.'); $tMap->addValidator('TAS_ASSIGN_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'BALANCED|MANUAL|EVALUATE|REPORT_TO|SELF_SERVICE|STATIC_MI|CANCEL_MI|MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED', 'Please set a valid value for TAS_ASSIGN_TYPE');
$tMap->addValidator('TAS_ASSIGN_LOCATION', 'validValues', 'propel.validator.ValidValuesValidator', 'TRUE|FALSE', 'Please select a valid value for TAS_ASSIGN_LOCATION.'); $tMap->addValidator('TAS_ASSIGN_LOCATION', 'validValues', 'propel.validator.ValidValuesValidator', 'TRUE|FALSE', 'Please select a valid value for TAS_ASSIGN_LOCATION.');

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -47,9 +47,11 @@ if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton(); if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=') ) { $licensedFeatures = & PMLicensedFeatures::getSingleton();
$G_TMP_MENU->AddIdRawOption('DASHBOARD+', 'strategicDashboard/main', G::LoadTranslation('ID_STRATEGIC_DASHBOARD'), '', '', '', 'x-pm-dashboard'); if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=') ) {
$G_TMP_MENU->AddIdRawOption('DASHBOARD+', 'strategicDashboard/main', G::LoadTranslation('ID_STRATEGIC_DASHBOARD'), '', '', '', 'x-pm-dashboard');
}
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/

View File

@@ -70,14 +70,75 @@ $_SESSION['TASK'] = $aFields['TAS_UID'];
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
/* Redirect to next step */ /* Redirect to next step */
$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], 0 );
if($aNextStep['UID'] != ''){ $cases = new Cases();
$sPage = "cases_StepToRevise?type=DYNAFORM&PRO_UID=" . $aFields['PRO_UID'] . "&DYN_UID=" . $aNextStep['UID'] . "&APP_UID=$sAppUid&DEL_INDEX=$iDelIndex&position=1"; //$aNextStep['PAGE'];
G::header( 'location: ' . $sPage ); $arrayDynaFormUid = array();
}else{ $arrayInputUid = array();
$resultDynaForm = $cases->getAllDynaformsStepsToRevise($aFields["APP_UID"]);
while ($resultDynaForm->next()) {
$row = $resultDynaForm->getRow();
$arrayDynaFormUid[$row["STEP_UID_OBJ"]] = $row["STEP_UID_OBJ"];
}
$resultInput = $cases->getAllInputsStepsToRevise($aFields["APP_UID"]);
while ($resultInput->next()) {
$row = $resultInput->getRow();
$arrayInputUid[$row["STEP_UID_OBJ"]] = $row["STEP_UID_OBJ"];
}
$criteria = new Criteria();
$criteria->addSelectColumn(StepPeer::STEP_TYPE_OBJ);
$criteria->addSelectColumn(StepPeer::STEP_UID_OBJ);
$criteria->add(StepPeer::PRO_UID, $aFields["PRO_UID"], Criteria::EQUAL);
$criteria->add(StepPeer::TAS_UID, $aFields["APP_DATA"]["TASK"], Criteria::EQUAL);
$criteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
$rsCriteria = StepPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$url = "";
$flag = false;
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$stepTypeObj = $row["STEP_TYPE_OBJ"];
$stepUidObj = $row["STEP_UID_OBJ"];
switch ($stepTypeObj) {
case "DYNAFORM":
if (isset($arrayDynaFormUid[$stepUidObj])) {
$url = "cases_StepToRevise?type=DYNAFORM&PRO_UID=" . $aFields["PRO_UID"] . "&DYN_UID=" . $stepUidObj . "&APP_UID=" . $sAppUid . "&DEL_INDEX=" . $iDelIndex . "&position=1";
$flag = true;
}
break;
case "INPUT_DOCUMENT":
if (isset($arrayInputUid[$stepUidObj])) {
$url = "cases_StepToReviseInputs?type=INPUT_DOCUMENT&PRO_UID=" . $aFields["PRO_UID"] . "&INP_DOC_UID=" . $stepUidObj . "&APP_UID=" . $sAppUid . "&position=" . $step["STEP_POSITION"] . "&DEL_INDEX=" . $iDelIndex;
$flag = true;
}
break;
}
if ($flag) {
break;
}
}
if ($flag) {
G::header("Location: " . $url);
} else {
$aMessage = array (); $aMessage = array ();
$aMessage['MESSAGE'] = G::LoadTranslation( 'ID_SUPERVISOR_DOES_NOT_HAVE_DYNAFORMS' ); $aMessage["MESSAGE"] = G::LoadTranslation("ID_SUPERVISOR_DOES_NOT_HAVE_DYNAFORMS");
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showMessage", "", $aMessage);
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage("publishBlank", "blank");
} }

View File

@@ -46,14 +46,10 @@ try {
* DYN_VERSION is 1: classic Dynaform, * DYN_VERSION is 1: classic Dynaform,
* DYN_VERSION is 2: responsive form, Pmdynaform. * DYN_VERSION is 2: responsive form, Pmdynaform.
*/ */
$a = new Criteria("workflow"); $dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
$a->add(DynaformPeer::DYN_UID, $_GET['UID'], Criteria::EQUAL); $swpmdynaform = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
$a = ProcessPeer::doSelectRS($a);
$a->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$a->next();
$row = $a->getRow();
$swpmdynaform = isset($row) && $row["DYN_VERSION"] == 2;
if ($swpmdynaform) { if ($swpmdynaform) {
$pmdynaform = $_POST["form"]; $pmdynaform = $_POST["form"];
} }
@@ -149,7 +145,7 @@ try {
$aRow = false; $aRow = false;
} }
} }
if ($aRow) { if ($aRow) {
foreach ($aValues as $sKey => $sValue) { foreach ($aValues as $sKey => $sValue) {
if ($sKey != $oForm->fields[$sField]->pmfield) { if ($sKey != $oForm->fields[$sField]->pmfield) {

View File

@@ -22,6 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
//validate the data post //validate the data post
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
if ($flagDynaFormNewVersion) {
$dataForm = $_POST["form"];
}
$oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM ); $oForm = new Form( $_SESSION['PROCESS'] . '/' . $_GET['UID'], PATH_DYNAFORM );
$oForm->validatePost(); $oForm->validatePost();
@@ -31,6 +40,11 @@ G::LoadClass( 'case' );
//load the variables //load the variables
$oCase = new Cases(); $oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] );
if ($flagDynaFormNewVersion) {
$Fields["APP_DATA"] = array_merge($Fields["APP_DATA"], $dataForm);
}
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] ); $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], $_POST['form'] );
//save data //save data

View File

@@ -163,7 +163,7 @@ if ($flagExecuteBeforeTriggers) {
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE', $Fields['APP_DATA'] ); $Fields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], $_GET['TYPE'], $_GET['UID'], 'BEFORE', $Fields['APP_DATA'] );
} else { } else {
unset($_SESSION['beforeTriggersExecuted']); unset($_SESSION['beforeTriggersExecuted']);
} }
//Execute before triggers - End //Execute before triggers - End
} else { } else {
unset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] ); unset( $_SESSION['_NO_EXECUTE_TRIGGERS_'] );
@@ -763,7 +763,6 @@ try {
} }
} //set priority value } //set priority value
//$sTask = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_UID']; //$sTask = $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_UID'];
//TAS_UID has a hidden field to store the TAS_UID //TAS_UID has a hidden field to store the TAS_UID
$hiddenName = "form[TASKS][" . $sKey . "][TAS_UID]"; $hiddenName = "form[TASKS][" . $sKey . "][TAS_UID]";
@@ -891,6 +890,18 @@ try {
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_FINISH_FLAG'] = true; $aFields['TASK'][$sKey]['NEXT_TASK']['ROU_FINISH_FLAG'] = true;
$aFields['PROCESS']['ROU_FINISH_FLAG'] = true; $aFields['PROCESS']['ROU_FINISH_FLAG'] = true;
break; break;
case "MULTIPLE_INSTANCE":
case "MULTIPLE_INSTANCE_VALUE_BASED":
$arrayAux = array();
foreach ($aValues["NEXT_TASK"]["USER_ASSIGNED"] as $value) {
$arrayAux[$value["USR_UID"]] = $value["USR_FULLNAME"];
}
asort($arrayAux);
$aFields["TASK"][$sKey]["NEXT_TASK"]["USR_UID"] = "<div style=\"overflow: auto; max-height: 200px;\">" . implode("<br />", $arrayAux) . "</div>";
break;
} }
$optionTaskType = (isset($aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TYPE"]))? $aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TYPE"] : ""; $optionTaskType = (isset($aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TYPE"]))? $aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TYPE"] : "";

View File

@@ -129,7 +129,7 @@ if ($_GET['DYN_UID'] != '') {
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID']; $FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID'];
$a = new pmDynaform($FieldsPmDynaform); $a = new pmDynaform($FieldsPmDynaform);
if ($a->isResponsive()) { if ($a->isResponsive()) {
$a->printView(); $a->printEditSupervisor();
}else{ }else{
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] ); $G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] );
} }

View File

@@ -101,5 +101,13 @@ $oHeadPublisher->assign( '_APP_UID', $_GET['APP_UID']);
$oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d' ) ) ); $oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d' ) ) );
$oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d-h-i-A' ) ); $oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d-h-i-A' ) );
$oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() ); $oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() );
$oHeadPublisher->assign( 'appStatus', $case['APP_STATUS'] );
if(!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
$_SESSION['APPLICATION'] = $case['APP_UID'];
$_SESSION['TASK'] = $case['TAS_UID'];
$_SESSION['INDEX'] = $case['DEL_INDEX'];
}
G::RenderPage( 'publish', 'extJs' ); G::RenderPage( 'publish', 'extJs' );

View File

@@ -38,6 +38,90 @@ if (preg_match("/^([\d\.]+).*$/", System::getVersion(), $arrayMatch)) {
$arrayImportFileExtension = array("pm", "pmx", "bpmn"); $arrayImportFileExtension = array("pm", "pmx", "bpmn");
$arrayMenuNewOption = array("pm" => true, "bpmn" => true); $arrayMenuNewOption = array("pm" => true, "bpmn" => true);
/*options menu*/
$arrayMenuNew = array();
$mnuNewBpmnProject = new stdClass();
$mnuNewBpmnProject->text = G::LoadTranslation("ID_NEW_BPMN_PROJECT");
$mnuNewBpmnProject->iconCls = "silk-add";
$mnuNewBpmnProject->icon = "";
$mnuNewBpmnProject->newProcessType = 'newProcess({type:"bpmnProject",title:"'.$mnuNewBpmnProject->text.'"})';
$mnuNewProject = new stdClass();
$mnuNewProject->text = G::LoadTranslation("ID_NEW_PROJECT");
$mnuNewProject->iconCls = "silk-add";
$mnuNewProject->icon = "";
$mnuNewProject->newProcessType = 'newProcess({type:"classicProject",title:"'.$mnuNewProject->text.'"})';
$menuOption = array("pm" => $mnuNewProject, "bpmn" => $mnuNewBpmnProject);
foreach($arrayMenuNewOption as $type => $val) {
if($val) {
array_push($arrayMenuNew, $menuOption[$type]);
}
}
/*right click menu*/
$contexMenuRightClick = array(
(object)array(
"text" => G::LoadTranslation("ID_EDIT"),
"iconCls" => "button_menu_ext ss_sprite ss_pencil",
"handler" => "editProcess()"
),
(object)array(
"id" => "activator2",
"text" => "",
"icon" => "",
"handler" => "activeDeactive()"
),
(object)array(
"id" => "debug",
"text" => "",
"handler" => "enableDisableDebug()"
),
(object)array(
"text" => G::LoadTranslation("ID_DELETE"),
"iconCls" => "button_menu_ext ss_sprite ss_cross",
"handler" => "deleteProcess()"
),
(object)array(
"text" => G::LoadTranslation("ID_EXPORT"),
"icon" => "/images/export.png",
"handler" => "exportProcess()"
),
(object)array(
"id" => "mnuGenerateBpmn",
"text" => G::LoadTranslation("ID_GENERATE_BPMN_PROJECT"),
"iconCls" => "button_menu_ext ss_sprite ss_page_white_go",
"hidden" => true,
"handler" => "generateBpmn()"
)
);
/*end right click menu*/
/*get registered options from plugin*/
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$fromPlugin = $oPluginRegistry->getDesignerNewOption();
$jsFromPlugin = false;
foreach($fromPlugin as $menuOptionFile) {
$menuOptionsFromPlugin = include_once($menuOptionFile->menuOptionFile);
if(isset($menuOptionsFromPlugin)) {
if(is_array($menuOptionsFromPlugin) && sizeof($menuOptionsFromPlugin)) {
if(is_array($menuOptionsFromPlugin[0]) && sizeof($menuOptionsFromPlugin[0])) {
$arrayMenuNew = array_merge($arrayMenuNew,$menuOptionsFromPlugin[0]);
}
if(is_array($menuOptionsFromPlugin[1]) && sizeof($menuOptionsFromPlugin[1])) {
$contexMenuRightClick = array_merge($contexMenuRightClick,$menuOptionsFromPlugin[1]);
}
if(isset($menuOptionsFromPlugin[2])) {
if(file_exists(PATH_PLUGINS.implode("/",array_slice(explode("/",$menuOptionsFromPlugin[2]),2)))) {
$jsFromPlugin = $menuOptionsFromPlugin[2];
}
}
}
}
}
/*end get registered options from plugin*/
/*end options menu*/
if ($pmVersion != "") { if ($pmVersion != "") {
$arrayImportFileExtension = (version_compare($pmVersion . "", "3", ">="))? $arrayImportFileExtension : array("pm"); $arrayImportFileExtension = (version_compare($pmVersion . "", "3", ">="))? $arrayImportFileExtension : array("pm");
$arrayMenuNewOption = (version_compare($pmVersion . "", "3", ">="))? array("bpmn" => true) : array("pm" => true); $arrayMenuNewOption = (version_compare($pmVersion . "", "3", ">="))? array("bpmn" => true) : array("pm" => true);
@@ -52,4 +136,8 @@ $oHeadPublisher->assign( 'pageSize', $conf->getEnvSetting( 'casesListRowNumber'
$oHeadPublisher->assign("arrayImportFileExtension", $arrayImportFileExtension); $oHeadPublisher->assign("arrayImportFileExtension", $arrayImportFileExtension);
$oHeadPublisher->assign("arrayMenuNewOption", $arrayMenuNewOption); $oHeadPublisher->assign("arrayMenuNewOption", $arrayMenuNewOption);
$oHeadPublisher->assign("arrayMenuNew", $arrayMenuNew);
$oHeadPublisher->assign("contexMenu", $contexMenuRightClick);
$oHeadPublisher->assign("jsFromPlugin", $jsFromPlugin);
G::RenderPage( 'publish', 'extJs' ); G::RenderPage( 'publish', 'extJs' );

View File

@@ -463,7 +463,6 @@ class Consolidated
$json = G::json_decode($dataTask["DYN_CONTENT"]); $json = G::json_decode($dataTask["DYN_CONTENT"]);
$pmDyna->jsonr($json); $pmDyna->jsonr($json);
$fieldsDyna = $json->items[0]->items; $fieldsDyna = $json->items[0]->items;
$xmlfrm = new \stdclass(); $xmlfrm = new \stdclass();
$xmlfrm->fields = array(); $xmlfrm->fields = array();
foreach ($fieldsDyna as $key => $value) { foreach ($fieldsDyna as $key => $value) {
@@ -478,7 +477,7 @@ class Consolidated
$temp->required = (isset($val->required)) ? $val->required : 0; $temp->required = (isset($val->required)) ? $val->required : 0;
$temp->mode = (isset($val->mode)) ? $val->mode : 'edit'; $temp->mode = (isset($val->mode)) ? $val->mode : 'edit';
if (!empty($val->options)) { if (!empty($val->options) || !empty($val->optionsSql)) {
$temp->storeData = '['; $temp->storeData = '[';
foreach ($val->options as $valueOption) { foreach ($val->options as $valueOption) {
if(isset($valueOption->value)){ if(isset($valueOption->value)){
@@ -487,6 +486,14 @@ class Consolidated
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],'; $temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
} }
} }
foreach ($val->optionsSql as $valueOption) {
if(isset($valueOption->value)){
$temp->storeData .= '["' . $valueOption->value . '", "' . $valueOption->label . '"],';
}else{
$temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
}
}
$temp->storeData = substr($temp->storeData,0,-1); $temp->storeData = substr($temp->storeData,0,-1);
$temp->storeData .= ']'; $temp->storeData .= ']';
} }

View File

@@ -473,12 +473,43 @@ class EmailEvent
throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST")); throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST"));
} }
$arrayData = $this->existsEvent($prj_uid, $eventUid); $arrayData = $this->existsEvent($prj_uid, $eventUid);
if(sizeof($arrayData)) { if(sizeof($arrayData)) {
$prfUid = $arrayData[6]; $emailGroupTo = array();
$filesManager = new \ProcessMaker\BusinessModel\FilesManager(); $emailTo = "";
$contentFile = $filesManager->getProcessFileManager($prj_uid, $prfUid); $prfUid = $arrayData[6];
\PMFSendMessage($appUID, $arrayData[3], $arrayData[4], '', '', $arrayData[5], $contentFile['prf_filename'], array()); $filesManager = new \ProcessMaker\BusinessModel\FilesManager();
$contentFile = $filesManager->getProcessFileManager($prj_uid, $prfUid);
if(strpos($arrayData[4],",")) {
$emailsArray = explode(",",$arrayData[4]);
foreach($emailsArray as $email) {
if(substr($email,0,1) == "@") {
$email = substr($email, 2,strlen($email));
if(isset($arrayApplicationData['APP_DATA'])) {
if(is_array($arrayApplicationData['APP_DATA']) && isset( $arrayApplicationData['APP_DATA'][$email])) {
$emailGroupTo[] = $arrayApplicationData['APP_DATA'][$email];
}
}
} else {
$emailGroupTo[] = $email;
}
}
$emailTo = implode(",",array_unique(array_filter($emailGroupTo)));
} else {
$email = $arrayData[4];
if(substr($email,0,1) == "@") {
$email = substr($email, 2,strlen($email));
if(isset($arrayApplicationData['APP_DATA'])) {
if(is_array($arrayApplicationData['APP_DATA']) && isset( $arrayApplicationData['APP_DATA'][$email])) {
$emailTo = $arrayApplicationData['APP_DATA'][$email];
}
}
} else {
$emailTo = $email;
}
}
if(!empty($emailTo)) {
\PMFSendMessage($appUID, $arrayData[3], $emailTo, '', '', $arrayData[5], $contentFile['prf_filename'], array());
}
} }
} }

View File

@@ -79,7 +79,9 @@ class Light
$newForm[$c]['title'] = $form['obj_title']; $newForm[$c]['title'] = $form['obj_title'];
$newForm[$c]['description'] = $form['obj_description']; $newForm[$c]['description'] = $form['obj_description'];
$newForm[$c]['stepId'] = $form["step_uid"]; $newForm[$c]['stepId'] = $form["step_uid"];
$newForm[$c]['stepUidObj'] = $form["step_uid_obj"];
$newForm[$c]['stepMode'] = $form['step_mode']; $newForm[$c]['stepMode'] = $form['step_mode'];
$newForm[$c]['stepPosition'] = $form['step_position'];
$trigger = $this->statusTriggers($step->doGetActivityStepTriggers($form["step_uid"], $tempTreeChild['taskId'], $tempTreeChild['processId'])); $trigger = $this->statusTriggers($step->doGetActivityStepTriggers($form["step_uid"], $tempTreeChild['taskId'], $tempTreeChild['processId']));
$newForm[$c]["triggers"] = $trigger; $newForm[$c]["triggers"] = $trigger;
$c++; $c++;
@@ -336,6 +338,48 @@ class Light
} }
/**
* Execute Trigger case
*
*/
public function doExecuteTriggerCase($usr_uid, $prj_uid, $act_uid, $cas_uid, $step_uid, $type)
{
$userData = $this->getUserData($usr_uid);
$c = new \Criteria();
$c->clearSelectColumns();
$c->addSelectColumn(\StepPeer::STEP_UID);
$c->addSelectColumn(\StepPeer::STEP_UID_OBJ);
$c->add(\StepPeer::TAS_UID, $act_uid);
$c->add(\StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');
$c->add(\StepPeer::STEP_UID, $step_uid);
$rs = \StepPeer::doSelectRS($c);
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$step_uid_obj = $row['STEP_UID_OBJ'];
$oCase = new \Cases();
$Fields = $oCase->loadCase( $cas_uid );
$_SESSION["APPLICATION"] = $cas_uid;
$_SESSION["PROCESS"] = $prj_uid;
$_SESSION["TASK"] = $act_uid;
$_SESSION["USER_LOGGED"] = $usr_uid;
$_SESSION["USR_USERNAME"] = $userData['firstName'];
$_SESSION["INDEX"] = $Fields["DEL_INDEX"] = \AppDelegation::getCurrentIndex($cas_uid);
$Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() );
$triggers = $oCase->loadTriggers( $act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type) );
if($triggers){
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type), $Fields['APP_DATA'] );
}
$Fields['TAS_UID'] = $act_uid;
$Fields['CURRENT_DYNAFORM'] = $step_uid_obj;
$Fields['USER_UID'] = $usr_uid;
$Fields['PRO_UID'] = $prj_uid;
$oCase->updateCase( $cas_uid, $Fields );
$response = array('status' => 'ok');
return $response;
}
/** /**
* Return Informaction User for derivate * Return Informaction User for derivate
* assignment Users * assignment Users
@@ -370,6 +414,17 @@ class Light
} }
} //set priority value } //set priority value
$taskType = (isset($aValues["NEXT_TASK"]["TAS_TYPE"]))? $aValues["NEXT_TASK"]["TAS_TYPE"] : false;
$taskMessage = "";
switch ($taskType) {
case "SCRIPT-TASK":
$taskMessage = G::LoadTranslation("ID_ROUTE_TO_TASK_SCRIPT_TASK");
break;
case "INTERMEDIATE-CATCH-TIMER-EVENT":
$taskMessage = G::LoadTranslation("ID_ROUTE_TO_TASK_INTERMEDIATE_CATCH_TIMER_EVENT");
break;
}
switch ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']) { switch ($aValues['NEXT_TASK']['TAS_ASSIGN_TYPE']) {
case 'EVALUATE': case 'EVALUATE':
case 'REPORT_TO': case 'REPORT_TO':
@@ -382,6 +437,7 @@ class Light
$taskAss['taskDefProcCode'] = $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE']; $taskAss['taskDefProcCode'] = $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'];
$taskAss['delPriority'] = isset($aValues['NEXT_TASK']['DEL_PRIORITY'])?$aValues['NEXT_TASK']['DEL_PRIORITY']:""; $taskAss['delPriority'] = isset($aValues['NEXT_TASK']['DEL_PRIORITY'])?$aValues['NEXT_TASK']['DEL_PRIORITY']:"";
$taskAss['taskParent'] = $aValues['NEXT_TASK']['TAS_PARENT']; $taskAss['taskParent'] = $aValues['NEXT_TASK']['TAS_PARENT'];
$taskAss['taskMessage'] = $taskType?$taskMessage:"";
$users = array(); $users = array();
$users['userId'] = $derive[$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_UID']; $users['userId'] = $derive[$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_UID'];
$users['userFullName'] = strip_tags($derive[$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']); $users['userFullName'] = strip_tags($derive[$sKey]['NEXT_TASK']['USER_ASSIGNED']['USR_FULLNAME']);
@@ -396,6 +452,7 @@ class Light
$manual['taskDefProcCode'] = $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE']; $manual['taskDefProcCode'] = $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'];
$manual['delPriority'] = isset($aValues['NEXT_TASK']['DEL_PRIORITY'])?$aValues['NEXT_TASK']['DEL_PRIORITY']:""; $manual['delPriority'] = isset($aValues['NEXT_TASK']['DEL_PRIORITY'])?$aValues['NEXT_TASK']['DEL_PRIORITY']:"";
$manual['taskParent'] = $aValues['NEXT_TASK']['TAS_PARENT']; $manual['taskParent'] = $aValues['NEXT_TASK']['TAS_PARENT'];
$manual['taskMessage'] = $taskType?$taskMessage:"";
$Aux = array (); $Aux = array ();
foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) { foreach ($aValues['NEXT_TASK']['USER_ASSIGNED'] as $aUser) {
$Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME']; $Aux[$aUser['USR_UID']] = $aUser['USR_FULLNAME'];

View File

@@ -239,6 +239,7 @@ class Task
$task = new \Task(); $task = new \Task();
$aTaskInfo = $task->load($arrayProperty["TAS_UID"]); $aTaskInfo = $task->load($arrayProperty["TAS_UID"]);
$bpmnActivity = \BpmnActivityPeer::retrieveByPK($act_uid);
$arrayResult = array(); $arrayResult = array();
if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") { if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") {
@@ -272,6 +273,17 @@ class Task
} }
} }
$flagTaskIsMultipleInstance = $bpmnActivity->getActType() == "TASK" && preg_match("/^(?:EMPTY|USERTASK|MANUALTASK)$/", $bpmnActivity->getActTaskType()) && $bpmnActivity->getActLoopType() == "PARALLEL";
$flagTaskAssignTypeIsMultipleInstance = preg_match("/^(?:MULTIPLE_INSTANCE|MULTIPLE_INSTANCE_VALUE_BASED)$/", $arrayProperty["TAS_ASSIGN_TYPE"]);
if ($flagTaskIsMultipleInstance && !$flagTaskAssignTypeIsMultipleInstance) {
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_INVALID_ASSIGNMENT_METHOD_FOR_MULTIPLE_INSTANCE_ACTIVITY", array(strtolower("ACT_UID"), $act_uid)));
}
if (!$flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance) {
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_INVALID_ASSIGNMENT_METHOD_FOR_ACTIVITY", array(strtolower("ACT_UID"), $act_uid)));
}
switch ($arrayProperty["TAS_ASSIGN_TYPE"]) { switch ($arrayProperty["TAS_ASSIGN_TYPE"]) {
case 'BALANCED': case 'BALANCED':
case 'MANUAL': case 'MANUAL':
@@ -329,6 +341,11 @@ class Task
$this->unsetVar($arrayProperty, "TAS_SELFSERVICE_EXECUTION"); $this->unsetVar($arrayProperty, "TAS_SELFSERVICE_EXECUTION");
} }
break; break;
case "MULTIPLE_INSTANCE_VALUE_BASED":
if (trim($arrayProperty["TAS_ASSIGN_VARIABLE"]) == "") {
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array(strtolower("TAS_ASSIGN_VARIABLE"))));
}
break;
} }
//Validating TAS_TRANSFER_FLY value //Validating TAS_TRANSFER_FLY value
@@ -1693,6 +1710,10 @@ class Task
'TU_TYPE' => $iType, 'TU_TYPE' => $iType,
'TU_RELATION' => 2)); 'TU_RELATION' => 2));
} }
$task = new \Task();
$result = $task->update(array("TAS_UID" => $sTaskUID, "TAS_TYPE" => "ADHOC"));
} }
} catch ( \Exception $e ) { } catch ( \Exception $e ) {
throw $e; throw $e;
@@ -1729,6 +1750,14 @@ class Task
$oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation); $oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation);
if (! is_null( $oTaskUser )) { if (! is_null( $oTaskUser )) {
\TaskUserPeer::doDelete($oCriteria); \TaskUserPeer::doDelete($oCriteria);
$arrayTaskAdhocAssignees = $this->getTaskAdhocAssignees($sProcessUID, $sTaskUID, "", null, null, "");
if (empty($arrayTaskAdhocAssignees)) {
$task = new \Task();
$result = $task->update(array("TAS_UID" => $sTaskUID, "TAS_TYPE" => "NORMAL"));
}
} else { } else {
throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST")); throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
} }

View File

@@ -0,0 +1,31 @@
<?php
namespace ProcessMaker\Services\Api\Google;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
class Authentication extends Api
{
/**
* Get token for user gmail
*
* @param array $request_data
*
* @return array
*
* @url POST /gmail
*
*
*/
public function doAuthenticationAccountGmail ($request_data) {
try{
$oGoogle = new \ProcessMaker\Services\Google\Authentication();
$response = $oGoogle->postTokenAccountGmail($request_data);
return $response;
} catch (\Exception $e){
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -614,6 +614,7 @@ class Light extends Api
$pmDynaForm->jsonr($result['formContent']); $pmDynaForm->jsonr($result['formContent']);
$result['index'] = $i; $result['index'] = $i;
$result['stepId'] = $activitySteps[$i]["step_uid"]; $result['stepId'] = $activitySteps[$i]["step_uid"];
$result['stepUidObj'] = $activitySteps[$i]["step_uid_obj"];
$result['stepMode'] = $activitySteps[$i]['step_mode']; $result['stepMode'] = $activitySteps[$i]['step_mode'];
$result['stepPosition'] = $activitySteps[$i]['step_position']; $result['stepPosition'] = $activitySteps[$i]['step_position'];
$trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"], $act_uid, $prj_uid)); $trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"], $act_uid, $prj_uid));
@@ -644,24 +645,8 @@ class Light extends Api
{ {
try { try {
$userUid = $this->getUserId(); $userUid = $this->getUserId();
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
$triggers= $step->doGetActivityStepTriggers($step_uid, $act_uid, $prj_uid);
$step = new \ProcessMaker\BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$oMobile = new \ProcessMaker\BusinessModel\Light(); $oMobile = new \ProcessMaker\BusinessModel\Light();
$response = $oMobile->getUserData($userUid); $response = $oMobile->doExecuteTriggerCase($userUid, $prj_uid, $act_uid, $cas_uid, $step_uid, $type);
$_SESSION["PROCESS"] = $prj_uid;
$_SESSION["TASK"] = $act_uid;
$_SESSION["USR_USERNAME"] = $response['firstName'];
$cases = new \ProcessMaker\BusinessModel\Cases();
foreach($triggers as $trigger){
if (strtolower($trigger['st_type']) == $type) {
$cases->putExecuteTriggerCase($cas_uid, $trigger['tri_uid'], $userUid);
}
}
$response = array('status' => 'ok');
} catch (\Exception $e) { } catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
} }
@@ -1319,6 +1304,7 @@ class Light extends Api
* *
* @return array * @return array
* *
* @access public
* @url GET /config * @url GET /config
*/ */
public function getConfiguration() public function getConfiguration()

View File

@@ -59,7 +59,7 @@ class Activity extends Api
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
} }
} }
/** /**
* @param string $pro_uid {@min 32} {@max 32} * @param string $pro_uid {@min 32} {@max 32}
@@ -98,7 +98,7 @@ class Activity extends Api
} }
} }
/** /**
* @param string $prj_uid {@min 32} {@max 32} * @param string $prj_uid {@min 32} {@max 32}
* @param string $act_uid {@min 32} {@max 32} * @param string $act_uid {@min 32} {@max 32}
@@ -233,7 +233,7 @@ class ActivityPropertiesStructure
public $tas_start; public $tas_start;
/** /**
* @var string {@from body} {@choice BALANCED,MANUAL,EVALUATE,REPORT_TO,SELF_SERVICE,SELF_SERVICE_EVALUATE} * @var string {@from body} {@choice BALANCED,MANUAL,EVALUATE,REPORT_TO,SELF_SERVICE,SELF_SERVICE_EVALUATE,MULTIPLE_INSTANCE,MULTIPLE_INSTANCE_VALUE_BASED}
*/ */
public $tas_assign_type; public $tas_assign_type;

View File

@@ -0,0 +1,74 @@
<?php
namespace ProcessMaker\Services\Google;
class Authentication
{
/**
* Post Token by user Gmail
*
* @param array $request_data
*
*/
public function postTokenAccountGmail($request_data)
{
$responseToken = array('msg' => \G::LoadTranslation( 'ID_UPGRADE_ENTERPRISE' ));
/*----------------------------------********---------------------------------*/
//Lets verify the gmail token
$url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='.$request_data['token'];
// init curl object
$ch = curl_init();
// define options
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true
);
// apply those options
curl_setopt_array($ch, $optArray);
// execute request and get response
$result = curl_exec($ch);
$response = (json_decode($result));
// Check if any error occurred
if(curl_errno($ch))
{
throw (new \Exception(\G::LoadTranslation( 'ID_TO_URL' )));
}
$info = curl_getinfo($ch);
curl_close($ch);
//If there is response
if($info['http_code'] == 200 && isset($response->email)){
//If the usermail that was send in the end point es the same of the one in the response
if($request_data['mail'] == $response->email){
$oUsers = new \Users();
$userExist = $oUsers->loadByUserEmailInArray($request_data['mail']);
if($userExist['USR_STATUS'] == "ACTIVE"){
//User Active! lets create the token and register it in the DB for this user
$oauthServer = new \ProcessMaker\Services\OAuth2\Server;
$server = $oauthServer->getServer();
$config = array(
'allow_implicit' => $server->getConfig('allow_implicit'),
'access_lifetime' => $server->getConfig('access_lifetime')
);
$storage = $server->getStorages();
$accessToken = new \OAuth2\ResponseType\AccessToken($storage['access_token'],$storage['refresh_token'],$config);
$responseToken = $accessToken->createAccessToken($request_data['clientid'], $userExist['USR_UID'],$request_data['scope']);
}else {
throw (new \Exception(\G::LoadTranslation( 'ID_ACTIVE_USERS' )));
}
} else {
throw (new \Exception(\G::LoadTranslation( 'ID_EMAIL_ENTER_VALID' )));
}
}else {
throw (new \Exception(\G::LoadTranslation( 'ID_PMGMAIL_VALID' )));
}
/*----------------------------------********---------------------------------*/
return $responseToken;
}
}

View File

@@ -114,3 +114,5 @@ debug = 1
[alias: catalog] [alias: catalog]
dashboard = "ProcessMaker\Services\Api\Catalog" dashboard = "ProcessMaker\Services\Api\Catalog"
[alias: google]
authentication = "ProcessMaker\Services\Api\Google\Authentication"

View File

@@ -458,6 +458,9 @@ Ext.onReady(function(){
Ext.getCmp('actionMenu').hide(); Ext.getCmp('actionMenu').hide();
hideCaseNavigatorPanel(); hideCaseNavigatorPanel();
if(typeof appStatus !== "undefined") {
showCaseNavigatorPanel(appStatus);
}
// Actions methods // Actions methods
@@ -1598,6 +1601,20 @@ Ext.onReady(function(){
] ]
}); });
var smodel = new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function (sm)
{
Ext.getCmp("btnAssignAdHocUser").setDisabled(false);
},
rowdeselect: function (sm)
{
Ext.getCmp("btnAssignAdHocUser").setDisabled(true);
}
}
});
pbark = new Ext.PagingToolbar({ pbark = new Ext.PagingToolbar({
pageSize: 8, pageSize: 8,
store: store, store: store,
@@ -1624,13 +1641,17 @@ Ext.onReady(function(){
viewConfig: { viewConfig: {
forceFit:true forceFit:true
}, },
cm: cmk,
store: store, store: store,
colModel: cmk,
selModel: smodel,
tbar:[ tbar:[
{ {
id: "btnAssignAdHocUser",
text:_('ID_ASSIGN'), text:_('ID_ASSIGN'),
iconCls: 'silk-add', iconCls: 'silk-add',
icon: '/images/cases-selfservice.png', icon: '/images/cases-selfservice.png',
disabled: true,
handler: assignAdHocUser handler: assignAdHocUser
} }
], ],
@@ -1653,32 +1674,44 @@ Ext.onReady(function(){
function assignAdHocUser() function assignAdHocUser()
{ {
rowSelected = adHocUserGrid.getSelectionModel().getSelected(); var rowSelected = adHocUserGrid.getSelectionModel().getSelected();
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_ADHOCUSER_CASE'), function(){
var loadMask = new Ext.LoadMask(document.body, {msg:_('ID_ASSIGNMENT_CASE')}); if (typeof(rowSelected) != "undefined") {
loadMask.show(); PMExt.confirm(
Ext.Ajax.request({ _("ID_CONFIRM"),
url : '../adhocUserProxy/reassignCase' , _("ID_CONFIRM_ADHOCUSER_CASE"),
method: 'POST', function ()
params : {USR_UID: rowSelected.data.USR_UID, THETYPE: 'ADHOC'}, {
success: function ( result, request ) { var loadMask = new Ext.LoadMask(document.body, {msg: _("ID_ASSIGNMENT_CASE")});
loadMask.hide();
var data = Ext.util.JSON.decode(result.responseText); loadMask.show();
if( data.success ) {
CloseWindow(); Ext.Ajax.request({
location.href = 'casesListExtJs'; url: "../adhocUserProxy/reassignCase",
} method: "POST",
else { params: {USR_UID: rowSelected.data.USR_UID, THETYPE: "ADHOC"},
PMExt.error(_('ID_ERROR'), data.msg); success: function (result, request)
} {
}, loadMask.hide();
failure: function ( result, request) { var data = Ext.util.JSON.decode(result.responseText);
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
} if (data.success) {
}); CloseWindow();
}); location.href = "casesListExtJs";
} } else {
PMExt.error(_("ID_ERROR"), data.msg);
}
},
failure: function (result, request)
{
Ext.MessageBox.alert(_("ID_FAILED"), result.responseText);
}
});
}
);
}
} }
}
CloseWindow = function(){ CloseWindow = function(){
Ext.getCmp('w').hide(); Ext.getCmp('w').hide();
@@ -1699,3 +1732,4 @@ Ext.onReady(function(){
node.select(); node.select();
} }

View File

@@ -55,7 +55,7 @@ var ldapFormAutoRegister = new Ext.form.ComboBox({
displayField: 'VALUE', displayField: 'VALUE',
value: '0', value: '0',
fieldLabel: '<span style="color: red">*</span>' + "Enable automatic register", fieldLabel: '<span style="color: red">*</span>' + _("ID_ENABLE_AUTOMATIC_REGISTER"),
typeAhead: true, typeAhead: true,
forceSelection: true, forceSelection: true,
triggerAction: 'all', triggerAction: 'all',
@@ -68,7 +68,7 @@ var ldapFormAutoRegister = new Ext.form.ComboBox({
}); });
var ldapFormServerName = new Ext.form.TextField({ var ldapFormServerName = new Ext.form.TextField({
fieldLabel: '<span style="color: red">*</span>' + "Server Address", fieldLabel: '<span style="color: red">*</span>' + _("ID_SERVER_ADDRESS"),
name: 'AUTH_SOURCE_SERVER_NAME', name: 'AUTH_SOURCE_SERVER_NAME',
id: 'AUTH_SOURCE_SERVER_NAME', id: 'AUTH_SOURCE_SERVER_NAME',
autoCreate: {tag: 'input', type: 'text', maxlength: '50'}, autoCreate: {tag: 'input', type: 'text', maxlength: '50'},
@@ -158,7 +158,7 @@ var ldapFormPassword = new Ext.form.TextField({
}); });
var ldapFormIdentifier = new Ext.form.TextField({ var ldapFormIdentifier = new Ext.form.TextField({
fieldLabel: '<span style="color: red">*</span>' + "User Identifier", fieldLabel: '<span style="color: red">*</span>' + _("ID_USER_IDENTIFIER"),
name: 'AUTH_SOURCE_IDENTIFIER_FOR_USER', name: 'AUTH_SOURCE_IDENTIFIER_FOR_USER',
id: 'AUTH_SOURCE_IDENTIFIER_FOR_USER', id: 'AUTH_SOURCE_IDENTIFIER_FOR_USER',
autoCreate: {tag: 'input', type: 'text', maxlength: '20'}, autoCreate: {tag: 'input', type: 'text', maxlength: '20'},
@@ -168,7 +168,7 @@ var ldapFormIdentifier = new Ext.form.TextField({
}); });
var ldapFormUsersFilter = new Ext.form.TextField({ var ldapFormUsersFilter = new Ext.form.TextField({
fieldLabel: "Filter to search users", fieldLabel: _("ID_FILTER_TO_SEARCH_USERS"),
name: 'AUTH_SOURCE_USERS_FILTER', name: 'AUTH_SOURCE_USERS_FILTER',
id: 'AUTH_SOURCE_USERS_FILTER', id: 'AUTH_SOURCE_USERS_FILTER',
autoCreate: {tag: 'input', type: 'text', maxlength: '200'}, autoCreate: {tag: 'input', type: 'text', maxlength: '200'},
@@ -177,7 +177,7 @@ var ldapFormUsersFilter = new Ext.form.TextField({
}); });
var ldapFormRetiredEmployees = new Ext.form.TextField({ var ldapFormRetiredEmployees = new Ext.form.TextField({
fieldLabel: "OU for Retired Employees OU", fieldLabel: _("ID_OU_FOR_RETIRED_EMPLOYEES_OU"),
name: 'AUTH_SOURCE_RETIRED_OU', name: 'AUTH_SOURCE_RETIRED_OU',
id: 'AUTH_SOURCE_RETIRED_OU', id: 'AUTH_SOURCE_RETIRED_OU',
autoCreate: {tag: 'input', type: 'text', maxlength: '128'}, autoCreate: {tag: 'input', type: 'text', maxlength: '128'},
@@ -219,7 +219,7 @@ var ldapFormData = new Ext.form.FieldSet({
id:'passwordReview', id:'passwordReview',
width: 300, width: 300,
style: 'font: 9px tahoma,arial,helvetica,sans-serif;', style: 'font: 9px tahoma,arial,helvetica,sans-serif;',
text: "(Default set to (&(!(objectClass=organizationalUnit))))", text: _("ID_DEFAULT_SET_TO"),
labelSeparator: '' labelSeparator: ''
}, ldapFormAttrinuteIds, ldapFormShowGrid, ldapFormGridText }, ldapFormAttrinuteIds, ldapFormShowGrid, ldapFormGridText
] ]

View File

@@ -140,7 +140,7 @@ Ext.onReady(function() {
hideable:false hideable:false
},{ },{
id: 'ATTRIBUTE_LDAP', id: 'ATTRIBUTE_LDAP',
header: "LDAP Field", header: _("ID_LDAP_FIELD"),
dataIndex: 'ATTRIBUTE_LDAP', dataIndex: 'ATTRIBUTE_LDAP',
width: 10, width: 10,
sortable: true, sortable: true,
@@ -148,7 +148,7 @@ Ext.onReady(function() {
}, },
{ {
id: 'ATTRIBUTE_USER', id: 'ATTRIBUTE_USER',
header: "User Field", header: _("ID_USER_FIELD"),
dataIndex: 'ATTRIBUTE_USER', dataIndex: 'ATTRIBUTE_USER',
width: 10, width: 10,
sortable: true, sortable: true,
@@ -158,6 +158,7 @@ Ext.onReady(function() {
var ldapGridEditor = new Ext.ux.grid.RowEditor({ var ldapGridEditor = new Ext.ux.grid.RowEditor({
saveText: _('ID_SAVE'), saveText: _('ID_SAVE'),
cancelText: _('ID_CANCEL'),
listeners: { listeners: {
canceledit: function(grid,obj){ canceledit: function(grid,obj){
// //
@@ -238,7 +239,7 @@ Ext.onReady(function() {
var chk = new Ext.form.Checkbox({ var chk = new Ext.form.Checkbox({
id: "AUTH_SOURCE_SHOWGRID-checkbox", id: "AUTH_SOURCE_SHOWGRID-checkbox",
name: "AUTH_SOURCE_SHOWGRID-checkbox", name: "AUTH_SOURCE_SHOWGRID-checkbox",
boxLabel: "Match attributes to sync", boxLabel: _("ID_MATCH_ATTRIBUTES_TO_SYNC"),
renderTo: "containerChkAttribute", renderTo: "containerChkAttribute",
listeners: { listeners: {
@@ -277,7 +278,7 @@ Ext.onReady(function() {
ldapForm.getForm().submit({ ldapForm.getForm().submit({
method: "POST", method: "POST",
waitTitle: "Connecting...", waitTitle: _('ID_CONNECTING'),
waitMsg: _("ID_SAVING"), waitMsg: _("ID_SAVING"),
success: function (form, action) success: function (form, action)
{ {
@@ -293,7 +294,7 @@ Ext.onReady(function() {
var ldapForm = new Ext.FormPanel({ var ldapForm = new Ext.FormPanel({
url : 'ldapAdvancedProxy.php?functionAccion=ldapSave', url : 'ldapAdvancedProxy.php?functionAccion=ldapSave',
frame : true, frame : true,
title : "Authentication Source Information", title : _("ID_AUTHENTICATION_SOURCE_INFORMATION"),
border : false, border : false,
autoScroll: true, autoScroll: true,
monitorValid : true, monitorValid : true,
@@ -325,7 +326,7 @@ Ext.onReady(function() {
{ {
columnWidth: 1, columnWidth: 1,
bodyStyle: "border: 0px;", bodyStyle: "border: 0px;",
html: "Minimum data required to run the \"Test Connection\": \"Server Address, " + _("ID_PORT") + ", " + _("ID_ENABLED_TLS") + ", " + _("ID_ANONYMOUS") + ", " + _("ID_USERNAME") + ", " + _("ID_PASSWORD") + "\"" html: _("ID_MINIMUM_DATA_REQUIRED_TO_RUN_THE")
} }
] ]
} }
@@ -379,11 +380,11 @@ Ext.onReady(function() {
} }
}, },
{ {
text: "Test connection", text: _('ID_TEST_CONNECTION'),
formBind: true, formBind: true,
handler: function () handler: function ()
{ {
var loadMaskAux = new Ext.LoadMask(Ext.getBody(), {msg: "Testing connection..."}); var loadMaskAux = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_TESTING_CONNECTION')});
loadMaskAux.show(); loadMaskAux.show();
Ext.Ajax.request({ Ext.Ajax.request({
@@ -406,8 +407,8 @@ Ext.onReady(function() {
if (dataResponse.status) { if (dataResponse.status) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: "Test connection", title: _('ID_TEST_CONNECTION'),
msg: (dataResponse.status == "OK")? "Successfully connected" : dataResponse.message, msg: (dataResponse.status == "OK")? _('ID_SUCCESSFULLY_CONNECTED') : dataResponse.message,
icon: (dataResponse.status == "OK")? "ext-mb-ok" : Ext.MessageBox.ERROR, icon: (dataResponse.status == "OK")? "ext-mb-ok" : Ext.MessageBox.ERROR,
buttons: {ok: _("ID_ACCEPT")} buttons: {ok: _("ID_ACCEPT")}

View File

@@ -30,7 +30,7 @@ Ext.onReady(function() {
{ {
xtype: 'button', xtype: 'button',
iconCls: 'button_menu_ext ss_sprite ss_magnifier', iconCls: 'button_menu_ext ss_sprite ss_magnifier',
text: 'Search', text: _('ID_SEARCH'),
width : 40, width : 40,
handler: function(){ handler: function(){
storeGridSearch.load({ params: {sKeyword: searchUsersText.getValue()} }); storeGridSearch.load({ params: {sKeyword: searchUsersText.getValue()} });
@@ -47,7 +47,7 @@ Ext.onReady(function() {
labelAlign: 'left', labelAlign: 'left',
align: 'center', align: 'center',
labelStyle: 'font-weight:bold; padding: 3px 3px 3px 15px;', labelStyle: 'font-weight:bold; padding: 3px 3px 3px 15px;',
title: "<div><div style=\"float: left;\">" + "Search for user" + "</div><div id=\"divBack\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>", title: "<div><div style=\"float: left;\">" + _('ID_SEARCH_FOR_USER') + "</div><div id=\"divBack\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>",
items: [ items: [
new Ext.FormPanel({ new Ext.FormPanel({
labelWidth : 120, labelWidth : 120,
@@ -129,7 +129,7 @@ Ext.onReady(function() {
var tbarSearch = [ var tbarSearch = [
{ {
id: 'BUTTON_IMPORT', id: 'BUTTON_IMPORT',
text: 'Import', text: _('ID_IMPORT'),
iconCls: 'button_menu_ext ss_sprite ss_group_go ', iconCls: 'button_menu_ext ss_sprite ss_group_go ',
disabled: true, disabled: true,
handler: function () { handler: function () {
@@ -163,8 +163,8 @@ Ext.onReady(function() {
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to import the selected users?', function (val) { Ext.MessageBox.confirm('Confirm', 'Are you sure you want to import the selected users?', function (val) {
if (val == 'yes') { if (val == 'yes') {
Ext.MessageBox.show({ Ext.MessageBox.show({
msg: 'Importing Users...', msg: _('ID_IMPORTING_USERS'),
progressText: 'Saving...', progressText: _('ID_SAVING'),
width:300, width:300,
wait:true, wait:true,
waitConfig: {interval:200}, waitConfig: {interval:200},
@@ -183,8 +183,8 @@ Ext.onReady(function() {
Ext.MessageBox.hide(); Ext.MessageBox.hide();
if (resp.success) { if (resp.success) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Import Users', title: _('ID_IMPORT_USERS'),
msg: 'Imported Successfully', msg: _('ID_IMPORTED_SUCCESSFULLY'),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
animEl: 'mb9', animEl: 'mb9',
icon: Ext.MessageBox.INFO icon: Ext.MessageBox.INFO
@@ -193,16 +193,16 @@ Ext.onReady(function() {
} }
}, },
failure: function () { failure: function () {
Ext.MessageBox.alert('ERROR', 'Error in server'); Ext.MessageBox.alert('ERROR', _('ID_ERROR_IN_SERVER'));
} }
}); });
} }
}); });
} else { } else {
PMExt.notify('WARNING', 'You do not select any user to import'); PMExt.notify('WARNING', _('ID_YOU_DO_NOT_SELECT_ANY_USER_TO_IMPORT'));
} }
} else { } else {
PMExt.notify('WARNING', 'You do not select any user to import'); PMExt.notify('WARNING', _('ID_YOU_DO_NOT_SELECT_ANY_USER_TO_IMPORT'));
} }
} }
} }
@@ -251,8 +251,8 @@ Ext.onReady(function() {
pageSize: pageSize, pageSize: pageSize,
store: storeGridSearch, store: storeGridSearch,
displayInfo: true, displayInfo: true,
displayMsg: "LDAP Users" + " {0} - {1} " + "of" + " {2}", displayMsg: _('ID_LDAP_USERS') + " {0} - {1} " + "of" + " {2}",
emptyMsg: "There are no LDAP Users" emptyMsg: _('ID_THERE_ARE_NO_LDAP_USERS')
}); });
var selectModelList = new Ext.grid.CheckboxSelectionModel({ var selectModelList = new Ext.grid.CheckboxSelectionModel({
@@ -282,11 +282,11 @@ Ext.onReady(function() {
}, },
columns: [ columns: [
selectModelList, selectModelList,
{header: 'Username', width: 15, dataIndex: 'sUsername', sortable: true}, {header: _('ID_USER_ID'), width: 15, dataIndex: 'sUsername', sortable: true},
{header: 'First Name', width: 15, dataIndex: 'sFirstname', sortable: true}, {header: _('ID_FIRST_NAME'), width: 15, dataIndex: 'sFirstname', sortable: true},
{header: 'Last Name', width: 15, dataIndex: 'sLastname', sortable: true}, {header: _('ID_LAST_NAME'), width: 15, dataIndex: 'sLastname', sortable: true},
{header: 'Email', width: 15, dataIndex: 'sEmail', sortable: true}, {header: _('ID_EMAIL'), width: 15, dataIndex: 'sEmail', sortable: true},
{header: 'Distinguished Name', width: 35, dataIndex: 'sDN'}, {header: _('ID_DISTINGUISHED_NAME'), width: 35, dataIndex: 'sDN'},
{dataIndex: "STATUS", header: _("ID_STATUS"), width: 10, css: "background: #D4D4D4; font-weight: bold;", align: "center", renderer: renderStatus} {dataIndex: "STATUS", header: _("ID_STATUS"), width: 10, css: "background: #D4D4D4; font-weight: bold;", align: "center", renderer: renderStatus}
] ]
}), }),
@@ -304,7 +304,7 @@ Ext.onReady(function() {
viewConfig: { viewConfig: {
forceFit:true, forceFit:true,
emptyText: '<div align="center"><b> ' + ' There are no LDAP Users ' + ' </b></div>' emptyText: '<div align="center"><b> ' + _('ID_THERE_ARE_NO_LDAP_USERS') + ' </b></div>'
} }
}); });

View File

@@ -1,56 +1,56 @@
var caseData = ''; var caseData = '';
var appTitle = new Ext.form.Label({ var appTitle = new Ext.form.Label({
fieldLabel: "Case Title", fieldLabel: _('ID_CASE_TITLE'),
labelStyle: 'font-weight:bold;padding-right:30px;' labelStyle: 'font-weight:bold;padding-right:30px;'
}); });
var process = new Ext.form.Label({ var process = new Ext.form.Label({
fieldLabel: "Process Uid", fieldLabel: _('ID_PROCESS_UID'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var processTitle = new Ext.form.Label({ var processTitle = new Ext.form.Label({
fieldLabel: "Process", fieldLabel: _('ID_PROCESS'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var appUid = new Ext.form.Label({ var appUid = new Ext.form.Label({
fieldLabel: "App Uid", fieldLabel: _('ID_APP_UID'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var caseNumber = new Ext.form.Label({ var caseNumber = new Ext.form.Label({
fieldLabel: "Case number", fieldLabel: _('ID_CASE_NUMBER'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var initUser = new Ext.form.Label({ var initUser = new Ext.form.Label({
fieldLabel: "Init user", fieldLabel: _('ID_INIT_USER'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var finishUser = new Ext.form.Label({ var finishUser = new Ext.form.Label({
fieldLabel: "Finish user", fieldLabel: _('ID_FINISH_USER'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var createDate = new Ext.form.Label({ var createDate = new Ext.form.Label({
fieldLabel: "Create date", fieldLabel: _('ID_CREATE_DATE'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var finishDate = new Ext.form.Label({ var finishDate = new Ext.form.Label({
fieldLabel: "Finish date", fieldLabel: _('ID_FINISH_DATE'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var fileName = new Ext.form.Label({ var fileName = new Ext.form.Label({
fieldLabel: "File Name", fieldLabel: _('ID_FILE_NAME'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
var statusCaseWin = new Ext.form.Label({ var statusCaseWin = new Ext.form.Label({
fieldLabel: "Status", fieldLabel: _('ID_CASESLIST_APP_STATUS'),
labelStyle: 'font-weight:bold;padding-right:35px;' labelStyle: 'font-weight:bold;padding-right:35px;'
}); });
@@ -82,8 +82,8 @@ var formCase = new Ext.FormPanel({
if (val == 'yes') { if (val == 'yes') {
dataCase = caseData; dataCase = caseData;
Ext.MessageBox.show({ Ext.MessageBox.show({
msg: "Restoring case" + ' ' + dataCase.CASE_NUMBER + ' ...', msg: _('ID_RESTORING_CASE') + ' ' + dataCase.CASE_NUMBER + ' ...',
progressText: 'Saving...', progressText: _('ID_SAVING'),
width:300, width:300,
wait:true, wait:true,
waitConfig: {interval:200}, waitConfig: {interval:200},
@@ -102,15 +102,15 @@ var formCase = new Ext.FormPanel({
var resp = Ext.decode(returnData.responseText); var resp = Ext.decode(returnData.responseText);
if (resp.success) { if (resp.success) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: 'Case Unarhive', title: _('ID_CASE_UNARHIVE'),
msg: "Case" + ' ' + dataCase.CASE_NUMBER + ' ' + "Restored sucessfully", msg: _('ID_CASE') + ' ' + dataCase.CASE_NUMBER + ' ' + _('ID_RESTORED_SUCESSFULLY'),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
animEl: 'mb9', animEl: 'mb9',
icon: Ext.MessageBox.INFO icon: Ext.MessageBox.INFO
}); });
} else { } else {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: "Error", title: _('ID_ERROR'),
msg: resp.message, msg: resp.message,
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
animEl: 'mb9', animEl: 'mb9',
@@ -121,7 +121,7 @@ var formCase = new Ext.FormPanel({
storeGridSearch.load(); storeGridSearch.load();
}, },
failure: function () { failure: function () {
Ext.MessageBox.alert("Error", "Error in server"); Ext.MessageBox.alert("Error", _('ID_ERROR_IN_SERVER'));
} }
}); });
} }
@@ -140,7 +140,7 @@ var formCase = new Ext.FormPanel({
}); });
var summaryWindow = new Ext.Window({ var summaryWindow = new Ext.Window({
title: "Detail Case", title: _('ID_DETAIL_CASE'),
layout: 'fit', layout: 'fit',
width: 500, width: 500,
height: 320, height: 320,

View File

@@ -178,38 +178,19 @@ Ext.onReady(function(){
items:[_('ID_PAGE_SIZE')+':',comboPageSize] items:[_('ID_PAGE_SIZE')+':',comboPageSize]
}) */ }) */
var mnuNewBpmnProject = { for(var k=0;k<arrayMenuNew.length;k++) {
text: "New BPMN Project", var handlerMenu = arrayMenuNew[k].handler;
iconCls: "silk-add", arrayMenuNew[k].handler = new Function(handlerMenu)
icon: "",
handler: function ()
{
newProcess({type:"bpmnProject"});
}
};
var mnuNewProject = {
text: "New Project",
iconCls: "silk-add",
icon: "",
handler: function ()
{
newProcess({type: "classicProject"});
}
};
var arrayMenuNew = [];
if (typeof(arrayMenuNewOption["bpmn"]) != "undefined") {
arrayMenuNew.push(mnuNewBpmnProject);
typeMnuNew = "bpmnProject";
} }
for(var j=0;j<contexMenu.length;j++) {
if (typeof(arrayMenuNewOption["pm"]) != "undefined") { var handlerMenu = contexMenu[j].handler;
arrayMenuNew.push(mnuNewProject); contexMenu[j].handler = new Function(handlerMenu)
typeMnuNew = "classicProject";
} }
if(jsFromPlugin) {
injectScriptElement(jsFromPlugin);
}
if(typeof(arrayMenuNewOption["bpmn"]) != "undefined" && typeof(arrayMenuNewOption["pm"]) != "undefined"){ if(typeof(arrayMenuNewOption["bpmn"]) != "undefined" && typeof(arrayMenuNewOption["pm"]) != "undefined"){
newTypeProcess = { newTypeProcess = {
xtype: 'tbsplit', xtype: 'tbsplit',
@@ -460,41 +441,7 @@ Ext.onReady(function(){
var messageContextMenu = new Ext.menu.Menu({ var messageContextMenu = new Ext.menu.Menu({
id: 'messageContextMenu', id: 'messageContextMenu',
items: [{ items: contexMenu
text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: editProcess
}, {
id: 'activator2',
text: '',
icon: '',
handler: activeDeactive
}, {
id: 'debug',
text: '',
handler: enableDisableDebug
}, {
text: _('ID_DELETE'),
iconCls: "button_menu_ext ss_sprite ss_cross",
handler: deleteProcess
}, {
text: _("ID_EXPORT"),
icon: "/images/export.png",
handler: function () {
exportProcess();
}
},
{
id: "mnuGenerateBpmn",
text: _("ID_GENERATE_BPMN_PROJECT"),
iconCls: "button_menu_ext ss_sprite ss_page_white_go",
hidden: true,
handler: function ()
{
generateBpmn();
}
}
]
}); });
var viewport = new Ext.Viewport({ var viewport = new Ext.Viewport({
@@ -512,7 +459,10 @@ function newProcess(params)
params = typeof params == 'undefined' ? {type:'classicProject'} : params; params = typeof params == 'undefined' ? {type:'classicProject'} : params;
// TODO this variable have hardcoded labels, it must be changed on the future // TODO this variable have hardcoded labels, it must be changed on the future
var formTitle = params.type == "classicProject" ? "New Project" : "New BPMN Project" var formTitle = params.title;
if(typeof formTitle === "undefined") {
formTitle = params.type == "classicProject" ? _('ID_NEW_PROJECT') : _('ID_NEW_BPMN_PROJECT');
}
// window.location = 'processes_New'; // window.location = 'processes_New';
var ProcessCategories = new Ext.form.ComboBox({ var ProcessCategories = new Ext.form.ComboBox({
@@ -647,6 +597,10 @@ function doSearch(){
editProcess = function(typeParam) editProcess = function(typeParam)
{ {
if(jsFromPlugin) {
pluginFunctions.onRowdblclick();
}
var rowSelected = processesGrid.getSelectionModel().getSelected(); var rowSelected = processesGrid.getSelectionModel().getSelected();
if (!rowSelected) { if (!rowSelected) {
Ext.Msg.show({ Ext.Msg.show({
@@ -1538,3 +1492,11 @@ function openWindowIfIE(pathDesigner) {
} }
location.href = pathDesigner; location.href = pathDesigner;
} }
function injectScriptElement(url, onLoad, onError, scope) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
return script;
}