bugfix/PMDMS-23
This commit is contained in:
@@ -1147,7 +1147,7 @@ class WsBase
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$uFields = $oTask->load($aAppDel['TAS_UID']);
|
$uFields = $oTask->load($aAppDel['TAS_UID']);
|
||||||
$taskName = $uFields['TAS_TITLE'];
|
$taskName = $uFields['TAS_TITLE'] ?? '';
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$taskName = '';
|
$taskName = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use ProcessMaker\Model\Documents;
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The point of this application is upload the file and create the input document record
|
* The point of this application is upload the file and create the input document record
|
||||||
* if the post attached file has error code 0 continue in other case nothing to do.
|
* if the post attached file has error code 0 continue in other case nothing to do.
|
||||||
*/
|
*/
|
||||||
if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
if (isset($_FILES["ATTACH_FILE"]) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
||||||
try {
|
try {
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
if (!$application->exists($_POST["APPLICATION"])) {
|
if (!$application->exists($_POST["APPLICATION"])) {
|
||||||
@@ -120,7 +121,13 @@ if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
|||||||
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
|
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
|
||||||
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
|
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
|
||||||
$documentData = new uploadDocumentData($_POST["APPLICATION"], $_POST["USR_UID"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
|
$documentData = new uploadDocumentData($_POST["APPLICATION"], $_POST["USR_UID"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
|
||||||
|
try {
|
||||||
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
|
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
|
||||||
|
} catch (Exception $error) {
|
||||||
|
// Is expected an exception when the user tries to upload a versioned input document, the file is removed and the error bubbled
|
||||||
|
Documents::where('APP_DOC_UID', $sAppDocUid)->where('DOC_VERSION', $iDocVersion)->delete();
|
||||||
|
throw $error;
|
||||||
|
}
|
||||||
|
|
||||||
if ($uploadReturn) {
|
if ($uploadReturn) {
|
||||||
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
|
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
|
||||||
|
|||||||
@@ -3975,13 +3975,19 @@ class Cases
|
|||||||
$info = pathinfo($arrayFileName['name']);
|
$info = pathinfo($arrayFileName['name']);
|
||||||
$extension = (isset($info['extension'])) ? $info['extension'] : '';
|
$extension = (isset($info['extension'])) ? $info['extension'] : '';
|
||||||
$pathCase = G::getPathFromUID($appUid);
|
$pathCase = G::getPathFromUID($appUid);
|
||||||
$pathFile = PATH_DOCUMENT . $pathCase . PATH_SEP . $objCreated->getAppDocUid() . '_1.' . $extension;
|
$pathFile = PATH_DOCUMENT . $pathCase . PATH_SEP . $objCreated->getAppDocUid() . '_' . $objCreated->getDocVersion() . '.' . $extension;
|
||||||
|
|
||||||
// Instance object used by the hook
|
// Instance object used by the hook
|
||||||
$documentData = new uploadDocumentData($appUid, $userUid, $pathFile, $objCreated->getAppDocFilename(), $objCreated->getAppDocUid(), 1);
|
$documentData = new uploadDocumentData($appUid, $userUid, $pathFile, $objCreated->getAppDocFilename(), $objCreated->getAppDocUid(), $objCreated->getDocVersion());
|
||||||
|
|
||||||
// Execute hook
|
// Execute hook
|
||||||
|
try {
|
||||||
$uploadReturn = $pluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
|
$uploadReturn = $pluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
|
||||||
|
} catch (Exception $error) {
|
||||||
|
// Is expected an exception when the user tries to upload a versioned input document, the file is removed and the error bubbled
|
||||||
|
Documents::where('APP_DOC_UID', $objCreated->getAppDocUid())->where('DOC_VERSION', $objCreated->getDocVersion())->delete();
|
||||||
|
throw $error;
|
||||||
|
}
|
||||||
|
|
||||||
// If the executions is correct, update the record related to the document
|
// If the executions is correct, update the record related to the document
|
||||||
if ($uploadReturn) {
|
if ($uploadReturn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user