PMCORE-2333 Web entry can still be used/create cases when process is inactive
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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') ,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Model\Process;
|
||||
|
||||
/**
|
||||
* This page is the WebEntry Access Point.
|
||||
*/
|
||||
@@ -18,6 +21,14 @@ $configuration = $conf->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();
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@@ -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',
|
||||
@@ -278,7 +274,8 @@ class Process extends Model
|
||||
$sort = 'PRO_CREATE_DATE',
|
||||
$counterByProcess = true,
|
||||
$subProcess = false
|
||||
) {
|
||||
)
|
||||
{
|
||||
$process = new Process();
|
||||
$rows = $process->getListColumns();
|
||||
if (!in_array($sort, $rows)) {
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user