Adicion de tablas para listados
This commit is contained in:
153
workflow/engine/src/ProcessMaker/BusinessModel/Lists.php
Normal file
153
workflow/engine/src/ProcessMaker/BusinessModel/Lists.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
class Lists {
|
||||
|
||||
/**
|
||||
* 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($listName = 'inbox', $dataList = array(), $total = false)
|
||||
{
|
||||
Validator::isArray($dataList, '$dataList');
|
||||
if (!isset($dataList["userId"])) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId',''))));
|
||||
} else {
|
||||
Validator::usrUid($dataList["userId"], "userId");
|
||||
}
|
||||
|
||||
$userUid = $dataList["userId"];
|
||||
$filters["paged"] = isset( $dataList["paged"] ) ? $dataList["paged"] : true;
|
||||
$filters['count'] = isset( $dataList['count'] ) ? $dataList['count'] : true;
|
||||
|
||||
$filters["category"] = isset( $dataList["category"] ) ? $dataList["category"] : "";
|
||||
$filters["process"] = isset( $dataList["process"] ) ? $dataList["process"] : "";
|
||||
$filters["search"] = isset( $dataList["search"] ) ? $dataList["search"] : "";
|
||||
$filters["filter"] = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
|
||||
$filters["dateFrom"] = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : "";
|
||||
$filters["dateTo"] = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : "";
|
||||
|
||||
$filters["start"] = isset( $dataList["start"] ) ? $dataList["start"] : "0";
|
||||
$filters["limit"] = isset( $dataList["limit"] ) ? $dataList["limit"] : "25";
|
||||
$filters["sort"] = isset( $dataList["sort"] ) ? $dataList["sort"] : "";
|
||||
$filters["dir"] = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
|
||||
|
||||
// Select list
|
||||
switch ($listName) {
|
||||
case 'inbox':
|
||||
$list = new \ListInbox();
|
||||
$listpeer = 'ListInboxPeer';
|
||||
break;
|
||||
case 'participated_history':
|
||||
$list = new \ListParticipatedHistory();
|
||||
$listpeer = 'ListParticipatedHistoryPeer';
|
||||
break;
|
||||
case 'participated_last':
|
||||
$list = new \ListParticipatedLast();
|
||||
$listpeer = 'ListParticipatedLastPeer';
|
||||
break;
|
||||
case 'completed':
|
||||
$list = new \ListCompleted();
|
||||
$listpeer = 'ListCompletedPeer';
|
||||
break;
|
||||
case 'my_inbox':
|
||||
$list = new \ListMyInbox();
|
||||
$listpeer = 'ListMyInboxPeer';
|
||||
break;
|
||||
case 'unassigned':
|
||||
$list = new \ListUnassigned();
|
||||
$listpeer = 'ListUnassignedPeer';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Validate filters
|
||||
$filters["start"] = (int)$filters["start"];
|
||||
$filters["start"] = abs($filters["start"]);
|
||||
if ($filters["start"] != 0) {
|
||||
$filters["start"]--;
|
||||
}
|
||||
|
||||
$filters["limit"] = (int)$filters["limit"];
|
||||
$filters["limit"] = abs($filters["limit"]);
|
||||
if ($filters["limit"] == 0) {
|
||||
G::LoadClass("configuration");
|
||||
$conf = new \Configurations();
|
||||
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
|
||||
if (isset($generalConfCasesList['casesListRowNumber'])) {
|
||||
$filters["limit"] = (int)$generalConfCasesList['casesListRowNumber'];
|
||||
} else {
|
||||
$filters["limit"] = 25;
|
||||
}
|
||||
} else {
|
||||
$filters["limit"] = (int)$filters["limit"];
|
||||
}
|
||||
|
||||
$filters["sort"] = G::toUpper($filters["sort"]);
|
||||
$columnsList = $listpeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);
|
||||
if (!(in_array($filters["sort"], $columnsList))) {
|
||||
$filters["sort"] = '';
|
||||
}
|
||||
|
||||
$filters["dir"] = G::toUpper($filters["dir"]);
|
||||
if (!($filters["dir"] == 'DESC' || $filters["dir"] == 'ASC')) {
|
||||
$filters["dir"] = 'DESC';
|
||||
}
|
||||
if ($filters["process"] != '') {
|
||||
Validator::proUid($filters["process"], '$pro_uid');
|
||||
}
|
||||
if ($filters["category"] != '') {
|
||||
Validator::catUid($filters["category"], '$cat_uid');
|
||||
}
|
||||
if ($filters["dateFrom"] != '') {
|
||||
Validator::isDate($filters["dateFrom"], 'Y-m-d', '$date_from');
|
||||
}
|
||||
if ($filters["dateTo"] != '') {
|
||||
Validator::isDate($filters["dateTo"], 'Y-m-d', '$date_to');
|
||||
}
|
||||
|
||||
if ($total) {
|
||||
$total = $list->countTotal($userUid, $filters);
|
||||
return $total;
|
||||
}
|
||||
|
||||
$result = $list->loadList($userUid, $filters);
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$value) {
|
||||
$value = array_change_key_case($value, CASE_LOWER);
|
||||
}
|
||||
}
|
||||
|
||||
$response = array();
|
||||
if ($filters["paged"]) {
|
||||
$filtersData = array();
|
||||
$filtersData['start'] = $filters["start"]+1;
|
||||
$filtersData['limit'] = $filters["limit"];
|
||||
$filtersData['sort'] = G::toLower($filters["sort"]);
|
||||
$filtersData['dir'] = G::toLower($filters["dir"]);
|
||||
$filtersData['cat_uid'] = $filters["category"];
|
||||
$filtersData['pro_uid'] = $filters["process"];
|
||||
$filtersData['search'] = $filters["search"];
|
||||
$filtersData['date_from'] = $filters["dateFrom"];
|
||||
$filtersData['date_to'] = $filters["dateTo"];
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
} else {
|
||||
$response = $result;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
643
workflow/engine/src/ProcessMaker/Services/Api/Lists.php
Normal file
643
workflow/engine/src/ProcessMaker/Services/Api/Lists.php
Normal file
@@ -0,0 +1,643 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Cases Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Lists extends Api
|
||||
{
|
||||
/**
|
||||
* Get list Inbox
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET
|
||||
* @url GET /inbox
|
||||
*/
|
||||
public function doGetListInbox(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('inbox', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Inbox
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /inbox/total
|
||||
* @url GET /total
|
||||
*/
|
||||
public function doGetCountInbox(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('inbox', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Participated Last
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated
|
||||
* @url GET /participated-last
|
||||
*/
|
||||
public function doGetListParticipatedLast(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('participated_last', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Participated Last
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated/total
|
||||
* @url GET /participated-last/total
|
||||
*/
|
||||
public function doGetCountParticipatedLast(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('participated_last', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Participated History
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated-history
|
||||
*/
|
||||
public function doGetListParticipatedHistory(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('participated_history', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Participated History
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated-history/total
|
||||
*/
|
||||
public function doGetCountParticipatedHistory(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('participated_history', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get List Completed
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /completed
|
||||
*/
|
||||
public function doGetListCompleted(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('completed', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Participated History
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /completed/total
|
||||
*/
|
||||
public function doGetCountCompleted(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('completed', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get List Completed
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /my-inbox
|
||||
*/
|
||||
public function doGetListMyInbox(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('completed', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Participated History
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /my-inbox/total
|
||||
*/
|
||||
public function doGetCountListMyInbox(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('completed', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Unassigned
|
||||
*
|
||||
* @param string $count {@from path}
|
||||
* @param string $paged {@from path}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /unassigned
|
||||
*/
|
||||
public function doGetListUnassigned(
|
||||
$count = true,
|
||||
$paged = true,
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_UPDATE_DATE',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$usr_uid = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = (empty($usr_uid)) ? $this->getUserId() : $usr_uid;
|
||||
$dataList['paged'] = $paged;
|
||||
$dataList['count'] = $count;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('unassigned', $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count list Unassigned
|
||||
*
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @param string $filter {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /unassigned/total
|
||||
*/
|
||||
public function doGetCountUnassigned(
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = '',
|
||||
$filter = '',
|
||||
$date_from = '',
|
||||
$date_to = ''
|
||||
) {
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('participated_history', $dataList, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,3 +79,7 @@ debug = 1
|
||||
[alias: roles]
|
||||
role = "ProcessMaker\Services\Api\Role"
|
||||
|
||||
[alias: lists]
|
||||
list = "ProcessMaker\Services\Api\Lists"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user