This commit is contained in:
Paula Quispe
2018-05-22 15:15:16 -04:00
parent 8487e072d9
commit 363a63991c
9 changed files with 180 additions and 89 deletions

View File

@@ -2,7 +2,12 @@
namespace ProcessMaker\BusinessModel\Light;
use AppDelegationPeer;
use Cases as ClassesCases;
use G;
use PmDynaform;
use Process as ClassesProcess;
use ResultSet;
class Tracker
{
@@ -73,37 +78,46 @@ class Tracker
}
/**
* This function get the case history related to the case
*
* @param string $idProcess
* @param string $appUid
*
* @return array
*/
public function history($idProcess, $appUid)
{
$oCase = new \Cases();
$aFields = $oCase->loadCase( $appUid );
$case = new ClassesCases();
$fields = $case->loadCase($appUid);
$oProcess = new \Process();
$aProcessFieds = $oProcess->load( $idProcess );
$process = new ClassesProcess();
$processFields = $process->load($idProcess);
$noShowTitle = 0;
if (isset( $aProcessFieds['PRO_SHOW_MESSAGE'] )) {
$noShowTitle = $aProcessFieds['PRO_SHOW_MESSAGE'];
if (isset($processFields['PRO_SHOW_MESSAGE'])) {
$noShowTitle = $processFields['PRO_SHOW_MESSAGE'];
}
if (isset( $aFields['TITLE'] )) {
$aFields['APP_TITLE'] = $aFields['TITLE'];
if (isset($fields['TITLE'])) {
$fields['APP_TITLE'] = $fields['TITLE'];
}
if ($aFields['APP_PROC_CODE'] != '') {
$aFields['APP_NUMBER'] = $aFields['APP_PROC_CODE'];
if ($fields['APP_PROC_CODE'] != '') {
$fields['APP_NUMBER'] = $fields['APP_PROC_CODE'];
}
$aFields['CASE'] = \G::LoadTranslation( 'ID_CASE' );
$aFields['TITLE'] = \G::LoadTranslation( 'ID_TITLE' );
$fields['CASE'] = G::LoadTranslation('ID_CASE');
$fields['TITLE'] = G::LoadTranslation('ID_TITLE');
$c = \Cases::getTransferHistoryCriteria( $appUid );
$dataset = \AppDelegationPeer::doSelectRS( $c );
$dataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$c = ClassesCases::getTransferHistoryCriteria($fields['APP_NUMBER']);
$dataset = AppDelegationPeer::doSelectRS($c);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$history = array();
$history = [];
while ($row = $dataset->getRow()) {
$history[] = $row;
$dataset->next();
}
$response = $this->parserHistory($history);
return $response;
}

View File

@@ -2,9 +2,14 @@
namespace ProcessMaker\Project\Adapter;
use BpmnFlow;
use BpmnFlowPeer;
use Exception;
use ProcessMaker\BusinessModel\ElementTaskRelation;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Project;
use ProcessMaker\Util;
use ProcessMaker\Util\Common;
/**
* Class BpmnWorkflow
@@ -777,39 +782,39 @@ class BpmnWorkflow extends Project\Bpmn
}
}
/*
public function updateEventStartObjects($eventUid, $taskUid)
{
$event = \BpmnEventPeer::retrieveByPK($eventUid);
//Case-Scheduler - Update
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "TIMER") {
$caseScheduler = new \CaseScheduler();
if ($caseScheduler->Exists($eventUid)) {
$this->wp->updateCaseScheduler($eventUid, array("TAS_UID" => $taskUid));
}
}
//Update web entry
//if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "MESSAGE") {
// $this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
//}
}
*/
private function __createTaskByElement($elementUid, $elementType, $key)
/**
* This function get the TAS_UID
* Create or just return the value
*
* @param string $elementUid
* @param string $elementType
* @param string $key
* @param string $eventName
*
* @return string
* @throws Exception
*/
private function __createTaskByElement($elementUid, $elementType, $key, $eventName = '')
{
try {
$taskTitle = $taskType = $this->arrayTaskAttribute[$key]["type"];
/*----------------------------------********---------------------------------*/
$taskTitle = empty($eventName) ? $taskType : $eventName;
/*----------------------------------********---------------------------------*/
if (isset($this->arrayElementTaskRelation[$elementUid])) {
$taskUid = $this->arrayElementTaskRelation[$elementUid];
/*----------------------------------********---------------------------------*/
$dataTask = ["TAS_TITLE" => $taskTitle];
$this->wp->updateTask($taskUid, $dataTask);
/*----------------------------------********---------------------------------*/
} else {
$taskPosX = 0;
$taskPosY = 0;
$flow = \BpmnFlow::findOneBy(array(
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $elementUid,
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => $elementType
$flow = BpmnFlow::findOneBy(array(
BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $elementUid,
BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => $elementType
));
if (!is_null($flow)) {
@@ -818,9 +823,9 @@ class BpmnWorkflow extends Project\Bpmn
$taskPosX = (int)($arrayFlowData["FLO_X1"]);
$taskPosY = (int)($arrayFlowData["FLO_Y1"]);
} else {
$flow = \BpmnFlow::findOneBy(array(
\BpmnFlowPeer::FLO_ELEMENT_DEST => $elementUid,
\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => $elementType
$flow = BpmnFlow::findOneBy(array(
BpmnFlowPeer::FLO_ELEMENT_DEST => $elementUid,
BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => $elementType
));
if (!is_null($flow)) {
@@ -832,18 +837,16 @@ class BpmnWorkflow extends Project\Bpmn
}
$prefix = $this->arrayTaskAttribute[$key]["prefix"];
$taskType = $this->arrayTaskAttribute[$key]["type"];
$taskUid = $this->wp->addTask(array(
"TAS_UID" => $prefix . substr(Util\Common::generateUID(), (32 - strlen($prefix)) * -1),
$taskUid = $this->wp->addTask([
"TAS_UID" => $prefix . substr(Common::generateUID(), (32 - strlen($prefix)) * -1),
"TAS_TYPE" => $taskType,
"TAS_TITLE" => $taskType,
"TAS_TITLE" => $taskTitle,
"TAS_POSX" => $taskPosX,
"TAS_POSY" => $taskPosY
));
]);
//Element-Task-Relation - Create
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
$elementTaskRelation = new ElementTaskRelation();
$arrayResult = $elementTaskRelation->create(
$this->wp->getUid(),
@@ -860,7 +863,7 @@ class BpmnWorkflow extends Project\Bpmn
//Return
return $taskUid;
} catch (\Exception $e) {
} catch (Exception $e) {
throw $e;
}
}
@@ -1026,7 +1029,8 @@ class BpmnWorkflow extends Project\Bpmn
$taskUid = $this->__createTaskByElement(
$eventUid,
"bpmnEvent",
$arrayKey[$arrayEventData["EVN_MARKER"]]
$arrayKey[$arrayEventData["EVN_MARKER"]],
isset($arrayEventData["EVN_NAME"]) ? $arrayEventData["EVN_NAME"] : ''
);
$result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);