change conters in list
This commit is contained in:
@@ -26,14 +26,34 @@ class Light extends Api
|
|||||||
public function countersCases ()
|
public function countersCases ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
$userId = $this->getUserId();
|
||||||
$counterCase = $oMobile->getCounterCase($this->getUserId());
|
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||||
|
$response = $lists->getCounters($userId);
|
||||||
|
$result = $this->parserCountersCases($response);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
return $counterCase;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function parserCountersCases ($data)
|
||||||
|
{
|
||||||
|
$structure = array(
|
||||||
|
"CASES_INBOX" => "toDo",
|
||||||
|
"CASES_DRAFT" => "draft",
|
||||||
|
"CASES_CANCELLED" => "cancelled",
|
||||||
|
"CASES_SENT" => "participated",
|
||||||
|
"CASES_PAUSED" => "paused",
|
||||||
|
"CASES_COMPLETED" => "completed",
|
||||||
|
"CASES_SELFSERVICE" => "unassigned",
|
||||||
|
);
|
||||||
|
$response = array();
|
||||||
|
foreach ($data as $counterList) {
|
||||||
|
$name = $structure[$counterList['item']];
|
||||||
|
$response[$name] = $counterList['count'];
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get list process start
|
* Get list process start
|
||||||
* @return array
|
* @return array
|
||||||
|
|||||||
Reference in New Issue
Block a user