2012-10-22 12:15:52 -04:00
|
|
|
<?php
|
2013-02-01 14:45:47 -04:00
|
|
|
if (!isset($_SESSION['USER_LOGGED'])) {
|
2013-06-03 18:13:38 -04:00
|
|
|
$responseObject = new stdclass();
|
|
|
|
|
$responseObject->error = G::LoadTranslation('ID_LOGIN_AGAIN');
|
|
|
|
|
$responseObject->success = true;
|
|
|
|
|
$responseObject->lostSession = true;
|
2017-04-25 16:02:18 -04:00
|
|
|
print G::json_encode($responseObject);
|
2013-06-03 18:13:38 -04:00
|
|
|
die();
|
2013-02-01 14:45:47 -04:00
|
|
|
}
|
|
|
|
|
|
2017-02-15 16:26:02 +00:00
|
|
|
|
2016-06-30 12:58:50 -04:00
|
|
|
$filter = new InputFilter();
|
|
|
|
|
$_GET = $filter->xssFilterHard($_GET);
|
|
|
|
|
$_REQUEST = $filter->xssFilterHard($_REQUEST);
|
|
|
|
|
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
|
|
|
|
|
|
2012-08-17 18:23:58 -04:00
|
|
|
//Getting the extJs parameters
|
2017-04-25 16:02:18 -04:00
|
|
|
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "stcCallback1001";
|
2017-02-16 15:00:57 -04:00
|
|
|
//This default value was defined in casesList.js
|
2017-04-25 16:02:18 -04:00
|
|
|
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
|
2017-02-16 15:00:57 -04:00
|
|
|
//This default value was defined in casesList.js
|
2017-04-25 16:02:18 -04:00
|
|
|
$sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER";
|
|
|
|
|
$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : "0";
|
|
|
|
|
$limit = isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : "25";
|
|
|
|
|
$filter = isset($_REQUEST["filter"]) ? $_REQUEST["filter"] : "";
|
|
|
|
|
$process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : "";
|
|
|
|
|
$category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
|
|
|
|
|
$status = isset($_REQUEST["status"]) ? strtoupper($_REQUEST["status"]) : "";
|
|
|
|
|
$filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : "";
|
|
|
|
|
$user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
|
|
|
|
|
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
|
|
|
|
|
$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");
|
|
|
|
|
$type = isset($_GET["type"]) ? $_GET["type"] : (isset($_REQUEST["type"]) ? $_REQUEST["type"] : "extjs");
|
|
|
|
|
$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'] != '') ?
|
2016-06-07 16:52:49 -04:00
|
|
|
$_REQUEST['openApplicationUid'] : null;
|
|
|
|
|
|
2017-04-25 16:02:18 -04:00
|
|
|
$search = (!is_null($openApplicationUid)) ? $openApplicationUid : $search;
|
2012-10-22 12:15:52 -04:00
|
|
|
|
2013-06-07 10:34:50 -04:00
|
|
|
if ($sort == 'CASE_SUMMARY' || $sort == 'CASE_NOTES_COUNT') {
|
|
|
|
|
$sort = 'APP_NUMBER';//DEFAULT VALUE
|
|
|
|
|
}
|
2014-03-27 16:04:34 -04:00
|
|
|
if ($sort == 'APP_STATUS_LABEL') {
|
|
|
|
|
$sort = 'APP_STATUS';
|
|
|
|
|
}
|
2013-06-07 10:34:50 -04:00
|
|
|
|
2012-10-22 12:15:52 -04:00
|
|
|
try {
|
2017-04-25 16:02:18 -04:00
|
|
|
$userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null;
|
2012-10-22 12:15:52 -04:00
|
|
|
$result = "";
|
|
|
|
|
|
2012-11-05 15:14:51 -04:00
|
|
|
switch ($action) {
|
|
|
|
|
case "search":
|
|
|
|
|
case "to_reassign":
|
2013-01-29 15:18:55 -04:00
|
|
|
if ($first) {
|
|
|
|
|
$result['totalCount'] = 0;
|
|
|
|
|
$result['data'] = array();
|
|
|
|
|
$result = G::json_encode($result);
|
|
|
|
|
echo $result;
|
2017-04-25 16:02:18 -04:00
|
|
|
return;
|
2013-01-29 15:18:55 -04:00
|
|
|
}
|
2017-04-25 16:02:18 -04:00
|
|
|
$user = ($user == "CURRENT_USER") ? $userUid : $user;
|
2012-11-05 15:14:51 -04:00
|
|
|
$userUid = $user;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-25 16:02:18 -04:00
|
|
|
$apps = new Applications();
|
2012-10-22 12:15:52 -04:00
|
|
|
|
2017-04-25 16:02:18 -04:00
|
|
|
if ($action == 'search') {
|
|
|
|
|
$data = $apps->searchAll(
|
2012-10-31 10:45:21 -04:00
|
|
|
$userUid,
|
|
|
|
|
$start,
|
|
|
|
|
$limit,
|
|
|
|
|
$search,
|
|
|
|
|
$process,
|
2017-04-25 16:02:18 -04:00
|
|
|
$filterStatus,
|
2012-10-31 10:45:21 -04:00
|
|
|
$dir,
|
2012-11-05 15:14:51 -04:00
|
|
|
$sort,
|
2017-04-25 16:02:18 -04:00
|
|
|
$category,
|
|
|
|
|
$dateFrom,
|
|
|
|
|
$dateTo
|
2012-10-31 10:45:21 -04:00
|
|
|
);
|
2012-10-22 12:15:52 -04:00
|
|
|
} else {
|
2017-04-25 16:02:18 -04:00
|
|
|
$data = $apps->getAll(
|
2012-10-31 10:45:21 -04:00
|
|
|
$userUid,
|
|
|
|
|
$start,
|
|
|
|
|
$limit,
|
2017-04-25 16:02:18 -04:00
|
|
|
$action,
|
|
|
|
|
$filter,
|
2012-10-31 10:45:21 -04:00
|
|
|
$search,
|
|
|
|
|
$process,
|
2015-12-04 12:03:55 -04:00
|
|
|
$filterStatus,
|
2017-04-25 16:02:18 -04:00
|
|
|
$type,
|
2017-01-13 19:11:14 -04:00
|
|
|
$dateFrom,
|
2017-04-25 16:02:18 -04:00
|
|
|
$dateTo,
|
|
|
|
|
$callback,
|
|
|
|
|
$dir,
|
|
|
|
|
(strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort,
|
|
|
|
|
$category
|
2012-10-31 10:45:21 -04:00
|
|
|
);
|
2012-10-22 12:15:52 -04:00
|
|
|
}
|
2017-04-25 16:02:18 -04:00
|
|
|
|
2017-02-16 15:00:57 -04:00
|
|
|
$data['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($data['data']);
|
|
|
|
|
$result = G::json_encode($data);
|
2012-10-22 12:15:52 -04:00
|
|
|
echo $result;
|
|
|
|
|
} catch (Exception $e) {
|
2012-10-31 10:45:21 -04:00
|
|
|
$msg = array("error" => $e->getMessage());
|
|
|
|
|
echo G::json_encode($msg);
|
2012-10-22 12:15:52 -04:00
|
|
|
}
|
|
|
|
|
|