Fix in endpoint location, download base64 and streaming file
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user