Beispiel #1
0
 /**
  * @url POST /:prj_uid/timer-event
  *
  * @param string $prj_uid      {@min 32}{@max 32}
  * @param array  $request_data
  *
  * @status 201
  */
 public function doPostTimerEvent($prj_uid, array $request_data)
 {
     try {
         \ProcessMaker\BusinessModel\Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
         $arrayData = $this->timerEvent->create($prj_uid, \ProcessMaker\Util\DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
         $response = $arrayData;
         return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
 /**
  * @param string $date
  *
  * @return \DateTime
  */
 private function convertDateTimeToUtc($date)
 {
     if ($date == "") {
         $date = new \DateTime("now", new \DateTimeZone('UTC'));
     } else {
         $dateTimezone = new \DateTime($date, new \DateTimeZone('UTC'));
         $toUtcTime = DateTime::convertDataToUtc($dateTimezone);
         if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
             $date = $toUtcTime;
         } else {
             $date = new \DateTime($toUtcTime->date);
         }
     }
     return $date;
 }
Beispiel #3
0
 /**
  * @url PUT /:prj_uid/process
  *
  * @param string $prj_uid      {@min 32}{@max 32}
  * @param array  $request_data
  */
 public function doPutProcess($prj_uid, $request_data)
 {
     try {
         Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->setFormatFieldNameInUppercase(false);
         $process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
         $arrayData = $process->update($prj_uid, DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
Beispiel #4
0
 public function normalizedTimeZone($date)
 {
     $result = $date;
     $dateTimezone = new \DateTime($date, new \DateTimeZone('UTC'));
     $dateTimezone = DateTime::convertDataToUtc($dateTimezone);
     if (!(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])) {
         $result = $dateTimezone->format('Y-m-d H:i:s');
     } else {
         $result = (new \DateTime($dateTimezone->date))->format('Y-m-d H:i:s');
     }
     return $result;
 }
Beispiel #5
0
 /**
  * Get list Cases Unassigned
  *
  * @copyright Colosa - Bolivia
  *
  * @url GET /unassigned
  */
 public function doGetCasesListUnassigned($start = 0, $limit = 0, $sort = 'APP_CACHE_VIEW.APP_NUMBER', $dir = 'DESC', $cat_uid = '', $pro_uid = '', $search = '', $newestthan = '', $oldestthan = '')
 {
     try {
         $dataList['userId'] = $this->getUserId();
         $dataList['action'] = 'unassigned';
         $dataList['paged'] = false;
         $dataList['start'] = $start;
         $dataList['limit'] = $limit;
         $dataList['sort'] = $sort;
         $dataList['dir'] = $newestthan != '' ? 'ASC' : $dir;
         $dataList['category'] = $cat_uid;
         $dataList['process'] = $pro_uid;
         $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 DateTime::convertUtcToIso8601($result, $this->arrayFieldIso8601);
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }
Beispiel #6
0
 /**
  * @url PUT /:prj_uid/web-entry/:we_uid
  *
  * @param string $prj_uid      {@min 32}{@max 32}
  * @param string $we_uid       {@min 32}{@max 32}
  * @param array  $request_data
  */
 public function doPutWebEntry($prj_uid, $we_uid, array $request_data)
 {
     try {
         Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
         $arrayData = $this->webEntry->update($we_uid, $this->getUserId(), DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
     } catch (\Exception $e) {
         throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
     }
 }