PMC-195
This commit is contained in:
@@ -2,24 +2,17 @@
|
|||||||
/**
|
/**
|
||||||
* cases_Open.php
|
* cases_Open.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* @see cases/casesList.js
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.
|
* @see cases/cases_Step.php
|
||||||
|
* @see cases/cases_CatchSelfService.php
|
||||||
|
* @see cases/derivatedGmail.php
|
||||||
|
* @see cases/open.php
|
||||||
|
* @see controllers/Home::indexSingle()
|
||||||
|
* @see controllers/Home::startCase()
|
||||||
|
* @see pmGmail/sso.php
|
||||||
|
* @see webentry/access.php
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria
|
||||||
* 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( $_GET['gmail']) && $_GET['gmail'] == 1){
|
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
|
||||||
@@ -50,6 +43,7 @@ try {
|
|||||||
//Loading data for a Jump request
|
//Loading data for a Jump request
|
||||||
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
|
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
|
||||||
$_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
|
$_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber( $_GET['APP_NUMBER'] );
|
||||||
|
//Get the index related to the userLogged but this thread can be OPEN or CLOSED
|
||||||
$_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']);
|
$_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']);
|
||||||
|
|
||||||
//if the application doesn't exist
|
//if the application doesn't exist
|
||||||
@@ -67,44 +61,44 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sAppUid = $_GET['APP_UID'];
|
$appUid = $_GET['APP_UID'];
|
||||||
$iDelIndex = $_GET['DEL_INDEX'];
|
$delIndex = $_GET['DEL_INDEX'];
|
||||||
$_action = isset($_GET['action']) ? $_GET['action'] : '';
|
$action = isset($_GET['action']) ? $_GET['action'] : '';
|
||||||
|
|
||||||
//loading application data
|
//loading application data
|
||||||
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex );
|
$fieldCase = $caseInstance->loadCase($appUid, $delIndex);
|
||||||
|
|
||||||
if (!isset($_SESSION['CURRENT_TASK'])) {
|
if (!isset($_SESSION['CURRENT_TASK'])) {
|
||||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
$_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
|
||||||
} elseif ($_SESSION['CURRENT_TASK'] == '') {
|
} elseif ($_SESSION['CURRENT_TASK'] == '') {
|
||||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
$_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_SESSION['ACTION']);
|
unset($_SESSION['ACTION']);
|
||||||
$flagJump = '';
|
$flagJump = '';
|
||||||
if ($_action == 'jump') {
|
if ($action == 'jump') {
|
||||||
$_SESSION['ACTION'] = 'jump';
|
$_SESSION['ACTION'] = 'jump';
|
||||||
$flagJump = 1;
|
$flagJump = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($aFields['APP_STATUS']) {
|
switch ($fieldCase['APP_STATUS']) {
|
||||||
case 'DRAFT':
|
case 'DRAFT':
|
||||||
case 'TO_DO':
|
case 'TO_DO':
|
||||||
//Check if the case is in pause, check a valid record in table APP_DELAY
|
//Check if the case is in pause, check a valid record in table APP_DELAY
|
||||||
$isPaused = AppDelay::isPaused($sAppUid, $iDelIndex);
|
$isPaused = AppDelay::isPaused($appUid, $delIndex);
|
||||||
|
|
||||||
//Check if the case is a waiting for a SYNCHRONOUS subprocess
|
//Check if the case is a waiting for a SYNCHRONOUS subprocess
|
||||||
$subAppData = new \SubApplication();
|
$subAppData = new SubApplication();
|
||||||
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($sAppUid, $iDelIndex);
|
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($appUid, $delIndex);
|
||||||
|
|
||||||
if ($isPaused || $caseSubprocessPending) {
|
if ($isPaused || $caseSubprocessPending) {
|
||||||
//the case is paused show only the resume
|
//the case is paused show only the resume
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
$_SESSION['INDEX'] = $iDelIndex;
|
$_SESSION['INDEX'] = $delIndex;
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = -1;
|
$_SESSION['TASK'] = -1;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
$_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
|
||||||
|
|
||||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||||
exit();
|
exit();
|
||||||
@@ -113,17 +107,16 @@ try {
|
|||||||
/**
|
/**
|
||||||
* these routine is to verify if the case was acceded from advanced search list
|
* these routine is to verify if the case was acceded from advanced search list
|
||||||
*/
|
*/
|
||||||
|
if ($action == 'search') {
|
||||||
if ($_action == 'search') {
|
|
||||||
//verify if the case is with the current user
|
//verify if the case is with the current user
|
||||||
$aData = AppDelegation::getCurrentUsers($sAppUid, $iDelIndex);
|
$delegationUsers = AppDelegation::getCurrentUsers($appUid, $delIndex);
|
||||||
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($aData['USR_UID'])) {
|
if ($delegationUsers['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($delegationUsers['USR_UID'])) {
|
||||||
//distinct "" for selfservice
|
//distinct "" for selfservice
|
||||||
//so we show just the resume
|
//so we show just the resume
|
||||||
$_SESSION['alreadyDerivated'] = true;
|
$_SESSION['alreadyDerivated'] = true;
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
$_SESSION['INDEX'] = $iDelIndex;
|
$_SESSION['INDEX'] = $delIndex;
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = -1;
|
$_SESSION['TASK'] = -1;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
|
|
||||||
@@ -133,21 +126,21 @@ try {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//proceed and try to open the case
|
//Proceed and try to open the case
|
||||||
$oAppDelegation = new AppDelegation();
|
$appDelegation = new AppDelegation();
|
||||||
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
|
$delegationInfo = $appDelegation->load($appUid, $delIndex);
|
||||||
|
|
||||||
//if there are no user in the delegation row, this case is in selfservice
|
//If there are no user in the delegation row, this case is in selfservice
|
||||||
if ($aDelegation['USR_UID'] == "") {
|
if (empty($delegationInfo['USR_UID'])) {
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
$_SESSION['INDEX'] = $iDelIndex;
|
$_SESSION['INDEX'] = $delIndex;
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = -1;
|
$_SESSION['TASK'] = -1;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID'];
|
$_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
|
||||||
|
|
||||||
//if the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume
|
//If the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume
|
||||||
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid)) {
|
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $fieldCase['TAS_UID'], $appUid)) {
|
||||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
|
||||||
} else {
|
} else {
|
||||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||||
@@ -156,48 +149,55 @@ try {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
//If the current users is in the AppDelegation row, then open the case
|
//If the current users is in the AppDelegation row and the thread is open will be open the case
|
||||||
if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') {
|
if (($delegationInfo['USR_UID'] == $_SESSION['USER_LOGGED'] && $delegationInfo['DEL_THREAD_STATUS'] === 'OPEN')
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
&& $action != 'sent')
|
||||||
$_SESSION['INDEX'] = $iDelIndex;
|
{
|
||||||
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
|
$_SESSION['INDEX'] = $delIndex;
|
||||||
|
|
||||||
if (is_null( $aFields['DEL_INIT_DATE'] )) {
|
if (is_null($fieldCase['DEL_INIT_DATE'])) {
|
||||||
$caseInstance->setDelInitDate( $sAppUid, $iDelIndex );
|
$caseInstance->setDelInitDate($appUid, $delIndex);
|
||||||
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex );
|
$fieldCase = $caseInstance->loadCase($appUid, $delIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = $aFields['TAS_UID'];
|
$_SESSION['TASK'] = $fieldCase['TAS_UID'];
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
|
|
||||||
/* Redirect to next step */
|
/* Redirect to next step */
|
||||||
unset($_SESSION['bNoShowSteps']);
|
unset($_SESSION['bNoShowSteps']);
|
||||||
|
|
||||||
/* Execute Before Triggers for first Task*/
|
/** Execute a trigger when a case is open */
|
||||||
$caseInstance->getExecuteTriggerProcess($sAppUid, 'OPEN');
|
$caseInstance->getExecuteTriggerProcess($appUid, 'OPEN');
|
||||||
/*end Execute Before Triggers for first Task*/
|
|
||||||
|
|
||||||
$aNextStep = $caseInstance->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
$nextStep = $caseInstance->getNextStep(
|
||||||
$sPage = $aNextStep['PAGE'];
|
$_SESSION['PROCESS'],
|
||||||
G::header( 'location: ' . $sPage );
|
$_SESSION['APPLICATION'],
|
||||||
|
$_SESSION['INDEX'],
|
||||||
|
$_SESSION['STEP_POSITION']
|
||||||
|
);
|
||||||
|
$pageOpenCase = $nextStep['PAGE'];
|
||||||
|
|
||||||
|
G::header('location: ' . $pageOpenCase);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = -1;
|
$_SESSION['TASK'] = -1;
|
||||||
$_SESSION['bNoShowSteps'] = 1;
|
$_SESSION['bNoShowSteps'] = 1;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
|
|
||||||
//When the case have another user or current user doesn't have rights to this self-service,
|
//When the case have another user or current user doesn't have rights to this self-service,
|
||||||
//Just view the case Resume
|
//Just view the case Resume
|
||||||
if ($_action === 'search' || $_action === 'to_reassign') {
|
if ($action === 'search' || $action === 'to_reassign') {
|
||||||
//We need to use the index sent with the corresponding record
|
//We need to use the index sent with the corresponding record
|
||||||
$_SESSION['INDEX'] = $iDelIndex;
|
$_SESSION['INDEX'] = $delIndex;
|
||||||
} else {
|
} else {
|
||||||
//Get DEL_INDEX
|
//Get DEL_INDEX
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||||
$criteria->add(AppDelegationPeer::APP_UID, $sAppUid);
|
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||||
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
|
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
|
||||||
$rs = AppDelegationPeer::doSelectRS($criteria);
|
$rs = AppDelegationPeer::doSelectRS($criteria);
|
||||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
@@ -206,29 +206,29 @@ try {
|
|||||||
$_SESSION['INDEX'] = $row['DEL_INDEX'];
|
$_SESSION['INDEX'] = $row['DEL_INDEX'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
$fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||||
|
$_SESSION['CURRENT_TASK'] = $fields['TAS_UID'];
|
||||||
|
|
||||||
$_SESSION['CURRENT_TASK'] = $Fields['TAS_UID'];
|
|
||||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: //APP_STATUS IS COMPLETED OR CANCELLED
|
default: //APP_STATUS IS COMPLETED OR CANCELLED
|
||||||
$_SESSION['APPLICATION'] = $sAppUid;
|
$_SESSION['APPLICATION'] = $appUid;
|
||||||
$_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']);
|
$_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']);
|
||||||
$_SESSION['PROCESS'] = $aFields['PRO_UID'];
|
$_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
|
||||||
$_SESSION['TASK'] = -1;
|
$_SESSION['TASK'] = -1;
|
||||||
$_SESSION['STEP_POSITION'] = 0;
|
$_SESSION['STEP_POSITION'] = 0;
|
||||||
$Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
$fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump);
|
||||||
$_SESSION['CURRENT_TASK'] = $Fields['TAS_UID'];
|
$_SESSION['CURRENT_TASK'] = $fields['TAS_UID'];
|
||||||
|
|
||||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$aMessage = array ();
|
$message = [];
|
||||||
$aMessage['MESSAGE'] = $e->getMessage();
|
$message['MESSAGE'] = $e->getMessage();
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $message);
|
||||||
G::RenderPage('publishBlank', 'blank');
|
G::RenderPage('publishBlank', 'blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* open.php
|
||||||
|
*
|
||||||
|
* @see cases/casesStartPage_Ajax.php
|
||||||
|
* @see cases/cases_CatchExecute.php
|
||||||
|
* @see cases/main_init.php
|
||||||
|
*
|
||||||
|
* @see dataReportingTools/public_html/js/reportViewer.js
|
||||||
|
* @see EnterpriseSearch/dynaform_view.js
|
||||||
|
*
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Inbox
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Cases/Cases#New_Case
|
||||||
|
*/
|
||||||
|
|
||||||
|
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||||
|
use ProcessMaker\BusinessModel\ProcessSupervisor;
|
||||||
|
|
||||||
$tBarGmail = false;
|
$tBarGmail = false;
|
||||||
if (isset($_GET['gmail']) && $_GET['gmail'] == 1) {
|
if (isset($_GET['gmail']) && $_GET['gmail'] == 1) {
|
||||||
@@ -12,18 +29,18 @@ if (!isset($_GET['APP_UID']) && !isset($_GET['APP_NUMBER']) && !isset($_GET['DEL
|
|||||||
}
|
}
|
||||||
//Get the APP_UID related to APP_NUMBER
|
//Get the APP_UID related to APP_NUMBER
|
||||||
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
|
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
|
||||||
$oCase = new Cases();
|
$caseInstance = new Cases();
|
||||||
$appUid = $oCase->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER']));
|
$appUid = $caseInstance->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER']));
|
||||||
if (is_null($appUid)) {
|
if (is_null($appUid)) {
|
||||||
throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'));
|
throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$appUid = htmlspecialchars($_GET['APP_UID']);
|
$appUid = htmlspecialchars($_GET['APP_UID']);
|
||||||
}
|
}
|
||||||
//If we don't have the DEL_INDEX we get the current delIndex. Data reporting tool does not have this information
|
//If we don't have the DEL_INDEX we get the current delIndex for example data reporting tool and jump to
|
||||||
if (!isset($_GET['DEL_INDEX'])) {
|
if (!isset($_GET['DEL_INDEX'])) {
|
||||||
$oCase = new Cases();
|
$caseInstance = new Cases();
|
||||||
$delIndex = $oCase->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']);
|
$delIndex = $caseInstance->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']);
|
||||||
if (is_null($delIndex)) {
|
if (is_null($delIndex)) {
|
||||||
throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'));
|
throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'));
|
||||||
}
|
}
|
||||||
@@ -34,13 +51,11 @@ if (!isset($_GET['DEL_INDEX'])) {
|
|||||||
|
|
||||||
$tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID']) : '';
|
$tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID']) : '';
|
||||||
|
|
||||||
$oCase = new Cases();
|
$caseInstance = new Cases();
|
||||||
$conf = new Configurations();
|
$conf = new Configurations();
|
||||||
|
$headPublisher = headPublisher::getSingleton();
|
||||||
$oHeadPublisher = headPublisher::getSingleton();
|
|
||||||
|
|
||||||
$urlToRedirectAfterPause = 'casesListExtJs';
|
$urlToRedirectAfterPause = 'casesListExtJs';
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||||
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
||||||
@@ -52,78 +67,110 @@ if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
|
|||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
|
$headPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause);
|
||||||
$oHeadPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause);
|
$headPublisher->addExtJsScript('app/main', true);
|
||||||
|
$headPublisher->addExtJsScript('cases/open', true);
|
||||||
|
$headPublisher->assign('FORMATS', $conf->getFormats());
|
||||||
$oHeadPublisher->addExtJsScript('app/main', true);
|
|
||||||
$oHeadPublisher->addExtJsScript('cases/open', true);
|
|
||||||
$oHeadPublisher->assign('FORMATS', $conf->getFormats());
|
|
||||||
$uri = '';
|
$uri = '';
|
||||||
foreach ($_GET as $k => $v) {
|
foreach ($_GET as $k => $v) {
|
||||||
$uri .= ($uri == '') ? "$k=$v" : "&$k=$v";
|
$uri .= ($uri == '') ? "$k=$v" : "&$k=$v";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['action']) && ($_GET['action'] == 'jump')) {
|
/**
|
||||||
$oNewCase = new \ProcessMaker\BusinessModel\Cases();
|
* @todo, the action over the case from Open Case, Case Link and jump to needs to work similar, we need to have a PRD
|
||||||
//We need to get the last index OPEN or CLOSED (by Paused cases)
|
*/
|
||||||
//Set true because we need to check if the case is paused
|
|
||||||
$delIndex = $oNewCase->getOneLastThread($appUid, true);
|
$case = $caseInstance->loadCase($appUid, $delIndex);
|
||||||
$case = $oCase->loadCase($appUid, $delIndex, $_GET['action']);
|
$canClaimCase = false;
|
||||||
} else {
|
$caseCanBeReview = false;
|
||||||
$case = $oCase->loadCase($appUid, $delIndex);
|
if (isset($_GET['action'])) {
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
case 'todo': //Inbox
|
||||||
|
case 'draft': //Draft
|
||||||
|
case 'sent': //Participated
|
||||||
|
case 'unassigned': //Unassigned
|
||||||
|
case 'paused': //Paused
|
||||||
|
case 'search': //Advanced search
|
||||||
|
//For add the validation in the others list we need to a have a PRD, because is change of the functionality
|
||||||
|
break;
|
||||||
|
case 'to_reassign': //Reassign
|
||||||
|
//From reassign: Review if the user can be claim the case
|
||||||
|
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $case['TAS_UID'], $appUid)) {
|
||||||
|
$canClaimCase = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'to_revise': //Review
|
||||||
|
$proSupervisor = new ProcessSupervisor();
|
||||||
|
$caseCanBeReview = $proSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex);
|
||||||
|
break;
|
||||||
|
case 'jump': //Jump To action
|
||||||
|
//From Review: Review if the user is supervisor
|
||||||
|
if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) {
|
||||||
|
$proSupervisor = new ProcessSupervisor();
|
||||||
|
$caseCanBeReview = $proSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex);
|
||||||
|
}
|
||||||
|
//From Unassigned: Review if the user can be claim the case
|
||||||
|
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $case['TAS_UID'], $appUid)) {
|
||||||
|
$canClaimCase = true;
|
||||||
|
}
|
||||||
|
//From Paused: Get the last index OPEN or CLOSED (by Paused cases)
|
||||||
|
$bmCases = new BmCases();
|
||||||
|
$delIndex = $bmCases->getOneLastThread($appUid, true);
|
||||||
|
$case = $caseInstance->loadCase($appUid, $delIndex, $_GET['action']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) {
|
/**
|
||||||
$oSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
* Review if the user can be open the case from Review list
|
||||||
$caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex);
|
* @link https://wiki.processmaker.com/3.2/Cases/Process_Supervisor#Review
|
||||||
//Check if the case has the correct status for update the information from supervisor/review
|
*/
|
||||||
if (!$caseCanBeReview) {
|
if (!$caseCanBeReview) {
|
||||||
//The supervisor can not edit the information
|
//The supervisor can not edit the information
|
||||||
$script = 'cases_Open?';
|
$script = 'cases_Open?';
|
||||||
} else {
|
} else {
|
||||||
//The supervisor can edit the information, the case are in TO_DO
|
//The supervisor can edit the information, the case are in TO_DO
|
||||||
$script = 'cases_OpenToRevise?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&TAS_UID=' . $tasUid;
|
$script = 'cases_OpenToRevise?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&TAS_UID=' . $tasUid;
|
||||||
$oHeadPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST'));
|
$headPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST'));
|
||||||
$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex;
|
$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex;
|
||||||
$oHeadPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations
|
$headPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations
|
||||||
echo "<div id='toReviseTree'></div>";
|
echo "<div id='toReviseTree'></div>";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$script = 'cases_Open?';
|
|
||||||
}
|
|
||||||
|
|
||||||
$process = new Process();
|
$process = new Process();
|
||||||
$fields = $process->load($case['PRO_UID']);
|
$fields = $process->load($case['PRO_UID']);
|
||||||
$isBpmn = $fields['PRO_BPMN'] === 1 ? true : false;
|
$isBpmn = $fields['PRO_BPMN'] === 1 ? true : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Review if the user can be open summary form
|
||||||
|
* @link https://wiki.processmaker.com/3.2/Case_Summary#Viewing_the_Custom_Dynaform_when_Opening_a_Case
|
||||||
|
*/
|
||||||
$showCustomForm = false;
|
$showCustomForm = false;
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
$respView = $caseInstance->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW');
|
||||||
$respView = $oCase->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW');
|
|
||||||
$viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false;
|
$viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false;
|
||||||
$isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']);
|
$isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']);
|
||||||
|
|
||||||
if ($isBpmn && $viewSummaryForm && $isNoEmpty) {
|
if ($isBpmn && $viewSummaryForm && $isNoEmpty) {
|
||||||
$showCustomForm = true;
|
$showCustomForm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
$oStep = new Step();
|
$step = new Step();
|
||||||
$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1);
|
$step = $step->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1);
|
||||||
$oHeadPublisher->assign('uri', $script . $uri);
|
$headPublisher->assign('uri', $script . $uri);
|
||||||
$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']);
|
$headPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']);
|
||||||
$oHeadPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic');
|
$headPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic');
|
||||||
$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']);
|
$headPublisher->assign('_PRO_UID', $case['PRO_UID']);
|
||||||
$oHeadPublisher->assign('_APP_UID', $appUid);
|
$headPublisher->assign('_APP_UID', $appUid);
|
||||||
$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
$headPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
|
||||||
$oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A'));
|
$headPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A'));
|
||||||
$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj());
|
$headPublisher->assign('idfirstform', is_null($step) ? '-1' : $step->getStepUidObj());
|
||||||
$oHeadPublisher->assign('appStatus', $case['APP_STATUS']);
|
$headPublisher->assign('appStatus', $case['APP_STATUS']);
|
||||||
$oHeadPublisher->assign('tbarGmail', $tBarGmail);
|
$headPublisher->assign('tbarGmail', $tBarGmail);
|
||||||
$oHeadPublisher->assign('showCustomForm', $showCustomForm);
|
$headPublisher->assign('showCustomForm', $showCustomForm);
|
||||||
|
$headPublisher->assign('canClaimCase', $canClaimCase);
|
||||||
|
|
||||||
if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
|
if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
|
||||||
$_SESSION['PROCESS'] = $case['PRO_UID'];
|
$_SESSION['PROCESS'] = $case['PRO_UID'];
|
||||||
|
|||||||
@@ -562,7 +562,8 @@ Ext.onReady(function(){
|
|||||||
return key === false ? result : null;
|
return key === false ? result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.showCustomForm && this.showCustomForm === true && getParameterURL('action') === 'unassigned') {
|
var urlAction = getParameterURL('action');
|
||||||
|
if (this.showCustomForm && this.showCustomForm === true && (urlAction === 'unassigned' || this.canClaimCase === true)) {
|
||||||
navPanel.items[navPanel.items.length] = navPanelBottom;
|
navPanel.items[navPanel.items.length] = navPanelBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user