diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 5661a367a..4b04d2d3f 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -6166,6 +6166,7 @@ class G define('PM_SCHEDULER_CREATE_CASE_BEFORE', 1019); define('PM_SCHEDULER_CREATE_CASE_AFTER', 1020); define('PM_SWAP_TEMPORARY_APP_NUMBER', 1021); + define('PM_REDIRECT', 1022); } /** diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php index da8f0ca71..926b0ce43 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php @@ -22,6 +22,7 @@ use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Validation\ValidationUploadedFiles; use ProcessUserPeer; use ResultSet; +use stdClass; use StepPeer; use StepSupervisorPeer; use Users; @@ -541,6 +542,21 @@ class InputDocument $iDocVersion = $oAppDocument->getDocVersion(); $info = pathinfo($oAppDocument->getAppDocFilename()); + // Plugin Hook PM_REDIRECT to redirect to a custom page + $pluginRegistry = PluginRegistry::loadSingleton(); + + // If the hook exists try to execute + if ($pluginRegistry->existsTrigger(PM_REDIRECT)) { + // Build the object to send + $data = new stdClass(); + $data->sApplicationUid = $oAppDocument->getAppUid(); + $data->appDocUid = $oAppDocument->getAppDocUid(); + $data->docType = ''; + + // Execute hook + $pluginRegistry->executeTriggers(PM_REDIRECT, $data); + } + $app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']); $file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php index 76a189f07..f5595d50e 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php @@ -3,6 +3,7 @@ namespace ProcessMaker\BusinessModel\Cases; use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; +use stdClass; class OutputDocument { @@ -372,6 +373,21 @@ class OutputDocument $pathInfo = pathinfo($appDocument->getAppDocFilename()); + // Plugin Hook PM_REDIRECT to redirect to a custom page + $pluginRegistry = PluginRegistry::loadSingleton(); + + // If the hook exists try to execute + if ($pluginRegistry->existsTrigger(PM_REDIRECT)) { + // Build the object to send + $data = new stdClass(); + $data->sApplicationUid = $appDocument->getAppUid(); + $data->appDocUid = $appDocument->getAppDocUid(); + $data->docType = $ext; + + // Execute hook + $pluginRegistry->executeTriggers(PM_REDIRECT, $data); + } + $extensionDoc = $ext; $versionDoc = '_' . $arrayAppDocumentData['DOC_VERSION'];