Merge remote-tracking branch 'origin/develop' into feature/PMCORE-3140

This commit is contained in:
Rodrigo Quelca
2021-12-01 13:00:27 +00:00
45 changed files with 1597 additions and 1015 deletions

View File

@@ -24383,6 +24383,12 @@ msgstr "Screen Color Icon"
msgid "Script Task"
msgstr "Script Task"
# TRANSLATION
# LABEL/ID_SCRIPT_TASK_UNTITLED
#: LABEL/ID_SCRIPT_TASK_UNTITLED
msgid "Untitled - Script Task"
msgstr "Untitled - Script Task"
# TRANSLATION
# LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
#: LABEL/ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED
@@ -24965,6 +24971,18 @@ msgstr "Server reported"
msgid "Service"
msgstr "Service"
# TRANSLATION
# LABEL/ID_SERVICE_TASK
#: LABEL/ID_SERVICE_TASK
msgid "Service Task"
msgstr "Service Task"
# TRANSLATION
# LABEL/ID_SERVICE_TASK_UNTITLED
#: LABEL/ID_SERVICE_TASKUNTITLED
msgid "Untitled - Service Task"
msgstr "Untitled - Service Task"
# TRANSLATION
# LABEL/ID_SESSION
#: LABEL/ID_SESSION

View File

@@ -60988,6 +60988,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SCHEMA','en','Schema','2014-01-15') ,
( 'LABEL','ID_SCREEN_COLOR_ICON','en','Screen Color Icon','2021-08-10') ,
( 'LABEL','ID_SCRIPT_TASK','en','Script Task','2015-10-19') ,
( 'LABEL','ID_SCRIPT_TASK_UNTITLED','en','Untitled - Script Task','2021-11-23') ,
( 'LABEL','ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED','en','The Script-Task with {0}: "{1}" already registered','2016-08-01') ,
( 'LABEL','ID_SEARCH','en','Search','2014-01-15') ,
( 'LABEL','ID_SEARCHING','en','Searching...','2019-05-03') ,
@@ -61090,6 +61091,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SERVER_PROTOCOL','en','Server Protocol','2014-01-15') ,
( 'LABEL','ID_SERVER_REPORTED','en','Server reported','2014-01-15') ,
( 'LABEL','ID_SERVICE','en','Service','2014-01-15') ,
( 'LABEL','ID_SERVICE_TASK','en','Service','2021-11-23') ,
( 'LABEL','ID_SERVICE_TASK_UNTITLED','en','Service','2021-11-23') ,
( 'LABEL','ID_SESSION','en','Session','2014-01-15') ,
( 'LABEL','ID_SESSION_ACTIVE','en','Session active','2014-01-15') ,
( 'LABEL','ID_SESSION_DIRECTORY','en','Session directory','2015-11-05') ,

View File

@@ -78,8 +78,7 @@ if (
// Get the label of previous task
if (!empty($fieldsDelegation['TAS_ID'])) {
$taskInstance = new ModelTask();
$fieldsCase['PREVIOUS_TASK'] = $taskInstance->title($fieldsDelegation['TAS_ID']);
$fieldsCase['PREVIOUS_TASK'] = ModelTask::title($fieldsDelegation['TAS_ID'])['title'];
}
// To enable information (dynaforms, steps) before claim a case

View File

@@ -15,8 +15,9 @@ try {
$urlLogin = (substr(SYS_SKIN, 0, 2) !== 'ux')? 'login' : '../main/login';
}
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
if (!$RBAC->singleSignOn) {
setcookie("singleSignOn", '0', time() + (24 * 60 * 60), '/');
setcookie('singleSignOn', '0', $cookieOptions);
if (!isset($_POST['form']) ) {
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error');
G::header('Location: login');
@@ -181,7 +182,7 @@ try {
EnterpriseClass::enterpriseSystemUpdate($loginInfo);
initUserSession($uid, $usr);
} else {
setcookie("singleSignOn", '1', time() + (24 * 60 * 60), '/');
setcookie('singleSignOn', '1', $cookieOptions);
$uid = $RBAC->userObj->fields['USR_UID'];
$usr = $RBAC->userObj->fields['USR_USERNAME'];
initUserSession($uid, $usr);
@@ -416,7 +417,7 @@ try {
$configS = System::getSystemConfiguration('', '', config("system.workspace"));
$activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true;
if ($activeSession){
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
setcookie('PM-TabPrimary', 101010010, $cookieOptions);
}
// Update the User's last login date

View File

@@ -81,8 +81,8 @@ try {
}
}
/*----------------------------------********---------------------------------*/
setcookie('singleSignOn', '1', time() + (24 * 60 * 60), '/');
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
setcookie('singleSignOn', '1', $cookieOptions);
initUserSession(
$_SESSION['__USER_LOGGED_SSO__'],

View File

@@ -1,27 +1,4 @@
<?php
/**
* login.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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -182,11 +159,11 @@ if (isset($_SESSION['USER_LOGGED'])) {
session_start();
session_regenerate_id();
if (PHP_VERSION < 5.2) {
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), "; HttpOnly");
} else {
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true);
}
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'httponly' => true]);
setcookie(session_name(), session_id(), $cookieOptions);
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => '/sys' . config('system.workspace'), 'httponly' => true]);
setcookie('workspaceSkin', SYS_SKIN, $cookieOptions);
if (strlen($msg) > 0) {
$_SESSION['G_MESSAGE'] = $msg;
@@ -323,14 +300,16 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword'])
? $oConf->aConfig['login_enableForgotPassword']
: 'off';
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), time() + (24 * 60 * 60), SYS_URI);
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => SYS_URI]);
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), $cookieOptions);
$configS = System::getSystemConfiguration('', '', config("system.workspace"));
$activeSession = isset($configS['session_block']) ? !(int)$configS['session_block'] : true;
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
if ($activeSession) {
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
setcookie('PM-TabPrimary', 101010010, $cookieOptions);
} else {
setcookie("PM-TabPrimary", uniqid(), time() + (24 * 60 * 60), '/');
setcookie('PM-TabPrimary', uniqid(), $cookieOptions);
}
$oHeadPublisher->addScriptCode("var flagForgotPassword = '$flagForgotPassword';");

View File

@@ -1,28 +1,5 @@
<?php
/**
* sysLogin.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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*----------------------------------********---------------------------------*/
//Browser Compatibility
$browserSupported = G::checkBrowserCompatibility();
if ($browserSupported==false) {
@@ -50,11 +27,14 @@ if (!empty($_SESSION['G_MESSAGE_TYPE'])) {
}
//Initialize session
@session_destroy();
session_start();
session_regenerate_id();
//Set options for PHP session cookie
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'httponly' => true]);
setcookie(session_name(), session_id(), $cookieOptions);
//Restore session variables
$_SESSION = array_merge($_SESSION, $arraySession);
@@ -169,8 +149,12 @@ switch (WS_IN_LOGIN) {
$fileLogin = 'login/sysLogin';
break;
}
setcookie("PM-Warning", trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), time() + (24 * 60 * 60), SYS_CURRENT_URI);
setcookie("PM-TabPrimary", uniqid(), time() + (24 * 60 * 60), '/');
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => SYS_CURRENT_URI]);
setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), $cookieOptions);
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60)]);
setcookie('PM-TabPrimary', uniqid(), $cookieOptions);
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');

View File

@@ -34,6 +34,9 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$caseFields = $case->loadCase($applicationUid, $delIndex);
//this value is only important for Propel::getConnection()
$_SESSION['PROCESS'] = $caseFields['PRO_UID'];
// Updating case variables with system constants
$systemConstants = G::getSystemConstants();
$caseFields['APP_DATA']['USER_LOGGED'] = $systemConstants['USER_LOGGED'];

View File

@@ -1552,16 +1552,16 @@ class AbstractCases implements CasesInterface
$list = end($listArray);
switch ($list) {
case 'Inbox':
$query->inbox($this->getUserId());
$query->inboxMetrics();
break;
case 'Draft':
$query->draft($this->getUserId());
$query->draftMetrics();
break;
case 'Paused':
$query->paused($this->getUserId());
$query->pausedMetrics();
break;
case 'Unassigned':
$query->selfService($this->getUserUid());
$query->selfServiceMetrics();
break;
}
$query->joinProcess();
@@ -1604,16 +1604,16 @@ class AbstractCases implements CasesInterface
$list = end($listArray);
switch ($list) {
case 'Inbox':
$query->inbox($this->getUserId());
$query->inboxMetrics();
break;
case 'Draft':
$query->draft($this->getUserId());
$query->draftMetrics();
break;
case 'Paused':
$query->paused($this->getUserId());
$query->pausedMetrics();
break;
case 'Unassigned':
$query->selfService($this->getUserUid());
$query->selfServiceMetrics();
break;
}
$query->joinProcess();
@@ -1657,16 +1657,16 @@ class AbstractCases implements CasesInterface
$list = end($listArray);
switch ($list) {
case 'Inbox':
$query->inbox($this->getUserId());
$query->inboxMetrics();
break;
case 'Draft':
$query->draft($this->getUserId());
$query->draftMetrics();
break;
case 'Paused':
$query->paused($this->getUserId());
$query->pausedMetrics();
break;
case 'Unassigned':
$query->selfService($this->getUserUid());
$query->selfServiceMetrics();
break;
}
$query->joinProcess();

View File

@@ -6,6 +6,7 @@ use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
class Draft extends AbstractCases
@@ -127,10 +128,25 @@ class Draft extends AbstractCases
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
// Get the send by related to the previous index
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
$userInfo = [];
$dummyInfo = [];
if (!empty($previousThread)) {
// When the task has an user
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
// When the task does not have users refers to dummy task
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
if (!empty($taskInfo)) {
$dummyInfo = [
'task_id' => $previousThread['TAS_ID'],
'name' => $taskInfo['title'],
'type' => $taskInfo['type']
];
}
}
$result = [];
$result['del_previous'] = $item['DEL_PREVIOUS'];
$result['user_tooltip'] = $userInfo;
$result['dummy_task'] = $dummyInfo;
$item['SEND_BY_INFO'] = $result;
return $item;
@@ -228,4 +244,16 @@ class Draft extends AbstractCases
'total' => $count
];
}
/**
* Count how many cases there are in DRAFT
*
* @return int
*/
public function getCounterMetrics()
{
$query = Delegation::query()->select();
$query->draftMetrics();
return $query->count(['APPLICATION.APP_NUMBER']);
}
}

View File

@@ -6,6 +6,7 @@ use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
class Inbox extends AbstractCases
@@ -81,7 +82,6 @@ class Inbox extends AbstractCases
if (!empty($this->getCaseUid())) {
$query->appUid($this->getCaseUid());
}
// Specific delegate date from
if (!empty($this->getDelegateFrom())) {
$query->delegateDateFrom($this->getDelegateFrom());
@@ -90,8 +90,7 @@ class Inbox extends AbstractCases
if (!empty($this->getDelegateTo())) {
$query->delegateDateTo($this->getDelegateTo());
}
// Specific usrId represented by sendBy.
// Specific usrId represented by sendBy
if (!empty($this->getSendBy())) {
$query->sendBy($this->getSendBy());
}
@@ -113,7 +112,7 @@ class Inbox extends AbstractCases
// Join with users
$query->joinUser();
// Join with task
$query->JoinTask();
$query->joinTask();
// Join with application for add the initial scope for TO_DO cases
$query->inbox($this->getUserId());
/** Apply filters */
@@ -147,10 +146,26 @@ class Inbox extends AbstractCases
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
// Get the send by related to the previous index
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
$userInfo = [];
$dummyInfo = [];
if (!empty($previousThread)) {
// When the task has an user
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
// When the task does not have users refers to dummy task
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
if (!empty($taskInfo)) {
$dummyInfo = [
'task_id' => $previousThread['TAS_ID'],
'name' => $taskInfo['title'],
'type' => $taskInfo['type']
];
}
}
$result = [];
$result['del_previous'] = $item['DEL_PREVIOUS'];
$result['key_name'] = !empty($userInfo) ? 'user_tooltip' : 'dummy_task';
$result['user_tooltip'] = $userInfo;
$result['dummy_task'] = $dummyInfo;
$item['SEND_BY_INFO'] = $result;
return $item;
@@ -246,4 +261,16 @@ class Inbox extends AbstractCases
'total' => $count
];
}
/**
* Count how many cases there are in TO_DO
*
* @return int
*/
public function getCounterMetrics()
{
$query = Delegation::query()->select();
$query->inboxMetrics();
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
}

View File

@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
class Paused extends AbstractCases
@@ -80,7 +81,6 @@ class Paused extends AbstractCases
if (!empty($this->getCaseUid())) {
$query->appUid($this->getCaseUid());
}
// Specific delegate date from
if (!empty($this->getDelegateFrom())) {
$query->delegateDateFrom($this->getDelegateFrom());
@@ -89,8 +89,7 @@ class Paused extends AbstractCases
if (!empty($this->getDelegateTo())) {
$query->delegateDateTo($this->getDelegateTo());
}
// Specific usrId represented by sendBy.
// Specific usrId represented by sendBy
if (!empty($this->getSendBy())) {
$query->sendBy($this->getSendBy());
}
@@ -109,7 +108,7 @@ class Paused extends AbstractCases
// Join with process
$query->joinProcess();
// Join with task
$query->JoinTask();
$query->joinTask();
// Scope that set the paused cases
$query->paused($this->getUserId());
/** Apply filters */
@@ -141,10 +140,26 @@ class Paused extends AbstractCases
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
// Get the send by related to the previous index
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
$userInfo = [];
$dummyInfo = [];
if (!empty($previousThread)) {
// When the task has an user
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
// When the task does not have users refers to dummy task
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
if (!empty($taskInfo)) {
$dummyInfo = [
'task_id' => $previousThread['TAS_ID'],
'name' => $taskInfo['title'],
'type' => $taskInfo['type']
];
}
}
$result = [];
$result['del_previous'] = $item['DEL_PREVIOUS'];
$result['key_name'] = !empty($userInfo) ? 'user_tooltip' : 'dummy_task';
$result['user_tooltip'] = $userInfo;
$result['dummy_task'] = $dummyInfo;
$item['SEND_BY_INFO'] = $result;
return $item;
@@ -240,4 +255,16 @@ class Paused extends AbstractCases
'total' => $count
];
}
/**
* Count how many cases there are in PAUSED
*
* @return int
*/
public function getCounterMetrics()
{
$query = Delegation::query()->select();
$query->pausedMetrics();
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
}

View File

@@ -6,6 +6,7 @@ use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
class Unassigned extends AbstractCases
@@ -90,8 +91,7 @@ class Unassigned extends AbstractCases
if (!empty($this->getDelegateTo())) {
$query->delegateDateTo($this->getDelegateTo());
}
// Specific usrId represented by sendBy.
// Specific usrId represented by sendBy
if (!empty($this->getSendBy())) {
$query->sendBy($this->getSendBy());
}
@@ -149,10 +149,26 @@ class Unassigned extends AbstractCases
$item['DEL_DELEGATE_DATE_LABEL'] = applyMaskDateEnvironment($item['DEL_DELEGATE_DATE']);
// Get the send by related to the previous index
$previousThread = Delegation::getThreadInfo($item['APP_NUMBER'], $item['DEL_PREVIOUS']);
$userInfo = !empty($previousThread) ? User::getInformation($previousThread['USR_ID']) : [];
$userInfo = [];
$dummyInfo = [];
if (!empty($previousThread)) {
// When the task has an user
$userInfo = ($previousThread['USR_ID'] !== 0) ? User::getInformation($previousThread['USR_ID']) : [];
// When the task does not have users refers to dummy task
$taskInfo = ($previousThread['USR_ID'] === 0) ? Task::title($previousThread['TAS_ID']) : [];
if (!empty($taskInfo)) {
$dummyInfo = [
'task_id' => $previousThread['TAS_ID'],
'name' => $taskInfo['title'],
'type' => $taskInfo['type']
];
}
}
$result = [];
$result['del_previous'] = $item['DEL_PREVIOUS'];
$result['key_name'] = !empty($userInfo) ? 'user_tooltip' : 'dummy_task';
$result['user_tooltip'] = $userInfo;
$result['dummy_task'] = $dummyInfo;
$item['SEND_BY_INFO'] = $result;
return $item;
@@ -248,4 +264,16 @@ class Unassigned extends AbstractCases
'total' => $count
];
}
/**
* Count how many cases there are in SELF_SERVICE
*
* @return int
*/
public function getCounterMetrics()
{
$query = Delegation::query()->select();
$query->selfServiceMetrics();
return $query->count(['APP_DELEGATION.APP_NUMBER']);
}
}

View File

@@ -874,8 +874,8 @@ class Light
session_start();
session_regenerate_id();
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false,
true);
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => '/sys' . config('system.workspace'), 'httponly' => true]);
setcookie('workspaceSkin', SYS_SKIN, $cookieOptions);
if (strlen($msg) > 0) {
$_SESSION['G_MESSAGE'] = $msg;

View File

@@ -138,7 +138,7 @@ class ChangeLogResult
$totalCount = 0;
$values = [];
$this->getLogsFromDataBase($this->appUid, function($row) use(&$logs, &$totalCount, &$values) {
$this->getLogsFromDataBase($this->appUid, function ($row) use (&$logs, &$totalCount, &$values) {
$appData = $this->getAppData($row['DATA']);
$this->removeVariables($appData);
@@ -146,22 +146,52 @@ class ChangeLogResult
if ((int) $row['SOURCE_ID'] === ChangeLog::FromABE) {
$hasPermission = true;
}
if (in_array((int) $row['EXECUTED_AT'], [ChangeLog::BEFORE_ASSIGNMENT, ChangeLog::BEFORE_ROUTING, ChangeLog::AFTER_ROUTING])) {
$hasPermission = true;
}
$count = 0;
foreach ($appData as $key => $value) {
if ($hasPermission && (!isset($values[$key]) || $values[$key] !== $value)) {
// Apply mask
$dateLabel = applyMaskDateEnvironment($row['DATE'],'', false);
$dateLabel = applyMaskDateEnvironment($row['DATE'], '', false);
// Apply the timezone
$dateLabel = DateTime::convertUtcToTimeZone($dateLabel);
$previousValue = !isset($values[$key]) ? null : $values[$key];
//get 'title' label
$objectTitle = '';
if ((int) $row['OBJECT_TYPE'] === ChangeLog::DYNAFORM) {
$objectTitle = G::LoadTranslation('ID_DYNAFORM') . ': ' . $row['DYN_TITLE'];
}
if ((int) $row['OBJECT_TYPE'] === ChangeLog::TRIGGER) {
if ((int) $row['EXECUTED_AT'] === ChangeLog::BEFORE_ASSIGNMENT) {
$objectTitle = G::LoadTranslation('ID_BEFORE_ASSIGNMENT');
}
if ((int) $row['EXECUTED_AT'] === ChangeLog::BEFORE_ROUTING) {
$objectTitle = G::LoadTranslation('ID_BEFORE_DERIVATION');
}
if ((int) $row['EXECUTED_AT'] === ChangeLog::AFTER_ROUTING) {
$objectTitle = G::LoadTranslation('ID_AFTER_DERIVATION');
}
}
//get 'from' label
$from = ChangeLog::getChangeLog()->getApplicationNameById($row['SOURCE_ID']);
if ((int) $row['SOURCE_ID'] === ChangeLog::FromUnknow) {
if ((int) $row['EXECUTED_AT'] === ChangeLog::BEFORE_ROUTING ||
(int) $row['EXECUTED_AT'] === ChangeLog::AFTER_ROUTING) {
$from = ChangeLog::getChangeLog()->getApplicationNameById(ChangeLog::FromWeb);
}
}
$record = ''
. G::LoadTranslation('ID_TASK') . ': ' . $row['TAS_TITLE'] . ' / '
. G::LoadTranslation('ID_DYNAFORM') . ': ' . $row['DYN_TITLE'] . ' / '
. $objectTitle . ' / '
. G::LoadTranslation('ID_LAN_UPDATE_DATE') . ': ' . $dateLabel . ' / '
. G::LoadTranslation('ID_USER') . ': ' . $row['USR_USERNAME'] . ' / '
. G::LoadTranslation('ID_FROM') . ': ' . ChangeLog::getChangeLog()->getApplicationNameById($row['SOURCE_ID']);
. G::LoadTranslation('ID_FROM') . ': ' . $from;
$struct = new LogStruct();
$struct->setField($key)
@@ -210,6 +240,7 @@ class ChangeLogResult
. "A.USR_ID, "
. "A.OBJECT_ID, "
. "A.OBJECT_UID, "
. "A.OBJECT_TYPE, "
. "A.EXECUTED_AT, "
. "A.SOURCE_ID, "
. "A.DATA, "
@@ -220,8 +251,8 @@ class ChangeLogResult
. "LEFT JOIN PROCESS AS C ON (C.PRO_ID=A.PRO_ID) "
. "LEFT JOIN TASK AS D ON (D.TAS_ID=A.TAS_ID) "
. "LEFT JOIN USERS AS E ON (E.USR_ID=A.USR_ID) "
. "LEFT JOIN DYNAFORM AS F ON (F.DYN_ID=A.OBJECT_ID AND A.OBJECT_TYPE=" . ChangeLog::DYNAFORM . ") "
. "ORDER BY A.DATE ASC ";
. "LEFT JOIN DYNAFORM AS F ON (F.DYN_ID=A.OBJECT_ID AND A.OBJECT_TYPE IN (" . ChangeLog::DYNAFORM . ", " . ChangeLog::TRIGGER . ")) "
. "ORDER BY A.CHANGE_LOG_ID,A.DATE ASC ";
$stmt = $conn->prepareStatement($sql);
$stmt->set(1, $appUid);

View File

@@ -86,6 +86,21 @@ class System
'disable_task_manager_routing_async' => '0',
'on_one_server_enable' => 0,
'at_risk_delegation_max_time' => '0.2',
'samesite_cookie_setting' => ''
];
public static $cookieDefaultOptions = [
'expires' => 0,
'path' => '/',
'domain' => '',
'secure' => false,
'httponly' => false,
'samesite' => ''
];
public static $cookieSameSiteValues = [
'Lax',
'Strict'
];
/**
@@ -1252,6 +1267,13 @@ class System
$config['at_risk_delegation_max_time'] = self::$defaultConfig['at_risk_delegation_max_time'];
}
$value = ucfirst(strtolower($config['samesite_cookie_setting']));
if (in_array($value, self::$cookieSameSiteValues)) {
$config['samesite_cookie_setting'] = $value;
} else {
$config['samesite_cookie_setting'] = '';
}
return $config;
}
@@ -1778,4 +1800,29 @@ class System
$parseDsn["pass"] = urldecode($parseDsn["pass"]);
return $parseDsn;
}
/**
* Build the options for a cookie, according to the system configuration and values optionally sent to this method
*
* @param array $options
* @return array
*/
public static function buildCookieOptions(array $options = [])
{
// Get system values
$cookieOptions = self::$cookieDefaultOptions;
$systemConfiguration = self::getSystemConfiguration();
// Always set "secure" option according to the server protocol
$cookieOptions['secure'] = G::is_https();
// Set the "samesite" option according to the system configuration
$cookieOptions['samesite'] = $systemConfiguration['samesite_cookie_setting'];
// Overrides the cookie options with the values sent to the method
$cookieOptions = array_merge($cookieOptions, $options);
// Return the cookie options
return $cookieOptions;
}
}

View File

@@ -1069,6 +1069,64 @@ class Delegation extends Model
return $query;
}
/**
* Scope the Inbox cases no matter the user
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeInboxMetrics($query)
{
$query->joinApplication();
$query->status(Application::STATUS_TODO);
$query->threadOpen();
return $query;
}
/**
* Scope a draft cases no matter the user
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeDraftMetrics($query)
{
$query->joinApplication();
$query->status(Application::STATUS_DRAFT);
$query->threadOpen();
return $query;
}
/**
* Scope paused cases list no matter the user
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopePausedMetrics($query)
{
$query->joinAppDelay('PAUSE');
$query->joinApplication();
return $query;
}
/**
* Scope a self service cases no matter the user
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeSelfServiceMetrics($query)
{
$query->taskAssignType('SELF_SERVICE');
$query->threadOpen()->withoutUserId();
return $query;
}
/**
* Get specific cases unassigned that the user can view
*

View File

@@ -120,16 +120,18 @@ class Task extends Model
*
* @param integer $tasId
*
* @return string
* @return array
*/
public function title($tasId)
public static function title($tasId)
{
$query = Task::query()->select('TAS_TITLE');
$query = Task::query()->select('TAS_TITLE', 'TAS_TYPE');
$query->where('TAS_ID', $tasId);
$results = $query->get();
$title = '';
$results->each(function ($item, $key) use (&$title) {
$type = '';
$results->each(function ($item, $key) use (&$title, &$type) {
$title = $item->TAS_TITLE;
$type = $item->TAS_TYPE;
switch ($title) {
case "INTERMEDIATE-THROW-EMAIL-EVENT":
$title = G::LoadTranslation('ID_INTERMEDIATE_THROW_EMAIL_EVENT');
@@ -143,10 +145,41 @@ class Task extends Model
case "INTERMEDIATE-CATCH-TIMER-EVENT":
$title = G::LoadTranslation('ID_INTERMEDIATE_CATCH_TIMER_EVENT');
break;
case "SCRIPT-TASK":
$title = G::LoadTranslation('ID_SCRIPT_TASK_UNTITLED');
break;
case "SERVICE-TASK":
$title = G::LoadTranslation('ID_SERVICE_TASK_UNTITLED');
break;
default:
$title = G::LoadTranslation('ID_ANONYMOUS');
}
switch ($type) {
case "INTERMEDIATE-THROW-EMAIL-EVENT":
$type = G::LoadTranslation('ID_EMAIL_EVENT');
break;
case "INTERMEDIATE-THROW-MESSAGE-EVENT":
case "INTERMEDIATE-CATCH-MESSAGE-EVENT":
$type = G::LoadTranslation('ID_MESSAGE_EVENT');
break;
case "INTERMEDIATE-CATCH-TIMER-EVENT":
$type = G::LoadTranslation('ID_TIMER_EVENT');
break;
case "SCRIPT-TASK":
$type = G::LoadTranslation('ID_SCRIPT_TASK');
break;
case "SERVICE-TASK":
$type = G::LoadTranslation('ID_SERVICE_TASK');
break;
default:
$type = G::LoadTranslation('ID_NONE');
}
});
return $title;
return [
'title' => $title,
'type' => $type,
];
}
/**

View File

@@ -3,11 +3,11 @@
namespace ProcessMaker\Services\Api;
use Exception;
use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\BusinessModel\Cases\Inbox;
use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\User;
use ProcessMaker\Services\Api;
use RBAC;
@@ -46,8 +46,6 @@ class Metrics extends Api
*/
public function getProcessTotalCases($caseList, $category = null, $topTen = false, $processes = [])
{
$usrUid = $this->getUserId();
$usrId = !empty($usrUid) ? User::getId($usrUid) : 0;
try {
switch ($caseList) {
case 'inbox':
@@ -61,10 +59,8 @@ class Metrics extends Api
break;
case 'unassigned':
$list = new Unassigned();
$list->setUserUid($usrUid);
break;
}
$list->setUserId($usrId);
$result = $list->getCountersByProcesses($category, $topTen, $processes);
return $result;
} catch (Exception $e) {
@@ -91,8 +87,6 @@ class Metrics extends Api
*/
public function getTotalCasesByRange($caseList, $processId = null, $dateFrom = null, $dateTo = null, $groupBy = 'day')
{
$usrUid = $this->getUserId();
$usrId = !empty($usrUid) ? User::getId($usrUid) : 0;
try {
switch ($caseList) {
case 'inbox':
@@ -106,10 +100,8 @@ class Metrics extends Api
break;
case 'unassigned':
$list = new Unassigned();
$list->setUserUid($usrUid);
break;
}
$list->setUserId($usrId);
$result = $list->getCountersByRange($processId, $dateFrom, $dateTo, $groupBy);
return $result;
} catch (Exception $e) {
@@ -125,31 +117,21 @@ class Metrics extends Api
* @return array
*
* @throws RestException
*
* @class AccessControl {@permission TASK_METRICS_VIEW}
*/
public function getCountersList()
{
try {
$usrUid = $this->getUserId();
$properties['user'] = !empty($usrUid) ? User::getId($usrUid) : 0;
$listInbox = new Inbox();
$listInbox->setProperties($properties);
$listDraft = new Draft();
$listDraft->setUserUid($usrUid);
$listDraft->setProperties($properties);
$listPaused = new Paused();
$listPaused->setProperties($properties);
$listUnassigned = new Unassigned();
$listUnassigned->setUserUid($usrUid);
$listUnassigned->setProperties($properties);
$casesInbox = $listInbox->getCounter();
$casesDraft = $listDraft->getCounter();
$casesPaused = $listPaused->getCounter();
$casesUnassigned = $listUnassigned->getCounter();
$casesInbox = $listInbox->getCounterMetrics();
$casesDraft = $listDraft->getCounterMetrics();
$casesPaused = $listPaused->getCounterMetrics();
$casesUnassigned = $listUnassigned->getCounterMetrics();
$result = [
['List Name' => 'Inbox', 'Total' => $casesInbox, 'Color' => 'green'],
@@ -179,12 +161,12 @@ class Metrics extends Api
* @return array
*
* @throws RestException
*
* @class AccessControl {@permission TASK_METRICS_VIEW}
*/
public function getCasesRiskByProcess($caseList = 'inbox', $process, $dateFrom = null, $dateTo = null, $riskStatus = 'ON_TIME', $topCases = null)
{
try {
$usrUid = $this->getUserId();
$usrId = !empty($usrUid) ? User::getId($usrUid) : 0;
switch ($caseList) {
case 'inbox':
$list = new Inbox();
@@ -197,10 +179,8 @@ class Metrics extends Api
break;
case 'unassigned':
$list = new Unassigned();
$list->setUserUid($usrUid);
break;
}
$list->setUserId($usrId);
$result = $list->getCasesRisk($process, $dateFrom, $dateTo, $riskStatus, $topCases);
return $result;
} catch (Exception $e) {

View File

@@ -1,6 +1,7 @@
<?php
namespace ProcessMaker\Services\OAuth2;
use Bootstrap;
use Luracast\Restler\iAuthenticate;
use Luracast\Restler\RestException;
use OAuth2\Request;
@@ -367,7 +368,8 @@ class Server implements iAuthenticate
$lifetime = 1440;
}
setcookie($session->getSessionName(), $_COOKIE[$session->getSessionName()], time() + $lifetime, "/", null, false, true);
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + $lifetime, 'secure' => false, 'httponly' => true]);
setcookie($session->getSessionName(), $_COOKIE[$session->getSessionName()], $cookieOptions);
}
}

View File

@@ -39,7 +39,7 @@
<script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/lib-dev/js/underscore-min.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery.layout.min.js"></script>
<script type="text/javascript" src="/lib-dev/js/restclient.min.js"></script>
<script type="text/javascript" src="/lib-dev/js/modernizr.js"></script>