Merged in cochalo/processmaker (pull request #302)
Adicion de cases list para CASES
This commit is contained in:
121
workflow/engine/src/BusinessModel/Cases.php
Normal file
121
workflow/engine/src/BusinessModel/Cases.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
||||
168
workflow/engine/src/Services/Api/ProcessMaker/Cases.php
Normal file
168
workflow/engine/src/Services/Api/ProcessMaker/Cases.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Cases Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Cases extends Api
|
||||
{
|
||||
/**
|
||||
* Get list Cases To Do
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
public function doGetCasesListToDo($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'todo';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Draft
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /draft
|
||||
*/
|
||||
public function doGetCasesListDraft($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'draft';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Participated
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated
|
||||
*/
|
||||
public function doGetCasesListParticipated($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'sent';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Unassigned
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /unassigned
|
||||
*/
|
||||
public function doGetCasesListUnassigned($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'unassigned';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Paused
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /paused
|
||||
*/
|
||||
public function doGetCasesListPaused($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'paused';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Advanced Search
|
||||
*
|
||||
* @access public
|
||||
* @param array $request_data , Data for list
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /advanced-search
|
||||
*/
|
||||
public function doGetCasesListAdvancedSearch($request_data = array())
|
||||
{
|
||||
try {
|
||||
$request_data['action'] = 'search';
|
||||
$request_data['userId'] = $this->getUserId();
|
||||
$oCases = new \BusinessModel\Cases();
|
||||
$response = $oCases->getList($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user