diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 81547d3bb..7ba3cf716 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -63,6 +63,9 @@ $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int) (env('MAIN_SYSTEM_UTC_TIME_ZONE', ini_set('date.timezone', $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] ? 'UTC' : env('MAIN_TIME_ZONE', 'America/New_York')); define('TIME_ZONE', ini_get('date.timezone')); +// Only test async routing +define('DISABLE_TASK_MANAGER_ROUTING_ASYNC', false); + //This path includes PM tables model classes set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DB . SYS_SYS . "/"); diff --git a/workflow/engine/methods/cases/cases_Derivate.php b/workflow/engine/methods/cases/cases_Derivate.php index bae587c50..c8d97bb5c 100644 --- a/workflow/engine/methods/cases/cases_Derivate.php +++ b/workflow/engine/methods/cases/cases_Derivate.php @@ -106,11 +106,17 @@ try { $cases = new Cases(); $cases->routeCase($processUid, $application, $postForm, $sStatus, $flagGmail, $tasUid, $index, $userLogged); }; - JobsManager::getSingleton()->dispatch(RouteCase::class, $closure); + if (!DISABLE_TASK_MANAGER_ROUTING_ASYNC) { + // Routing the case asynchronically + JobsManager::getSingleton()->dispatch(RouteCase::class, $closure); - //We close the related threads. - $cases = new Cases(); - $cases->CloseCurrentDelegation($application, $index); + // We close the related threads. + $cases = new Cases(); + $cases->CloseCurrentDelegation($application, $index); + } else { + // Routing the case synchronically + $closure(); + } $debuggerAvailable = true; $casesRedirector = 'casesListExtJsRedirector'; @@ -126,13 +132,42 @@ try { } } - $loc = $nextStep['PAGE']; - - //Triggers After + // Triggers After $isIE = Bootstrap::isIE(); - unset($_SESSION['TRIGGER_DEBUG']); - //close tab only if IE11 add a validation was added if the current skin is uxs + // If the routing of cases asynchronically is disabled, use the old behaviour for debug option + if (DISABLE_TASK_MANAGER_ROUTING_ASYNC) { + // Determine the landing page + if (isset($_SESSION['PMDEBUGGER']) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) { + $_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $nextStep['PAGE']; + $loc = 'cases_Step?' . 'breakpoint=triggerdebug'; + } else { + $loc = $nextStep['PAGE']; + } + // If debug option is enabled for the process, load the debug template + if (isset($_SESSION['TRIGGER_DEBUG']['ISSET']) && !$isIE) { + if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1) { + $templatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html'); + $templatePower->prepare(); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('template', '', '', '', $templatePower); + $_POST['NextStep'] = $loc; + $G_PUBLISH->AddContent('view', 'cases/showDebugFrameLoader'); + $G_PUBLISH->AddContent('view', 'cases/showDebugFrameBreaker'); + $_SESSION['TRIGGER_DEBUG']['ISSET'] == 0; + G::RenderPage('publish', 'blank'); + exit(); + } else { + unset($_SESSION['TRIGGER_DEBUG']); + } + } + } else { + // If the case is routed synchronically, always redirect to the next step + $loc = $nextStep['PAGE']; + unset($_SESSION['TRIGGER_DEBUG']); + } + + // Close tab only if IE11 add a validation was added if the current skin is uxs if ($isIE && !isset($_SESSION['__OUTLOOK_CONNECTOR__']) && SYS_SKIN !== "uxs") { $script = "