@@ -1147,7 +1147,7 @@ class WsBase
|
||||
|
||||
try {
|
||||
$uFields = $oTask->load($aAppDel['TAS_UID']);
|
||||
$taskName = $uFields['TAS_TITLE'];
|
||||
$taskName = $uFields['TAS_TITLE'] ?? '';
|
||||
} catch (Exception $e) {
|
||||
$taskName = '';
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Model\Documents;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
/**
|
||||
* 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 (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
||||
if (isset($_FILES["ATTACH_FILE"]) && $_FILES["ATTACH_FILE"]["error"] == 0) {
|
||||
try {
|
||||
$application = new 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")) {
|
||||
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
|
||||
$documentData = new uploadDocumentData($_POST["APPLICATION"], $_POST["USR_UID"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
|
||||
try {
|
||||
$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) {
|
||||
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
|
||||
|
||||
@@ -3975,13 +3975,19 @@ class Cases
|
||||
$info = pathinfo($arrayFileName['name']);
|
||||
$extension = (isset($info['extension'])) ? $info['extension'] : '';
|
||||
$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
|
||||
$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
|
||||
try {
|
||||
$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 ($uploadReturn) {
|
||||
|
||||
Reference in New Issue
Block a user