diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 02f8b9a3b..5b7fd249a 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -26051,6 +26051,12 @@ msgstr "The user roles for attribute {0} has been modified, if you proceed to sa msgid "The username or email is incorrect" msgstr "The username or email is incorrect" +# TRANSLATION +# LABEL/ID_THE_WEBSITE_CAN_NOT_BE_REACHED +#: LABEL/ID_THE_WEBSITE_CAN_NOT_BE_REACHED +msgid "The website can not be reached" +msgstr "The website can not be reached" + # TRANSLATION # LABEL/ID_THIS_MONTH #: LABEL/ID_THIS_MONTH diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index fc8dad492..57cef814e 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -61297,6 +61297,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED','en','The upload of PHP files was disabled please contact the system administrator.','2018-04-20') , ( 'LABEL','ID_THE_USER_ROLES_FOR_ATTRIBUTE_HAS_BEEN_DELETED_PLEASE_CONFIRM','en','The user roles for attribute {0} has been modified, if you proceed to save this attribute, all information for users stored in the attribute will be deleted for the removed role, please confirm.','2020-12-15') , ( 'LABEL','ID_THE_USERNAME_EMAIL_IS_INCORRECT','en','The username or email is incorrect','2018-01-18') , +( 'LABEL','ID_THE_WEBSITE_CAN_NOT_BE_REACHED','en','The website can not be reached','2020-03-02') , ( 'LABEL','ID_THIS_MONTH','en','This Month','2014-01-15') , ( 'LABEL','ID_THIS_QUARTER','en','This quarter','2014-01-15') , ( 'LABEL','ID_THIS_WEEK','en','This Week','2014-01-15') , diff --git a/workflow/engine/methods/webentry/access.php b/workflow/engine/methods/webentry/access.php index d5ec3da5e..ff28dedf3 100644 --- a/workflow/engine/methods/webentry/access.php +++ b/workflow/engine/methods/webentry/access.php @@ -1,4 +1,7 @@ getConfiguration( $userInformationFormat = isset($outResult['format']) ? $outResult['format'] : '@lastName, @firstName (@userName)'; $webEntryModel = \WebEntryPeer::retrieveByPK($weUid); +if (!Process::isActive($webEntryModel->getProUid(), '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(); +} ?> diff --git a/workflow/engine/src/ProcessMaker/Model/Process.php b/workflow/engine/src/ProcessMaker/Model/Process.php index c3d80d0eb..76a60e74b 100644 --- a/workflow/engine/src/ProcessMaker/Model/Process.php +++ b/workflow/engine/src/ProcessMaker/Model/Process.php @@ -8,20 +8,16 @@ use G; use Illuminate\Database\Eloquent\Model; use RBAC; -/** - * Class Process - * @package ProcessMaker\Model - * - * Represents a business process object in the system. - */ class Process extends Model { // Set our table name protected $table = 'PROCESS'; protected $primaryKey = 'PRO_ID'; + // Our custom timestamp columns const CREATED_AT = 'PRO_CREATE_DATE'; const UPDATED_AT = 'PRO_UPDATE_DATE'; + // Columns to see in the process list public $listColumns = [ 'PRO_UID', @@ -244,10 +240,10 @@ class Process extends Model $processes = array_column($privateProcesses, 'PRO_ID'); Process::whereIn('PRO_ID', $processes) - ->update(['PRO_TYPE_PROCESS' => 'PUBLIC']); + ->update(['PRO_TYPE_PROCESS' => 'PUBLIC']); Process::where('PRO_CREATE_USER', $userUid) - ->update(['PRO_CREATE_USER' => $admin]); + ->update(['PRO_CREATE_USER' => $admin]); } /** @@ -278,11 +274,12 @@ class Process extends Model $sort = 'PRO_CREATE_DATE', $counterByProcess = true, $subProcess = false - ) { + ) + { $process = new Process(); $rows = $process->getListColumns(); if (!in_array($sort, $rows)) { - throw new Exception('The column ' . $sort . ' does not exist'); + throw new Exception('The column ' . $sort . ' does not exist'); } // Select rows $query = Process::query()->select($rows)->noStatus(); @@ -340,7 +337,7 @@ class Process extends Model $mask = isset($systemConf->aConfig['dateFormat']) ? $systemConf->aConfig['dateFormat'] : ''; // Prepare the final result - $results->transform(function ($item, $key) use ($counterByProcess, $systemConf, $mask){ + $results->transform(function ($item, $key) use ($counterByProcess, $systemConf, $mask) { // Get the counter related to the status // todo: those counters needs to remove when the PMCORE-2314 was implemented $item['CASES_COUNT_DRAFT'] = $counterByProcess ? Application::getCountByProUid($item['PRO_UID'], 1) : 0; @@ -358,7 +355,7 @@ class Process extends Model $item['PROJECT_TYPE'] = ($bpmnProcess) ? 'bpmn' : 'classic'; // Get the process type: PUBLIC or PRIVATE - $item['PRO_TYPE_PROCESS'] = ($item['PRO_TYPE_PROCESS'] == 'PUBLIC') ? G::LoadTranslation("ID_PUBLIC") : G::LoadTranslation("ID_PRIVATE");; + $item['PRO_TYPE_PROCESS'] = ($item['PRO_TYPE_PROCESS'] == 'PUBLIC') ? G::LoadTranslation("ID_PUBLIC") : G::LoadTranslation("ID_PRIVATE"); // Get information about the owner, with the format defined $creatorOwner = $systemConf->usersNameFormat($item['USR_USERNAME'], $item['USR_FIRSTNAME'], $item['USR_LASTNAME']); @@ -445,6 +442,21 @@ class Process extends Model // Return processes return $query->get()->toArray(); + } + /** + * Return true if process is active, false otherwise. + * @param int|string $proId + * @param string $key + * @return bool + */ + public static function isActive($proId, string $key = 'PRO_ID'): bool + { + $process = Process::query() + ->where($key, $proId) + ->where('PRO_STATUS', 'ACTIVE') + ->get() + ->first(); + return !empty($process); } }