diff --git a/workflow/engine/methods/cases/casesStreamingFile.php b/workflow/engine/methods/cases/casesStreamingFile.php index a5e644156..fdc5c1ffb 100644 --- a/workflow/engine/methods/cases/casesStreamingFile.php +++ b/workflow/engine/methods/cases/casesStreamingFile.php @@ -24,8 +24,8 @@ if ($actionAjax == "streaming") { $file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid); - $realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext; - $realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext; + $realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext; + $realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext; if (file_exists( $realPath )) { $finfo = finfo_open(FILEINFO_MIME_TYPE); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index c2015ae7d..a45f086d1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -403,8 +403,8 @@ class Light //$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']); $file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid); - $realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext; - $realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext; + $realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext; + $realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext; $width = isset($fileData['width']) ? $fileData['width']:null; $height = isset($fileData['height']) ? $fileData['height']:null; @@ -604,8 +604,9 @@ class Light */ public function getInformation($userUid, $type, $app_uid) { - //$response = array(); + $response = array(); switch ($type) { + case 'unassigned': case 'paused': case 'participated': $oCase = new \Cases(); diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index c3421e0c6..ea3b3382a 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -611,52 +611,18 @@ class Light extends Api } /** - * @url POST /case/:app_uid/input-document + * @url POST /case/:app_uid/upload/location * - * @param string $app_uid { @min 32}{@max 32} - * @param string $tas_uid {@min 32}{@max 32} - * @param string $app_doc_comment - * @param string $inp_doc_uid {@min 32}{@max 32} - */ - public function doPostInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid) - { - try { - $userUid = $this->getUserId(); - $inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument(); - $file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid); - $response = $this->parserInputDocument($file); - } catch (\Exception $e) { - throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); - } - return $response; - } - - public function parserInputDocument ($data) - { - $structure = array( - 'app_doc_uid' => 'fileId', - 'app_doc_filename' => 'fileName', - 'app_doc_version' => 'version' - ); - $response = $this->replaceFields($data, $structure); - return $response; - } - - /** - * @url POST /case/:app_uid/input-document/location - * - * @param string $app_uid { @min 32}{@max 32} - * @param string $tas_uid {@min 32}{@max 32} - * @param string $app_doc_comment - * @param string $inp_doc_uid {@min 32}{@max 32} - * @param float $latitude {@min -90}{@max 90} + * @param string $app_uid { @min 32}{@max 32} + * @param float $latitude {@min -90}{@max 90} * @param float $longitude {@min -180}{@max 180} */ - public function postInputDocumentLocation($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $latitude, $longitude) + public function postInputDocumentLocation($app_uid, $latitude, $longitude) { try { $userUid = $this->getUserId(); - $inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument(); + $oMobile = new \ProcessMaker\BusinessModel\Light(); + $url = "http://maps.googleapis.com/maps/api/staticmap?center=".$latitude.','.$longitude."&format=jpg&size=600x600&zoom=15&markers=color:blue%7Clabel:S%7C".$latitude.','.$longitude; $imageLocation = imagecreatefromjpeg($url); $tmpfname = tempnam("php://temp","pmm"); @@ -668,17 +634,21 @@ class Light extends Api $_FILES["form"]["error"] = 0; $sizes = getimagesize($tmpfname); $_FILES["form"]["size"] = ($sizes['0'] * $sizes['1']); - $file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid); + + $request_data = array(array('name' => $_FILES["form"]["name"])); + $file = $oMobile->postUidUploadFiles($userUid, $app_uid, $request_data); $strPathName = PATH_DOCUMENT . G::getPathFromUID($app_uid) . PATH_SEP; - $strFileName = $file->app_doc_uid . "_" . $file->app_doc_version . ".jpg"; - copy($tmpfname, $strPathName . "/" . $strFileName); - $response = $this->parserInputDocument($file); + $strFileName = $file[0]['appDocUid'] . "_" . $file[0]['docVersion'] . ".jpg"; + if (! is_dir( $strPathName )) { + G::verifyPath( $strPathName, true ); + } + copy($tmpfname, $strPathName . $strFileName); unlink($tmpfname); } catch (\Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } - return $response; + return $file; } /**