Merged in darojas/processmaker (pull request #289)
Se corrige la respuesta en delete (dynaforms e inputdocuments) para PROCESS SUPERVISOR. Se adiciona endpoint para obtener un file especifico mediante su prf_uid en FILESMANAGER
This commit is contained in:
@@ -480,11 +480,9 @@ class FilesManager
|
|||||||
$sSubDirectory = substr(str_replace($sMainDirectory,'',$sSubDirectory),1);
|
$sSubDirectory = substr(str_replace($sMainDirectory,'',$sSubDirectory),1);
|
||||||
switch ($sMainDirectory) {
|
switch ($sMainDirectory) {
|
||||||
case 'templates':
|
case 'templates':
|
||||||
$sMainDirectory = 'mailTemplates';
|
|
||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
||||||
break;
|
break;
|
||||||
case 'public':
|
case 'public':
|
||||||
$sMainDirectory = 'public';
|
|
||||||
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -505,5 +503,44 @@ class FilesManager
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $sProcessUID {@min 32} {@max 32}
|
||||||
|
* @param string $prfUid {@min 32} {@max 32}
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function getProcessFileManager($sProcessUID, $prfUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($prfUid);
|
||||||
|
$fcontent = file_get_contents($oProcessFiles->getPrfPath());
|
||||||
|
$sFile = end(explode("/",$oProcessFiles->getPrfPath()));
|
||||||
|
$path = $oProcessFiles->getPrfPath();
|
||||||
|
$sPath = str_replace($sFile,'',$path);
|
||||||
|
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||||
|
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
|
||||||
|
if ($sMainDirectory == PATH_DATA_MAILTEMPLATES) {
|
||||||
|
$sMainDirectory = 'templates';
|
||||||
|
} else {
|
||||||
|
$sMainDirectory = 'public';
|
||||||
|
}
|
||||||
|
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
|
||||||
|
'prf_filename' => $sFile,
|
||||||
|
'usr_uid' => $oProcessFiles->getUsrUid(),
|
||||||
|
'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(),
|
||||||
|
'prf_path' => $sMainDirectory.$sSubDirectory,
|
||||||
|
'prf_type' => $oProcessFiles->getPrfType(),
|
||||||
|
'prf_editable' => $oProcessFiles->getPrfEditable(),
|
||||||
|
'prf_create_date' => $oProcessFiles->getPrfCreateDate(),
|
||||||
|
'prf_update_date' => $oProcessFiles->getPrfUpdateDate(),
|
||||||
|
'prf_content' => $fcontent);
|
||||||
|
return $oProcessFile;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -848,7 +848,6 @@ class ProcessSupervisor
|
|||||||
*/
|
*/
|
||||||
public function removeInputDocumentSupervisor($sProcessUID, $sPuiUID)
|
public function removeInputDocumentSupervisor($sProcessUID, $sPuiUID)
|
||||||
{
|
{
|
||||||
$oConnection = \Propel::getConnection(\StepSupervisorPeer::DATABASE_NAME);
|
|
||||||
try {
|
try {
|
||||||
$oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($sPuiUID);
|
$oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($sPuiUID);
|
||||||
if (!is_null($oInputDocumentSupervidor)) {
|
if (!is_null($oInputDocumentSupervidor)) {
|
||||||
@@ -858,7 +857,6 @@ class ProcessSupervisor
|
|||||||
throw (new \Exception('This row does not exist!'));
|
throw (new \Exception('This row does not exist!'));
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
$oConnection->rollback();
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,6 +151,26 @@ class FilesManager extends Api
|
|||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $prj_uid {@min 32} {@max 32}
|
||||||
|
* @param string $prf_uid {@min 32} {@max 32}
|
||||||
|
*
|
||||||
|
* @url GET /:prj_uid/file-manager/:prf_uid
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function doGetProcessFileManager($prj_uid, $prf_uid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$filesManager = new \BusinessModel\FilesManager();
|
||||||
|
$response = $filesManager->getProcessFileManager($prj_uid, $prf_uid);
|
||||||
|
//response
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//response
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProcessFilesManagerStructurePost
|
class ProcessFilesManagerStructurePost
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ class ProcessSupervisors extends Api
|
|||||||
try {
|
try {
|
||||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||||
$supervisor->removeDynaformSupervisor($prjUid, $pudUid);
|
$supervisor->removeDynaformSupervisor($prjUid, $pudUid);
|
||||||
|
ob_end_clean();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
@@ -304,6 +305,7 @@ class ProcessSupervisors extends Api
|
|||||||
try {
|
try {
|
||||||
$supervisor = new \BusinessModel\ProcessSupervisor();
|
$supervisor = new \BusinessModel\ProcessSupervisor();
|
||||||
$supervisor->removeInputDocumentSupervisor($prjUid, $puiUid);
|
$supervisor->removeInputDocumentSupervisor($prjUid, $puiUid);
|
||||||
|
ob_end_clean();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
|||||||
Reference in New Issue
Block a user