Merged in victorsl/processmaker/HOR-1061-31 (pull request #4367)

HOR-1061
This commit is contained in:
Julio Cesar Laura Avendaño
2016-06-09 16:21:55 -04:00
20 changed files with 357 additions and 86 deletions

View File

@@ -3,6 +3,7 @@ unset($_SESSION['APPLICATION']);
//get the action from GET or POST, default is todo
$action = isset( $_GET['action'] ) ? $_GET['action'] : (isset( $_POST['action'] ) ? $_POST['action'] : 'todo');
$openApplicationUid = (isset($_GET['openApplicationUid']))? $_GET['openApplicationUid'] : null;
/*----------------------------------********---------------------------------*/
$filterAction = isset( $_GET['filterAction'] ) ? $_GET['filterAction'] : (isset( $_POST['filterAction'] ) ? $_POST['filterAction'] : '');
@@ -224,6 +225,8 @@ $oHeadPublisher->addContent( 'cases/casesListExtJs' ); //adding a html file .ht
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$oHeadPublisher->assign('isIE', Bootstrap::isIE());
$oHeadPublisher->assign('__OPEN_APPLICATION_UID__', $openApplicationUid);
G::RenderPage( 'publish', 'extJs' );
function getUserArray ($action, $userUid)
@@ -319,7 +322,7 @@ function getStatusArray($action, $userUid)
$status[] = array('DRAFT', G::LoadTranslation('ID_CASES_STATUS_DRAFT'));
$status[] = array('TO_DO', G::LoadTranslation('ID_CASES_STATUS_TO_DO'));
$status[] = array('CANCELLED', G::LoadTranslation('ID_CASES_STATUS_CANCELLED'));
return $status;
}

View File

@@ -64,11 +64,52 @@ if (isset( $arrayConfig["DEFAULT_CASES_MENU"] )) {
$confDefaultOption = "CASES_INBOX";
}
if (isset( $_GET["id"] ) && isset( $_GET["id"] )) {
$defaultOption = "../cases/open?APP_UID=" . $_GET["id"] . "&DEL_INDEX=" . $_GET["i"];
if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
$case = new \ProcessMaker\BusinessModel\Cases();
if (isset( $_GET["a"] )) {
$defaultOption .= "&action=" . $_GET["a"];
$confDefaultOption = 'CASES_SEARCH';
$action = 'search';
$arrayResult = $case->getStatusInfo($_SESSION['__OPEN_APPLICATION_UID__'], 0, $_SESSION['USER_LOGGED']);
$arrayDelIndex = [];
if (!empty($arrayResult)) {
$arrayDefaultOption = [
'TO_DO' => ['CASES_INBOX', 'todo'],
'DRAFT' => ['CASES_DRAFT', 'draft'],
'CANCELLED' => ['CASES_SENT', 'sent'],
'COMPLETED' => ['CASES_SENT', 'sent'],
'PARTICIPATED' => ['CASES_SENT', 'sent'],
'UNASSIGNED' => ['CASES_SELFSERVICE', 'unassigned'],
'PAUSED' => ['CASES_PAUSED', 'paused']
];
$confDefaultOption = $arrayDefaultOption[$arrayResult['APP_STATUS']][0];
$action = $arrayDefaultOption[$arrayResult['APP_STATUS']][1];
$arrayDelIndex = $arrayResult['DEL_INDEX'];
} else {
$arrayResult = $case->getStatusInfo($_SESSION['__OPEN_APPLICATION_UID__']);
$arrayDelIndex = $arrayResult['DEL_INDEX'];
}
if (count($arrayDelIndex) == 1) {
$defaultOption = '../cases/open?APP_UID=' . $_SESSION['__OPEN_APPLICATION_UID__'] .
'&DEL_INDEX=' . $arrayDelIndex[0] . '&action=' . $action;
} else {
$defaultOption = '../cases/casesListExtJs?action=' . $action .
'&openApplicationUid=' . $_SESSION['__OPEN_APPLICATION_UID__'];
}
unset($_SESSION['__OPEN_APPLICATION_UID__']);
} else {
if (isset($_GET['id'])) {
$defaultOption = '../cases/open?APP_UID=' . $_GET['id'] . '&DEL_INDEX=' . $_GET['i'];
if (isset($_GET['a'])) {
$defaultOption .= '&action=' . $_GET['a'];
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
$RBAC->requirePermissions('PM_CASES');
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'CASES';
$_POST['qs'] = '';
$arrayAux = explode('?', $_SERVER['REQUEST_URI']);
preg_match('/^.*\/cases\/opencase\/([\w\-]{32})$/', $arrayAux[0], $arrayMatch);
$applicationUid = $arrayMatch[1];
$case = new \ProcessMaker\BusinessModel\Cases();
$arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false);
$G_PUBLISH = new Publisher();
if ($arrayApplicationData !== false) {
$_SESSION['__CD__'] = '../';
$_SESSION['__OPEN_APPLICATION_UID__'] = $applicationUid;
$G_PUBLISH->AddContent('view', 'cases/cases_Load');
$headPublisher = &headPublisher::getSingleton();
$headPublisher->addScriptFile('/jscore/src/PM.js');
$headPublisher->addScriptFile('/jscore/src/Sessions.js');
} else {
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showMessage',
'',
['MESSAGE' => \G::LoadTranslation('ID_CASE_DOES_NOT_EXIST2', ['app_uid', $applicationUid])]
);
}
G::RenderPage('publish');

View File

@@ -32,6 +32,10 @@ $type = isset( $_GET["type"] ) ? $_GET["type"] : (isset( $_REQUEST["type"] ) ? $
$dateFrom = isset( $_REQUEST["dateFrom"] ) ? substr( $_REQUEST["dateFrom"], 0, 10 ) : "";
$dateTo = isset( $_REQUEST["dateTo"] ) ? substr( $_REQUEST["dateTo"], 0, 10 ) : "";
$first = isset( $_REQUEST["first"] ) ? true :false;
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '')?
$_REQUEST['openApplicationUid'] : null;
$search = (!is_null($openApplicationUid))? $openApplicationUid : $search;
if ($sort == 'CASE_SUMMARY' || $sort == 'CASE_NOTES_COUNT') {
$sort = 'APP_NUMBER';//DEFAULT VALUE

View File

@@ -33,6 +33,8 @@ try {
$filters['action'] = isset( $_REQUEST["action"] ) ? $filter->sanitizeInputValue($_REQUEST["action"], 'nosql') : "";
$listName = isset( $_REQUEST["list"] ) ? $filter->sanitizeInputValue($_REQUEST["list"], 'nosql') : "inbox";
$filters['filterStatus'] = isset( $_REQUEST["filterStatus"] ) ? $filter->sanitizeInputValue($_REQUEST["filterStatus"], 'nosql') : "";
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '')?
$_REQUEST['openApplicationUid'] : null;
// Select list
switch ($listName) {
@@ -73,6 +75,8 @@ try {
// Validate filters
$filters['search'] = (!is_null($openApplicationUid))? $openApplicationUid : $filters['search'];
$filters['start'] = (int)$filters['start'];
$filters['start'] = abs($filters['start']);
if ($filters['start'] != 0) {