HOR-358 "Create a PMFunction to get next derivation info" SOLVED
Issue:
Create a PMFunction to get next derivation info
Cause:
Requerimiento de nuevo "PM Function"
Solution:
Se ha creado la funcion: PMFGetNextDerivationInfo($caseUid, $delIndex)
This commit is contained in:
@@ -297,13 +297,11 @@ class Derivation
|
|||||||
|
|
||||||
//1. There is no rule
|
//1. There is no rule
|
||||||
if (empty($arrayNextTask)) {
|
if (empty($arrayNextTask)) {
|
||||||
$oProcess = new Process();
|
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||||
$oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] );
|
|
||||||
if(isset($oProcessFieds['PRO_BPMN']) && $oProcessFieds['PRO_BPMN'] == 1){
|
throw new Exception(G::LoadTranslation(
|
||||||
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_BPMN_RULE"));
|
'ID_NO_DERIVATION_' . (($bpmn->exists($arrayApplicationData['PRO_UID']))? 'BPMN_RULE' : 'RULE')
|
||||||
}else{
|
));
|
||||||
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
|
|||||||
@@ -2954,7 +2954,7 @@ function PMFSaveCurrentData ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
* @method
|
||||||
* Return an array of associative arrays which contain the unique task ID and title.
|
* Return an array of associative arrays which contain the unique task ID and title.
|
||||||
* @name PMFTasksListByProcessId
|
* @name PMFTasksListByProcessId
|
||||||
* @label PMF Tasks List By Process Id
|
* @label PMF Tasks List By Process Id
|
||||||
@@ -2999,23 +2999,23 @@ function PMFGetProcessUidByName($processName = '')
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$processUid = '';
|
$processUid = '';
|
||||||
|
|
||||||
if ($processName == '') {
|
if ($processName == '') {
|
||||||
//Return
|
//Return
|
||||||
return (isset($_SESSION['PROCESS']))? $_SESSION['PROCESS'] : false;
|
return (isset($_SESSION['PROCESS']))? $_SESSION['PROCESS'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
$criteria->addSelectColumn(ProcessPeer::PRO_UID);
|
$criteria->addSelectColumn(ProcessPeer::PRO_UID);
|
||||||
|
|
||||||
$criteria->addJoin(ContentPeer::CON_ID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
$criteria->addJoin(ContentPeer::CON_ID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||||
$criteria->add(ContentPeer::CON_VALUE, $processName, Criteria::EQUAL);
|
$criteria->add(ContentPeer::CON_VALUE, $processName, Criteria::EQUAL);
|
||||||
$criteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL);
|
$criteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = ContentPeer::doSelectRS($criteria);
|
$rsCriteria = ContentPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if ($rsCriteria->next()) {
|
if ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
$processUid = $row['PRO_UID'];
|
$processUid = $row['PRO_UID'];
|
||||||
@@ -3023,7 +3023,7 @@ function PMFGetProcessUidByName($processName = '')
|
|||||||
//Return
|
//Return
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $processUid;
|
return $processUid;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -3032,7 +3032,7 @@ function PMFGetProcessUidByName($processName = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
* @method
|
||||||
* The requested text in the specified language | If not found returns false
|
* The requested text in the specified language | If not found returns false
|
||||||
* @name PMFGeti18nText
|
* @name PMFGeti18nText
|
||||||
* @label PMF Get i18n Text
|
* @label PMF Get i18n Text
|
||||||
@@ -3061,9 +3061,9 @@ function PMFGeti18nText($id, $category, $lang = "en")
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @method
|
* @method
|
||||||
* Function to return an array of objects containing the properties of the fields
|
* Function to return an array of objects containing the properties of the fields
|
||||||
* in a specified DynaForm.
|
* in a specified DynaForm.
|
||||||
* It also inserts the "value" and "value_label" as properties in the fields' objects,
|
* It also inserts the "value" and "value_label" as properties in the fields' objects,
|
||||||
* if the case is specified.
|
* if the case is specified.
|
||||||
* @name PMFDynaFormFields
|
* @name PMFDynaFormFields
|
||||||
* @label PMF DynaForm Fields
|
* @label PMF DynaForm Fields
|
||||||
@@ -3229,4 +3229,92 @@ function PMFGetGroupUsers($GroupUID)
|
|||||||
$usersGroup = $groups->getUsersOfGroup($GroupUID, 'ALL');
|
$usersGroup = $groups->getUsersOfGroup($GroupUID, 'ALL');
|
||||||
return $usersGroup;
|
return $usersGroup;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method
|
||||||
|
*
|
||||||
|
* Get next derivation info
|
||||||
|
*
|
||||||
|
* @name PMFGetNextDerivationInfo
|
||||||
|
* @label PMF Get next derivation info
|
||||||
|
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetNextDerivationInfo.28.29
|
||||||
|
*
|
||||||
|
* @param string(32) | $caseUid | ID of the case | The unique ID of the case
|
||||||
|
* @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case
|
||||||
|
*
|
||||||
|
* @return array | $arrayNextDerivationInfo | Next derivation info | Returns the next derivation info, FALSE otherwise
|
||||||
|
*/
|
||||||
|
function PMFGetNextDerivationInfo($caseUid, $delIndex)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$arrayNextDerivationInfo = [];
|
||||||
|
|
||||||
|
//Verify data and Set variables
|
||||||
|
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||||
|
|
||||||
|
$arrayAppDelegationData = $case->getAppDelegationRecordByPk(
|
||||||
|
$caseUid,
|
||||||
|
$delIndex,
|
||||||
|
['$applicationUid' => '$caseUid', '$delIndex' => '$delIndex'],
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($arrayAppDelegationData === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set variables
|
||||||
|
$processUid = $arrayAppDelegationData['PRO_UID'];
|
||||||
|
$userUid = $arrayAppDelegationData['USR_UID'];
|
||||||
|
|
||||||
|
//Get next derivation
|
||||||
|
$derivation = new Derivation();
|
||||||
|
|
||||||
|
$arrayData = $derivation->prepareInformation([
|
||||||
|
'APP_UID' => $caseUid,
|
||||||
|
'DEL_INDEX' => $delIndex,
|
||||||
|
'USER_UID' => $userUid //User logged
|
||||||
|
]);
|
||||||
|
|
||||||
|
$task = new \ProcessMaker\BusinessModel\Task();
|
||||||
|
|
||||||
|
foreach ($arrayData as $value) {
|
||||||
|
$arrayInfo = $value;
|
||||||
|
|
||||||
|
$nextTaskUid = $arrayInfo['NEXT_TASK']['TAS_UID'];
|
||||||
|
|
||||||
|
$arrayUserUid = [];
|
||||||
|
$arrayGroupUid = [];
|
||||||
|
|
||||||
|
if ($nextTaskUid != '-1') {
|
||||||
|
$arrayResult = $task->getTaskAssignees($processUid, $nextTaskUid, 'ASSIGNEE', 1);
|
||||||
|
|
||||||
|
foreach ($arrayResult['data'] as $value2) {
|
||||||
|
$arrayAssigneeData = $value2;
|
||||||
|
|
||||||
|
switch ($arrayAssigneeData['aas_type']) {
|
||||||
|
case 'user':
|
||||||
|
$arrayUserUid[] = $arrayAssigneeData['aas_uid'];
|
||||||
|
break;
|
||||||
|
case 'group':
|
||||||
|
$arrayGroupUid[] = $arrayAssigneeData['aas_uid'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayNextDerivationInfo[] = [
|
||||||
|
'taskUid' => $nextTaskUid,
|
||||||
|
'users' => $arrayUserUid,
|
||||||
|
'groups' => $arrayGroupUid,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $arrayNextDerivationInfo;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user