Merged in bugfix/HOR-2704 (pull request #5802)
HOR-2704 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -109,12 +109,14 @@ if( isset($_GET['action']) && ($_GET['action'] == 'jump') ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise') ){
|
if(isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise') ){
|
||||||
$oApp = new Application;
|
$oSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||||
$oApp->Load($appUid);
|
$caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex);
|
||||||
//If the case is completed can not update the information from supervisor/review
|
//Check if the case has the correct status for update the information from supervisor/review
|
||||||
if($oApp->getAppStatus() === 'COMPLETED') {
|
if (!$caseCanBeReview) {
|
||||||
|
//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
|
||||||
$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' ) );
|
$oHeadPublisher->assign( 'treeToReviseTitle', G::loadtranslation( 'ID_STEP_LIST' ) );
|
||||||
$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex;
|
$casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex;
|
||||||
|
|||||||
@@ -1494,4 +1494,36 @@ class ProcessSupervisor
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function define if the supervisor can be review and edit
|
||||||
|
* The appStatus can be:TO_DO, DRAFT, COMPLETED, CANCELLED
|
||||||
|
* The thread status can be: PAUSED
|
||||||
|
* @param string $appUid
|
||||||
|
* @param integer $delIndex
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function reviewCaseStatusForSupervisor($appUid, $delIndex = 0)
|
||||||
|
{
|
||||||
|
$oApp = new \Application();
|
||||||
|
$oApp->Load($appUid);
|
||||||
|
$canEdit = false;
|
||||||
|
switch ($oApp->getAppStatus()) {
|
||||||
|
case 'TO_DO':
|
||||||
|
//Verify if the case is paused because the supervisor can not edit the PAUSED case
|
||||||
|
$oDelay = new \AppDelay();
|
||||||
|
if ($oDelay->isPaused($appUid, $delIndex)) {
|
||||||
|
$canEdit = false;
|
||||||
|
} else {
|
||||||
|
$canEdit = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'COMPLETED':
|
||||||
|
case 'CANCELLED':
|
||||||
|
default:
|
||||||
|
$canEdit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $canEdit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user