PMCORE-2333 Web entry can still be used/create cases when process is inactive

This commit is contained in:
Roly Rudy Gutierrez Pinto
2021-03-02 13:00:23 -04:00
parent d1f61a99fe
commit 3d3a4f2da7
4 changed files with 42 additions and 12 deletions

View File

@@ -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" msgid "The username or email is incorrect"
msgstr "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 # TRANSLATION
# LABEL/ID_THIS_MONTH # LABEL/ID_THIS_MONTH
#: LABEL/ID_THIS_MONTH #: LABEL/ID_THIS_MONTH

View File

@@ -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_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_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_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_MONTH','en','This Month','2014-01-15') ,
( 'LABEL','ID_THIS_QUARTER','en','This quarter','2014-01-15') , ( 'LABEL','ID_THIS_QUARTER','en','This quarter','2014-01-15') ,
( 'LABEL','ID_THIS_WEEK','en','This Week','2014-01-15') , ( 'LABEL','ID_THIS_WEEK','en','This Week','2014-01-15') ,

View File

@@ -1,4 +1,7 @@
<?php <?php
use ProcessMaker\Model\Process;
/** /**
* This page is the WebEntry Access Point. * This page is the WebEntry Access Point.
*/ */
@@ -18,6 +21,14 @@ $configuration = $conf->getConfiguration(
$userInformationFormat = isset($outResult['format']) ? $outResult['format'] : $userInformationFormat = isset($outResult['format']) ? $outResult['format'] :
'@lastName, @firstName (@userName)'; '@lastName, @firstName (@userName)';
$webEntryModel = \WebEntryPeer::retrieveByPK($weUid); $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();
}
?> ?>
<html> <html>
<head> <head>

View File

@@ -8,20 +8,16 @@ use G;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use RBAC; use RBAC;
/**
* Class Process
* @package ProcessMaker\Model
*
* Represents a business process object in the system.
*/
class Process extends Model class Process extends Model
{ {
// Set our table name // Set our table name
protected $table = 'PROCESS'; protected $table = 'PROCESS';
protected $primaryKey = 'PRO_ID'; protected $primaryKey = 'PRO_ID';
// Our custom timestamp columns // Our custom timestamp columns
const CREATED_AT = 'PRO_CREATE_DATE'; const CREATED_AT = 'PRO_CREATE_DATE';
const UPDATED_AT = 'PRO_UPDATE_DATE'; const UPDATED_AT = 'PRO_UPDATE_DATE';
// Columns to see in the process list // Columns to see in the process list
public $listColumns = [ public $listColumns = [
'PRO_UID', 'PRO_UID',
@@ -278,7 +274,8 @@ class Process extends Model
$sort = 'PRO_CREATE_DATE', $sort = 'PRO_CREATE_DATE',
$counterByProcess = true, $counterByProcess = true,
$subProcess = false $subProcess = false
) { )
{
$process = new Process(); $process = new Process();
$rows = $process->getListColumns(); $rows = $process->getListColumns();
if (!in_array($sort, $rows)) { if (!in_array($sort, $rows)) {
@@ -358,7 +355,7 @@ class Process extends Model
$item['PROJECT_TYPE'] = ($bpmnProcess) ? 'bpmn' : 'classic'; $item['PROJECT_TYPE'] = ($bpmnProcess) ? 'bpmn' : 'classic';
// Get the process type: PUBLIC or PRIVATE // 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 // Get information about the owner, with the format defined
$creatorOwner = $systemConf->usersNameFormat($item['USR_USERNAME'], $item['USR_FIRSTNAME'], $item['USR_LASTNAME']); $creatorOwner = $systemConf->usersNameFormat($item['USR_USERNAME'], $item['USR_FIRSTNAME'], $item['USR_LASTNAME']);
@@ -445,6 +442,21 @@ class Process extends Model
// Return processes // Return processes
return $query->get()->toArray(); 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);
} }
} }