122 lines
4.0 KiB
PHP
122 lines
4.0 KiB
PHP
|
|
<?php
|
||
|
|
namespace BusinessModel;
|
||
|
|
|
||
|
|
use \G;
|
||
|
|
use \UsersPeer;
|
||
|
|
use \CasesPeer;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||
|
|
* @copyright Colosa - Bolivia
|
||
|
|
*/
|
||
|
|
class Cases
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Get list for Cases
|
||
|
|
*
|
||
|
|
* @access public
|
||
|
|
* @param array $dataList, Data for list
|
||
|
|
* @return array
|
||
|
|
*
|
||
|
|
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||
|
|
* @copyright Colosa - Bolivia
|
||
|
|
*/
|
||
|
|
public function getList($dataList = array())
|
||
|
|
{
|
||
|
|
G::LoadClass("applications");
|
||
|
|
|
||
|
|
$solrEnabled = false;
|
||
|
|
$userUid = $dataList["userId"];
|
||
|
|
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
|
||
|
|
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
|
||
|
|
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
|
||
|
|
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
|
||
|
|
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
|
||
|
|
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
|
||
|
|
$process = isset( $dataList["process"] ) ? $dataList["process"] : "";
|
||
|
|
$category = isset( $dataList["category"] ) ? $dataList["category"] : "";
|
||
|
|
$status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : "";
|
||
|
|
$user = isset( $dataList["user"] ) ? $dataList["user"] : "";
|
||
|
|
$search = isset( $dataList["search"] ) ? $dataList["search"] : "";
|
||
|
|
$action = isset( $dataList["action"] ) ? $dataList["action"] : "todo";
|
||
|
|
$type = "extjs";
|
||
|
|
$dateFrom = isset( $dataList["dateFrom"] ) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
|
||
|
|
$dateTo = isset( $dataList["dateTo"] ) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||
|
|
$first = isset( $dataList["first"] ) ? true :false;
|
||
|
|
|
||
|
|
if ($action == 'search' || $action == 'to_reassign') {
|
||
|
|
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
|
||
|
|
if ($first) {
|
||
|
|
$result = array();
|
||
|
|
$result['totalCount'] = 0;
|
||
|
|
$result['data'] = array();
|
||
|
|
return $result;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if ((
|
||
|
|
$action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" ||
|
||
|
|
$action == "selfservice" || $action == "unassigned" || $action == "search"
|
||
|
|
) &&
|
||
|
|
(($solrConf = \System::solrEnv()) !== false)
|
||
|
|
) {
|
||
|
|
G::LoadClass("AppSolr");
|
||
|
|
|
||
|
|
$ApplicationSolrIndex = new \AppSolr(
|
||
|
|
$solrConf["solr_enabled"],
|
||
|
|
$solrConf["solr_host"],
|
||
|
|
$solrConf["solr_instance"]
|
||
|
|
);
|
||
|
|
|
||
|
|
if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) {
|
||
|
|
//Check if there are missing records to reindex and reindex them
|
||
|
|
$ApplicationSolrIndex->synchronizePendingApplications();
|
||
|
|
$solrEnabled = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
if ($solrEnabled) {
|
||
|
|
$result = $ApplicationSolrIndex->getAppGridData(
|
||
|
|
$userUid,
|
||
|
|
$start,
|
||
|
|
$limit,
|
||
|
|
$action,
|
||
|
|
$filter,
|
||
|
|
$search,
|
||
|
|
$process,
|
||
|
|
$status,
|
||
|
|
$type,
|
||
|
|
$dateFrom,
|
||
|
|
$dateTo,
|
||
|
|
$callback,
|
||
|
|
$dir,
|
||
|
|
$sort,
|
||
|
|
$category
|
||
|
|
);
|
||
|
|
} else {
|
||
|
|
G::LoadClass("applications");
|
||
|
|
$apps = new \Applications();
|
||
|
|
$result = $apps->getAll(
|
||
|
|
$userUid,
|
||
|
|
$start,
|
||
|
|
$limit,
|
||
|
|
$action,
|
||
|
|
$filter,
|
||
|
|
$search,
|
||
|
|
$process,
|
||
|
|
$status,
|
||
|
|
$type,
|
||
|
|
$dateFrom,
|
||
|
|
$dateTo,
|
||
|
|
$callback,
|
||
|
|
$dir,
|
||
|
|
(strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort,
|
||
|
|
$category
|
||
|
|
);
|
||
|
|
}
|
||
|
|
return $result;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|