This commit is contained in:
Paula Quispe
2019-07-17 09:54:51 -04:00
parent 44cb9966eb
commit c22891dc7e
9 changed files with 461 additions and 190 deletions

376
workflow/engine/methods/cases/casesListExtJs.php Normal file → Executable file

File diff suppressed because it is too large Load Diff

5
workflow/engine/methods/cases/casesList_Ajax.php Normal file → Executable file
View File

@@ -8,7 +8,10 @@ if (!isset($_SESSION['USER_LOGGED'])) {
die();
}
$actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null;
$actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : 'verifySession';
global $RBAC;
$RBAC->allows(basename(__FILE__), $actionAjax);
function filterUserListArray($users = array(), $filter = '')
{

121
workflow/engine/methods/cases/proxyCasesList.php Normal file → Executable file
View File

@@ -1,4 +1,5 @@
<?php
use ProcessMaker\Model\Delegation;
/**
@@ -20,38 +21,41 @@ if (!isset($_SESSION['USER_LOGGED'])) {
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
$userLogged = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
$filters = [];
// Callback in the UI to utilize
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "stcCallback1001";
// Sort column
$sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER";
$filters['sort'] = $sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER";
// Sort direction
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
$filters['dir'] = $dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
// Pagination control
$start = !empty($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
$limit = !empty($_REQUEST["limit"]) ? $_REQUEST["limit"] : 25;
$filters['start'] = $start = !empty($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
$filters['limit'] = $limit = !empty($_REQUEST["limit"]) ? $_REQUEST["limit"] : 25;
// Our search filter
$filter = isset($_REQUEST["filter"]) ? $_REQUEST["filter"] : "";
// What process
$process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : "";
$filters['process'] = $process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : "";
$filters['process_label'] = $processLabel = isset($_REQUEST["process_label"]) ? $_REQUEST["process_label"] : "";
// What category
$category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
$filters['category'] = $category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
// What status
$status = isset($_REQUEST["status"]) ? strtoupper($_REQUEST["status"]) : "";
$filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : "";
$filters['filterStatus'] = $filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : "";
// What user
$user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
$filters['user'] = $user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
$filters['user_label'] = $userLabel = isset($_REQUEST["user_label"]) ? $_REQUEST["user_label"] : "";
// What keywords to search
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
$filters['search'] = $search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
// What kind of action
$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");
@@ -60,17 +64,20 @@ $action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"])
$type = isset($_GET["type"]) ? $_GET["type"] : (isset($_REQUEST["type"]) ? $_REQUEST["type"] : "extjs");
// Date ranges
$dateFrom = isset($_REQUEST["dateFrom"]) ? substr($_REQUEST["dateFrom"], 0, 10) : "";
$dateTo = isset($_REQUEST["dateTo"]) ? substr($_REQUEST["dateTo"], 0, 10) : "";
$filters['dateFrom'] = $dateFrom = isset($_REQUEST["dateFrom"]) ? substr($_REQUEST["dateFrom"], 0, 10) : "";
$filters['dateTo'] = $dateTo = isset($_REQUEST["dateTo"]) ? substr($_REQUEST["dateTo"], 0, 10) : "";
// First? No idea
$first = isset($_REQUEST["first"]) ? true : false;
// First define if we need to return empty data the first time
$first = isset($_REQUEST["first"]);
// Do search define if the action was defined from the button search
$doSearch = isset($_REQUEST["doSearch"]);
// Open case from case link
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '') ?
$_REQUEST['openApplicationUid'] : null;
$search = (!is_null($openApplicationUid)) ? $openApplicationUid : $search;
$columnSearch = isset($_REQUEST["columnSearch"]) ? strtoupper($_REQUEST["columnSearch"]) : "";
$filters['columnSearch'] = $columnSearch = isset($_REQUEST["columnSearch"]) ? strtoupper($_REQUEST["columnSearch"]) : "";
if ($sort == 'CASE_SUMMARY' || $sort == 'CASE_NOTES_COUNT') {
$sort = 'APP_NUMBER';//DEFAULT VALUE
@@ -79,43 +86,61 @@ if ($sort == 'APP_STATUS_LABEL') {
$sort = 'APP_STATUS';
}
try {
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null;
$result = [];
//Load Configurations
$conf = new Configurations();
//Load the user preferences
$conf->getUserPreferences('FILTERS', $userLogged);
//Save the filters used
if ($doSearch && (empty($conf->aConfig['FILTERS']['advanced']) || $conf->aConfig['FILTERS']['advanced'] != $filters)) {
//The user does not have filters or we need to update the user preferences
$conf->aConfig['FILTERS']['advanced'] = $filters;
$conf->saveConfig('USER_PREFERENCES', '', '', $userLogged);
}
switch ($action) {
case "search":
case "to_reassign":
if ($first) {
$result['totalCount'] = 0;
$result['data'] = array();
$result = G::json_encode($result);
echo $result;
return;
}
$user = ($user == "CURRENT_USER") ? $userUid : $user;
$userUid = $user;
break;
default:
break;
}
try {
$result = [];
//Define the user logged into the system
$userUid = (isset($userLogged) && $userLogged != "") ? $userLogged : null;
if ($action == 'search') {
$data = Delegation::search(
$userUid,
$start,
$limit,
$search,
$process,
$filterStatus,
$dir,
$sort,
$category,
$dateFrom,
$dateTo,
$columnSearch
);
//Return empty if does not have filters
if (empty($conf->aConfig['FILTERS']['advanced'])) {
$result['totalCount'] = 0;
$result['data'] = [];
$result = G::json_encode($result);
echo $result;
return;
} else {
//Define the user
$user = ($user == "CURRENT_USER") ? $userUid : $user;
$userUid = $user;
//Get the data from the specific search
$data = Delegation::search(
$userUid,
$start,
$limit,
$search,
$process,
$filterStatus,
$dir,
$sort,
$category,
$dateFrom,
$dateTo,
$columnSearch
);
}
} else {
//We check if we need to return empty
if ($action == "to_reassign" && $first) {
$result['totalCount'] = 0;
$result['data'] = [];
$result = G::json_encode($result);
echo $result;
return;
}
//This section is used by the community version
$apps = new Applications();
$data = $apps->getAll(