fix in method
This commit is contained in:
@@ -51,7 +51,7 @@ class Derivation
|
|||||||
protected $flagControl;
|
protected $flagControl;
|
||||||
protected $flagControlMulInstance;
|
protected $flagControlMulInstance;
|
||||||
private $regexpTaskTypeToInclude;
|
private $regexpTaskTypeToInclude;
|
||||||
public $flagSanity = false;
|
// public $flagSanity = false;
|
||||||
public $node;
|
public $node;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@@ -259,9 +259,7 @@ class Derivation
|
|||||||
|
|
||||||
//Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT
|
//Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT
|
||||||
$arrayNextTaskBackup = $arrayNextTask;
|
$arrayNextTaskBackup = $arrayNextTask;
|
||||||
if ($this->flagSanity) {
|
|
||||||
//$arrayNextTaskBackup = $this->preSanity($arrayNextTask);
|
|
||||||
}
|
|
||||||
$arrayNextTask = array();
|
$arrayNextTask = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($arrayNextTaskBackup as $value) {
|
foreach ($arrayNextTaskBackup as $value) {
|
||||||
@@ -333,87 +331,6 @@ class Derivation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preSanity($arrayNextTask)
|
|
||||||
{
|
|
||||||
$arrayNextTaskResponse = array();
|
|
||||||
if ($arrayNextTask) {
|
|
||||||
$arrayTask = array();
|
|
||||||
$arrayNotTask = array();
|
|
||||||
$regex = "END-MESSAGE-EVENT|END-EMAIL-EVENT|SCRIPT-TASK|INTERMEDIATE-CATCH-TIMER-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT";
|
|
||||||
foreach ($arrayNextTask as $index => $item) {
|
|
||||||
if (($item["NEXT_TASK"]["TAS_UID"] != "-1" &&
|
|
||||||
preg_match("/^(?:" . $regex . ")$/", $item["NEXT_TASK"]["TAS_TYPE"]))
|
|
||||||
) {
|
|
||||||
$arrayNotTask[] = $index;
|
|
||||||
} else {
|
|
||||||
$arrayTask[] = $index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($arrayTask) {
|
|
||||||
foreach ($arrayNotTask as $item) {
|
|
||||||
unset($arrayNextTask[$item]);
|
|
||||||
}
|
|
||||||
$arrayNextTaskResponse = array_values($arrayNextTask);
|
|
||||||
} else {
|
|
||||||
$pos = array_shift($arrayNotTask);
|
|
||||||
$arrayNextTaskResponse[] = $arrayNextTask[$pos];
|
|
||||||
foreach ($arrayNextTask as $nextTask) {
|
|
||||||
$flag = false;
|
|
||||||
foreach ($arrayNextTaskResponse as $task) {
|
|
||||||
if (!in_array($nextTask['ROU_NEXT_TASK'], $task, true)) {
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($flag) {
|
|
||||||
$arrayNextTaskResponse[] = $nextTask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $arrayNextTaskResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function postSanity($arrayNextTask)
|
|
||||||
{
|
|
||||||
$arrayNextTaskResponse = array();
|
|
||||||
if ($arrayNextTask) {
|
|
||||||
$arrayTask = array();
|
|
||||||
$arrayNotTask = array();
|
|
||||||
$regex = "GATEWAYTOGATEWAY|END-MESSAGE-EVENT|END-EMAIL-EVENT|INTERMEDIATE-CATCH-TIMER-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT";
|
|
||||||
foreach ($arrayNextTask as $index => $item) {
|
|
||||||
if (($item["NEXT_TASK"]["TAS_UID"] != "-1" &&
|
|
||||||
preg_match("/^(?:" . $regex . ")$/", $item["NEXT_TASK"]["TAS_TYPE"]))
|
|
||||||
|| $item['ROU_TYPE'] == "SEC-JOIN"
|
|
||||||
) {
|
|
||||||
$arrayNotTask[] = $index;
|
|
||||||
} else {
|
|
||||||
$arrayTask[] = $index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($arrayTask) {
|
|
||||||
foreach ($arrayNotTask as $item) {
|
|
||||||
unset($arrayNextTask[$item]);
|
|
||||||
}
|
|
||||||
$arrayNextTaskResponse = array_values($arrayNextTask);
|
|
||||||
} else {
|
|
||||||
$pos = array_shift($arrayNotTask);
|
|
||||||
$arrayNextTaskResponse[] = $arrayNextTask[$pos];
|
|
||||||
foreach ($arrayNextTask as $nextTask) {
|
|
||||||
$flag = false;
|
|
||||||
foreach ($arrayNextTaskResponse as $task) {
|
|
||||||
if (!in_array($nextTask['ROU_NEXT_TASK'], $task, true)) {
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($flag) {
|
|
||||||
$arrayNextTaskResponse[] = $nextTask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return array_combine(range(1, count($arrayNextTaskResponse)), array_values($arrayNextTaskResponse));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getRouteCondition
|
* getRouteCondition
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ namespace ProcessMaker\Core;
|
|||||||
|
|
||||||
class RoutingScreen extends \Derivation
|
class RoutingScreen extends \Derivation
|
||||||
{
|
{
|
||||||
public $convergent = 0;
|
protected $convergent;
|
||||||
public $divergent = 0;
|
protected $divergent;
|
||||||
public $gateway = array('PARALLEL', 'PARALLEL-BY-EVALUATION');
|
public $gateway = array('PARALLEL', 'PARALLEL-BY-EVALUATION');
|
||||||
public $isFirst;
|
public $isFirst;
|
||||||
|
protected $taskSecJoin;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setRegexpTaskTypeToInclude("GATEWAYTOGATEWAY|END-MESSAGE-EVENT|END-EMAIL-EVENT|INTERMEDIATE-CATCH-TIMER-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT");
|
$this->setRegexpTaskTypeToInclude("GATEWAYTOGATEWAY|END-MESSAGE-EVENT|END-EMAIL-EVENT|INTERMEDIATE-CATCH-TIMER-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT");
|
||||||
$this->flagSanity = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mergeDataDerivation($post, $prepareInformation)
|
public function mergeDataDerivation($post, $prepareInformation)
|
||||||
@@ -45,47 +45,65 @@ class RoutingScreen extends \Derivation
|
|||||||
|
|
||||||
public function prepareRoutingScreen($arrayData)
|
public function prepareRoutingScreen($arrayData)
|
||||||
{
|
{
|
||||||
$array = $this->postSanity($this->prepareInformation($arrayData));
|
$information= $this->prepareInformation($arrayData);
|
||||||
return $array;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function postSanity($arrayInformation)
|
|
||||||
{
|
|
||||||
$response = array();
|
$response = array();
|
||||||
foreach ($arrayInformation as $index => $element) {
|
$this->taskSecJoin = array();
|
||||||
$this->divergent = 0;
|
foreach ($information as $index => $element) {
|
||||||
$this->convergent = 0;
|
$this->divergent = array();
|
||||||
|
$this->convergent = array();
|
||||||
$this->isFirst = true;
|
$this->isFirst = true;
|
||||||
if ($this->checkElement($this->node[$element['TAS_UID']])) {
|
$x = $this->checkElement($this->node[$element['TAS_UID']]);
|
||||||
$response[] = $element;
|
if ($x) {
|
||||||
|
$save = false;
|
||||||
|
foreach ($response as $task) {
|
||||||
|
if (!in_array($element['ROU_NEXT_TASK'], $task, true)) {
|
||||||
|
$save = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((!$response || $save)) {
|
||||||
|
$response[] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($response) > 1){
|
||||||
|
foreach ($response as $index => $task) {
|
||||||
|
$delete = false;
|
||||||
|
foreach ($this->taskSecJoin as $tj => $type) {
|
||||||
|
if (in_array($tj, $task, true)) {
|
||||||
|
$delete = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($delete) {
|
||||||
|
unset($response[$index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array_combine(range(1, count($response)), array_values($response));
|
return array_combine(range(1, count($response)), array_values($response));
|
||||||
//return parent::postSanity($arrayNextTask); // TODO: Change the autogenerated stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkElement($element)
|
public function checkElement($element)
|
||||||
{
|
{
|
||||||
if (empty($element['in'])) {
|
if (empty($element['in'])) {
|
||||||
$x = 1;
|
return true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
$outElement = $element['out'];
|
$outElement = $element['out'];
|
||||||
foreach ($outElement as $index => $outE) {
|
foreach ($outElement as $indexO => $outE) {
|
||||||
if (!$this->isFirst && in_array($outE, $this->gateway)) {
|
if (!$this->isFirst && in_array($outE, $this->gateway)) {
|
||||||
$this->divergent++;
|
$this->divergent[$indexO] = $outE;
|
||||||
|
}
|
||||||
|
if ($outE == 'SEC-JOIN' && strpos($indexO, 'itee') === false) {
|
||||||
|
$this->taskSecJoin[$indexO] = $outE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->isFirst = false;
|
$this->isFirst = false;
|
||||||
$inElement = $element['in'];
|
$inElement = $element['in'];
|
||||||
foreach ($inElement as $index => $inE) {
|
foreach ($inElement as $indexI => $inE) {
|
||||||
if ($inE == 'SEC-JOIN') {
|
if ($inE == 'SEC-JOIN') {
|
||||||
$this->convergent++;
|
$this->convergent[$indexI]=$inE;
|
||||||
}
|
}
|
||||||
$this->checkElement($this->node[$index]);
|
$this->checkElement($this->node[$indexI]);
|
||||||
}
|
}
|
||||||
//$this->checkElement($inElement);
|
return count($this->convergent) == 0 || count($this->convergent) == count($this->divergent);
|
||||||
return $this->convergent == 0 || $this->convergent == $this->divergent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user