From 8a8a4865b8d43b71cd884b3ade73b88feca3cc82 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 5 Mar 2021 17:41:42 -0400 Subject: [PATCH] PMCORE-2333 Web entry can still be used/create cases when process is inactive --- .../translations/english/processmaker.en.po | 6 ++++ workflow/engine/data/mysql/insert.sql | 1 + workflow/engine/methods/cases/cases_Open.php | 11 +++++++ .../engine/methods/cases/cases_SaveData.php | 10 ++++++ workflow/engine/methods/cases/cases_Step.php | 33 +++++++------------ 5 files changed, 39 insertions(+), 22 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index a928b275e..23221227e 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -4037,6 +4037,12 @@ msgstr "Loading Notes..." msgid "Show more notes" msgstr "Show more notes" +# TRANSLATION +# LABEL/ID_CASE_NOT_ALLOW_TO_BE_CREATED_DUE_TO_THE_PROCESS_IS_INACTIVE +#: LABEL/ID_CASE_NOT_ALLOW_TO_BE_CREATED_DUE_TO_THE_PROCESS_IS_INACTIVE +msgid "Case not allow to be created due to the process is inactive" +msgstr "Case not allow to be created due to the process is inactive" + # TRANSLATION # LABEL/ID_CASE_NOT_EXISTS #: LABEL/ID_CASE_NOT_EXISTS diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 09b0e54db..9f3b08360 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -57484,6 +57484,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES ( 'LABEL','ID_CASE_NOTES_MORE','en','Show more notes','2014-01-15') , +( 'LABEL','ID_CASE_NOT_ALLOW_TO_BE_CREATED_DUE_TO_THE_PROCESS_IS_INACTIVE','en','Case not allow to be created due to the process is inactive','2021-03-05') , ( 'LABEL','ID_CASE_NOT_EXISTS','en','The case does not exist','2014-01-15') , ( 'LABEL','ID_CASE_NOT_OPEN','en','This case is not open','2014-01-15') , ( 'LABEL','ID_CASE_NOT_PAUSED','en','Case with "{0}" not paused.','2015-08-14') , diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 0f01f0ebd..b9d4dfd1f 100644 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -1,5 +1,7 @@ loadCase($appUid, $delIndex); + if (!Process::isActive($fieldCase['PRO_UID'], 'PRO_UID')) { + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', [ + 'MESSAGE' => G::LoadTranslation('ID_THE_WEBSITE_CAN_NOT_BE_REACHED') + ]); + G::RenderPage('publish', 'blank'); + exit(); + } + if (!isset($_SESSION['CURRENT_TASK'])) { $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; } elseif ($_SESSION['CURRENT_TASK'] == '') { diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index fe69df0c2..ebc6f7b8d 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -1,5 +1,6 @@ thisIsTheCurrentUser( $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["USER_LOGGED"], "REDIRECT", "casesListExtJs" ); $Fields = $oCase->loadCase( $_SESSION["APPLICATION"] ); + + if (!ProcessModel::isActive($Fields['PRO_UID'], 'PRO_UID')) { + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', [ + 'MESSAGE' => G::LoadTranslation('ID_CASE_NOT_ALLOW_TO_BE_CREATED_DUE_TO_THE_PROCESS_IS_INACTIVE') + ]); + G::RenderPage('publish', 'blank'); + exit(); + } if ($swpmdynaform) { $dataFields = $Fields["APP_DATA"]; diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 78742db18..29ca5f703 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -1,5 +1,6 @@ alreadyRouted($_SESSION['APPLICATION'], $_SESSION['INDEX'])) { . ''); } } -/** - * cases_Step.php - * - * ProcessMaker Open Source Edition - * Copyright (C) 2004 - 2008 Colosa Inc.23 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ /* Permissions */ switch ($RBAC->userCanAccess('PM_CASES')) { @@ -163,6 +142,16 @@ $oStep = new Step(); $bmWebEntry = new \ProcessMaker\BusinessModel\WebEntry; $Fields = $oCase->loadCase($_SESSION['APPLICATION']); + +if (!ProcessModel::isActive($Fields['PRO_UID'], 'PRO_UID')) { + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', [ + 'MESSAGE' => G::LoadTranslation('ID_CASE_NOT_ALLOW_TO_BE_CREATED_DUE_TO_THE_PROCESS_IS_INACTIVE') + ]); + G::RenderPage('publish', 'blank'); + exit(); +} + $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); $sStatus = $Fields['APP_STATUS'];