Merge branch 'feature/HOR-3559' of https://bitbucket.org/colosa/processmaker into bugfix/HOR-3485-A

This commit is contained in:
hjonathan
2017-08-08 09:23:50 -04:00
5 changed files with 120 additions and 136 deletions

View File

@@ -8,6 +8,7 @@ require __DIR__ . '/../vendor/autoload.php';
set_include_path( set_include_path(
get_include_path() . PATH_SEPARATOR get_include_path() . PATH_SEPARATOR
. __DIR__ . '/../thirdparty/' . PATH_SEPARATOR . __DIR__ . '/../thirdparty/' . PATH_SEPARATOR
. __DIR__ . '/../thirdparty/propel-generator/classes/' . PATH_SEPARATOR
. __DIR__ . '/../thirdparty/pear/' . PATH_SEPARATOR . __DIR__ . '/../thirdparty/pear/' . PATH_SEPARATOR
. __DIR__ . '/../workflow/engine/' . PATH_SEPARATOR . __DIR__ . '/../workflow/engine/' . PATH_SEPARATOR
. __DIR__ . '/../rbac/engine/' . __DIR__ . '/../rbac/engine/'

View File

@@ -1386,35 +1386,44 @@ class Cases
* *
* @name searchOpenPreviousTasks, * @name searchOpenPreviousTasks,
* @param string $taskUid * @param string $taskUid
* @param string $sAppUid * @param string $appUid
* @param array $aPreviousTasks optional array that serves to trace the task routes and avoid infinite loops. * @param array $previousTasks, optional array that serves to trace the task routes and avoid infinite loops.
* @return $aThreads * @return array, information about the threads in the case
*/ */
public function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array()) public function searchOpenPreviousTasks($taskUid, $appUid, $previousTasks = array())
{ {
//in this array we are storing all open delegation rows. //In this array we are storing all open delegation rows.
$aTaskReviewed = array(); $threads = array();
//check if this task ( $taskUid ) has open delegations //Check if this $taskUid has open delegations, this is a single review
$delegations = $this->getReviewedTasks($taskUid, $sAppUid); $threads = $this->getReviewedTasks($taskUid, $appUid);
if ($delegations !== false) { if ($threads !== false) {
if (count($delegations['open']) > 0) { if (count($threads['open']) > 0) {
//there is an open delegation, so we need to return the delegation row //There is an open delegation, so we need to return the delegation row
return $delegations['open']; return $threads['open'];
} else { } else {
if(count($delegations['paused']) > 0){ if (count($threads['paused']) > 0) {
//there is an paused delegation, so we need to return the delegation row //there is an paused delegation, so we need to return the delegation row
return $delegations['paused']; return $threads['paused'];
}else{
return array(); //returning empty array
} }
} }
} }
// if not we check previous tasks //Search the open delegations in the previous task, this is a recursive review
// until here this task has not appdelegations records. $threads = $this->getReviewedTasksRecursive($taskUid, $appUid, $previousTasks);
// get all previous task from $taskUid, and return open delegations rows, if there are return $threads;
}
/**
* This function get the last open task
* Usually is used when we have a SEC-JOIN and need to review if we need to route the case
* @param string $taskUid
* @param string $appUid
* @param array $previousTasks
* @return array $taskReviewed
*/
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) {
$taskReviewed = array();
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria('workflow');
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid); $oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
$oDataset = RoutePeer::doSelectRs($oCriteria); $oDataset = RoutePeer::doSelectRs($oCriteria);
@@ -1422,33 +1431,27 @@ class Cases
while ($oDataset->next()) { while ($oDataset->next()) {
$aRow = $oDataset->getRow(); $aRow = $oDataset->getRow();
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $appUid);
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid);
if ($delegations !== false) { if ($delegations !== false) {
if (count($delegations['open']) > 0) { if (count($delegations['open']) > 0) {
//there is an open delegation, so we need to return the delegation row //there is an open delegation, so we need to return the delegation row
$aTaskReviewed = array_merge($aTaskReviewed, $delegations['open']); $taskReviewed = array_merge($taskReviewed, $delegations['open']);
} else { } elseif ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') {
if ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') { $taskReviewed = array();
$aTaskReviewed = array();
} else {
//$aTaskReviewed = array_merge($aTaskReviewed, $delegations['closed']);
} }
} } elseif (!in_array($aRow['TAS_UID'], $previousTasks)) {
} else { //Storing the current task uid of the task currently checked
if (!in_array($aRow['TAS_UID'], $aPreviousTasks)) { $previousTasks[] = $aRow['TAS_UID'];
// storing the current task uid of the task currently checked //Passing the array of previous tasks in order to avoid an infinite loop that prevents
$aPreviousTasks[] = $aRow['TAS_UID']; $openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $appUid, $previousTasks);
// passing the array of previous tasks in oprder to avoid an infinite loop that prevents if (count($previousTasks) > 0) {
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid, $aPreviousTasks); $taskReviewed = array_merge($taskReviewed, $openPreviousTask);
if (count($aPreviousTasks) > 0) {
$aTaskReviewed = array_merge($aTaskReviewed, $openPreviousTask);
} }
} }
} }
}
return $aTaskReviewed; return $taskReviewed;
} }
/** /**

View File

@@ -1,40 +1,4 @@
<?php <?php
/**
* class.derivation.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once ("classes/model/Task.php");
require_once ("classes/model/Process.php");
require_once ("classes/model/Step.php");
require_once ("classes/model/Application.php");
require_once ('classes/model/Groupwf.php');
require_once ("classes/model/GroupUser.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/Route.php");
require_once ('classes/model/SubApplication.php');
require_once ('classes/model/SubProcess.php');
require_once ("classes/model/Users.php");
/** /**
* derivation - derivation class * derivation - derivation class
@@ -87,6 +51,7 @@ class Derivation
* @param array $arrayTaskData Task data (derivation) * @param array $arrayTaskData Task data (derivation)
* *
* @return array Return array * @return array Return array
* @throws Exception
*/ */
protected function prepareInformationTask(array $arrayTaskData) protected function prepareInformationTask(array $arrayTaskData)
{ {
@@ -161,7 +126,8 @@ class Derivation
* @param array $arrayData Data * @param array $arrayData Data
* @param string $taskUid Unique id of Task * @param string $taskUid Unique id of Task
* *
* @return array Return array * @return array
* @throws Exception
*/ */
public function prepareInformation(array $arrayData, $taskUid = "") public function prepareInformation(array $arrayData, $taskUid = "")
{ {

View File

@@ -80,8 +80,14 @@ class Installer extends Controller
G::RenderPage( 'publish', 'extJs' ); G::RenderPage( 'publish', 'extJs' );
} }
/**
* This function can be create a new workspace
* The user need permission PM_SETUP_ADVANCE for this action
* @return void
*/
public function newSite () public function newSite ()
{ {
if (!$this->pmIsInstalled()) {
$textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1'); $textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1');
$textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5'); $textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5');
@@ -90,10 +96,8 @@ class Installer extends Controller
$this->includeExtJS('installer/Header', false); $this->includeExtJS('installer/Header', false);
$this->includeExtJS('installer/Card', false); $this->includeExtJS('installer/Card', false);
$this->includeExtJS('installer/newSite', false); $this->includeExtJS('installer/newSite', false);
$this->setJSVar('textStep1', $textStep1); $this->setJSVar('textStep1', $textStep1);
$this->setJSVar('textStep2', $textStep2); $this->setJSVar('textStep2', $textStep2);
$this->setJSVar('DB_ADAPTER', DB_ADAPTER); $this->setJSVar('DB_ADAPTER', DB_ADAPTER);
$aux = explode(':', DB_HOST); $aux = explode(':', DB_HOST);
$this->setJSVar('DB_HOST', $aux[0]); $this->setJSVar('DB_HOST', $aux[0]);
@@ -106,10 +110,12 @@ class Installer extends Controller
$this->setJSVar('pathPlugins', PATH_PLUGINS); $this->setJSVar('pathPlugins', PATH_PLUGINS);
$this->setJSVar('pathXmlforms', PATH_XMLFORM); $this->setJSVar('pathXmlforms', PATH_XMLFORM);
$this->setJSVar('pathShared', PATH_DATA); $this->setJSVar('pathShared', PATH_DATA);
$this->setView('installer/newSite'); $this->setView('installer/newSite');
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');
} else {
$this->displayError();
}
} }
public function getSystemInfo () public function getSystemInfo ()
@@ -414,9 +420,12 @@ class Installer extends Controller
/** /**
* function to create a workspace * function to create a workspace
* in fact this function is calling appropiate functions for mysql and mssql * in fact this function is calling appropiate functions for mysql and mssql
* need permission PM_SETUP_ADVANCE for this action
* @return void
*/ */
public function createWorkspace () public function createWorkspace ()
{ {
if (!$this->pmIsInstalled()) {
$pathSharedPartner = trim($_REQUEST['pathShared']); $pathSharedPartner = trim($_REQUEST['pathShared']);
if (file_exists(trim($pathSharedPartner, PATH_SEP) . PATH_SEP . 'partner.info')) { if (file_exists(trim($pathSharedPartner, PATH_SEP) . PATH_SEP . 'partner.info')) {
$this->systemName = $this->getSystemName($pathSharedPartner); $this->systemName = $this->getSystemName($pathSharedPartner);
@@ -430,6 +439,30 @@ class Installer extends Controller
} }
return $info; return $info;
} else {
$this->displayError();
}
}
/**
* We check if processMaker is not installed
*
* @return boolean
*/
private function pmIsInstalled(){
return file_exists(FILE_PATHS_INSTALLED);
}
/**
* Display an error when processMaker is already installed
*
* @return void
*/
private function displayError(){
$this->setJSVar('messageError', G::LoadTranslation('ID_PROCESSMAKER_ALREADY_INSTALLED'));
$this->includeExtJS('installer/stopInstall');
$this->setView('installer/mainStopInstall');
G::RenderPage('publish', 'extJs');
} }
public function forceTogenerateTranslationsFiles ($url) public function forceTogenerateTranslationsFiles ($url)

View File

@@ -1,26 +1,7 @@
<?php <?php
/**
* installServer.php global $RBAC;
* $RBAC->allows(basename(__FILE__), basename(__FILE__));
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (isset( $_POST['form']['NW_TITLE'] )) { if (isset( $_POST['form']['NW_TITLE'] )) {
$action = (isset( $_POST['form']['ACTION'] )) ? trim( $_POST['form']['ACTION'] ) : 'test'; $action = (isset( $_POST['form']['ACTION'] )) ? trim( $_POST['form']['ACTION'] ) : 'test';