PM-4161 Modificaciones en los endpoints de Mobile para soportar timezones
This commit is contained in:
@@ -1214,7 +1214,7 @@ class Light
|
||||
$result = new \stdclass();
|
||||
|
||||
try {
|
||||
$unpauseDate = $request_data['unpauseDate'] . ' '. $request_data['unpauseTime'];
|
||||
//$unpauseDate = $request_data['unpauseDate'] . ' '. $request_data['unpauseTime'];
|
||||
$oCase = new \Cases();
|
||||
$iDelIndex = $oCase->getCurrentDelegation( $app_uid, $usr_uid );
|
||||
// Save the note pause reason
|
||||
@@ -1226,11 +1226,11 @@ class Light
|
||||
}
|
||||
// End save
|
||||
|
||||
$oCase->pauseCase($app_uid, $iDelIndex, $usr_uid, $unpauseDate);
|
||||
$oCase->pauseCase($app_uid, $iDelIndex, $usr_uid, $request_data['unpauseDate']);
|
||||
$app = new \Application();
|
||||
$caseData = $app->load($app_uid);
|
||||
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
|
||||
$data['UNPAUSE_DATE'] = $unpauseDate;
|
||||
$data['UNPAUSE_DATE'] = $request_data['unpauseDate'];
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
|
||||
|
||||
@@ -6,6 +6,8 @@ use \G;
|
||||
use \ProcessMaker\Project\Adapter;
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -15,6 +17,18 @@ use \Luracast\Restler\RestException;
|
||||
*/
|
||||
class Light extends Api
|
||||
{
|
||||
|
||||
private $arrayFieldIso8601 = [
|
||||
// request lists
|
||||
'dateFrom',
|
||||
'dateTo',
|
||||
'newestthan',
|
||||
'oldestthan',
|
||||
//return lists
|
||||
'date',
|
||||
'delegateDate',
|
||||
'dueDate'
|
||||
];
|
||||
/**
|
||||
* Get list counters
|
||||
* @return array
|
||||
@@ -115,13 +129,15 @@ class Light extends Api
|
||||
$dataList['newestthan'] = $newestthan;
|
||||
$dataList['oldestthan'] = $oldestthan;
|
||||
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('inbox', $dataList);
|
||||
if ($newestthan != '') {
|
||||
$response['data'] = array_reverse($response['data']);
|
||||
}
|
||||
$result = $this->parserDataTodo($response['data']);
|
||||
return $result;
|
||||
return DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -193,13 +209,15 @@ class Light extends Api
|
||||
$dataList['newestthan'] = $newestthan;
|
||||
$dataList['oldestthan'] = $oldestthan;
|
||||
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
$oCases = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $oCases->getList('inbox', $dataList);
|
||||
if ($newestthan != '') {
|
||||
$response['data'] = array_reverse($response['data']);
|
||||
}
|
||||
$result = $this->parserDataDraft($response['data']);
|
||||
return $result;
|
||||
return DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -280,13 +298,15 @@ class Light extends Api
|
||||
$dataList['newestthan'] = $newestthan;
|
||||
$dataList['oldestthan'] = $oldestthan;
|
||||
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
$oCases = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $oCases->getList('participated_last', $dataList);
|
||||
if ($newestthan != '') {
|
||||
$response['data'] = array_reverse($response['data']);
|
||||
}
|
||||
$result = $this->parserDataParticipated($response['data']);
|
||||
return $result;
|
||||
return DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -362,10 +382,12 @@ class Light extends Api
|
||||
$dataList['filter'] = $filter;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getList('paused', $dataList);
|
||||
$result = $this->parserDataParticipated($response['data']);
|
||||
return $result;
|
||||
return DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -439,10 +461,12 @@ class Light extends Api
|
||||
$dataList['search'] = $search;
|
||||
$dataList['newestthan'] = $newestthan;
|
||||
$dataList['oldestthan'] = $oldestthan;
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
$result = $this->parserDataUnassigned($response);
|
||||
return $result;
|
||||
return DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -558,9 +582,11 @@ class Light extends Api
|
||||
public function doGetCasesListHistory($app_uid)
|
||||
{
|
||||
try {
|
||||
$arrayFieldIso8601 = array('DEL_DELEGATE_DATE', 'DEL_INIT_DATE', 'DEL_FINISH_DATE');
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$response = $oMobile->getCasesListHistory($app_uid);
|
||||
$response['flow'] = $this->parserDataHistory($response['flow']);
|
||||
$response8601 = DateTime::convertUtcToIso8601($response['flow'], $arrayFieldIso8601);
|
||||
$response['flow'] = $this->parserDataHistory($response8601);
|
||||
$r = new \stdclass();
|
||||
$r->data = $response;
|
||||
$r->totalCount = count($response['flow']);
|
||||
@@ -956,10 +982,13 @@ class Light extends Api
|
||||
public function getInformation($type, $app_uid)
|
||||
{
|
||||
try {
|
||||
$arrayFieldIso8601 = array('caseCreateDate', 'caseUpdateData', 'delDelegateDate', 'delInitDate',
|
||||
'delDueDate', 'delFinishDate');
|
||||
$userUid = $this->getUserId();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$response = $oMobile->getInformation($userUid, $type, $app_uid);
|
||||
$response = $this->parserGetInformation($response);
|
||||
$response = DateTime::convertUtcToIso8601($response, $arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -1088,12 +1117,14 @@ class Light extends Api
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($dataList, $this->arrayFieldIso8601);
|
||||
$dataList = DateTime::convertDataToUtc($dataList, $this->arrayFieldIso8601);
|
||||
|
||||
$appNotes = new \AppNotes();
|
||||
$response = $appNotes->getNotesList( $app_uid, '', $start, $limit );
|
||||
$response = $this->parserDataNotes($response['array']['notes']);
|
||||
|
||||
return $response;
|
||||
return DateTime::convertUtcToIso8601($response, array('date'));
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -1243,6 +1274,7 @@ class Light extends Api
|
||||
public function pauseCase ($app_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
Validator::throwExceptionIfDataNotMetIso8601Format($request_data, array('unpauseDate'));
|
||||
$usr_uid = $this->getUserId();
|
||||
$oLight = new \ProcessMaker\BusinessModel\Light();
|
||||
$process = $oLight->pauseCase($usr_uid, $app_uid, $request_data);
|
||||
|
||||
Reference in New Issue
Block a user