change in methods
This commit is contained in:
@@ -52,6 +52,7 @@ class Derivation
|
|||||||
protected $flagControlMulInstance;
|
protected $flagControlMulInstance;
|
||||||
private $regexpTaskTypeToInclude;
|
private $regexpTaskTypeToInclude;
|
||||||
public $flagSanity = false;
|
public $flagSanity = false;
|
||||||
|
public $node;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -259,18 +260,19 @@ 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) {
|
if ($this->flagSanity) {
|
||||||
$arrayNextTaskBackup = $this->preSanity($arrayNextTask);
|
//$arrayNextTaskBackup = $this->preSanity($arrayNextTask);
|
||||||
}
|
}
|
||||||
$arrayNextTask = array();
|
$arrayNextTask = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($arrayNextTaskBackup as $value) {
|
foreach ($arrayNextTaskBackup as $value) {
|
||||||
$arrayNextTaskData = $value;
|
$arrayNextTaskData = $value;
|
||||||
|
$this->node[$value['TAS_UID']]['out'][$value['ROU_NEXT_TASK']] = $value['ROU_TYPE'];
|
||||||
|
//$this->node[$value['TAS_UID']]['type'][] = $value['ROU_TYPE'];
|
||||||
if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" &&
|
if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" &&
|
||||||
preg_match("/^(?:" . $this->regexpTaskTypeToInclude . ")$/", $arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"])
|
preg_match("/^(?:" . $this->regexpTaskTypeToInclude . ")$/", $arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"])
|
||||||
) {
|
) {
|
||||||
$arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]);
|
$arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]);
|
||||||
|
$this->node[$value['ROU_NEXT_TASK']]['in'][$value['TAS_UID']] = $value['ROU_TYPE'];
|
||||||
foreach ($arrayAux as $value2) {
|
foreach ($arrayAux as $value2) {
|
||||||
$key = ++$i;
|
$key = ++$i;
|
||||||
$arrayNextTask[$key] = $value2;
|
$arrayNextTask[$key] = $value2;
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ namespace ProcessMaker\Core;
|
|||||||
|
|
||||||
class RoutingScreen extends \Derivation
|
class RoutingScreen extends \Derivation
|
||||||
{
|
{
|
||||||
|
public $convergent = 0;
|
||||||
|
public $divergent = 0;
|
||||||
|
public $gateway = array('PARALLEL', 'PARALLEL-BY-EVALUATION');
|
||||||
|
public $isFirst;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -40,7 +45,47 @@ class RoutingScreen extends \Derivation
|
|||||||
|
|
||||||
public function prepareRoutingScreen($arrayData)
|
public function prepareRoutingScreen($arrayData)
|
||||||
{
|
{
|
||||||
return $this->postSanity($this->prepareInformation($arrayData));
|
$array = $this->postSanity($this->prepareInformation($arrayData));
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postSanity($arrayInformation)
|
||||||
|
{
|
||||||
|
$response = array();
|
||||||
|
foreach ($arrayInformation as $index => $element) {
|
||||||
|
$this->divergent = 0;
|
||||||
|
$this->convergent = 0;
|
||||||
|
$this->isFirst = true;
|
||||||
|
if ($this->checkElement($this->node[$element['TAS_UID']])) {
|
||||||
|
$response[] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_combine(range(1, count($response)), array_values($response));
|
||||||
|
//return parent::postSanity($arrayNextTask); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkElement($element)
|
||||||
|
{
|
||||||
|
if (empty($element['in'])) {
|
||||||
|
$x = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$outElement = $element['out'];
|
||||||
|
foreach ($outElement as $index => $outE) {
|
||||||
|
if (!$this->isFirst && in_array($outE, $this->gateway)) {
|
||||||
|
$this->divergent++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->isFirst = false;
|
||||||
|
$inElement = $element['in'];
|
||||||
|
foreach ($inElement as $index => $inE) {
|
||||||
|
if ($inE == 'SEC-JOIN') {
|
||||||
|
$this->convergent++;
|
||||||
|
}
|
||||||
|
$this->checkElement($this->node[$index]);
|
||||||
|
}
|
||||||
|
//$this->checkElement($inElement);
|
||||||
|
return $this->convergent == 0 || $this->convergent == $this->divergent;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user