Merged in release/3.7.5 (pull request #8443)

release/3.7.5
This commit is contained in:
Paula Quispe
2022-05-06 15:00:00 +00:00
18 changed files with 132 additions and 138 deletions

View File

@@ -2994,6 +2994,7 @@ class LdapAdvanced
$this->arrayUserUpdateChecked[$username] = 1;
$arrayUserDataUpdate = [];
$extendedData = [];
foreach ($arrayAttributesToSync as $key => $value) {
$fieldName = $key;
@@ -3015,12 +3016,24 @@ class LdapAdvanced
break;
}
if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) {
$arrayUserDataUpdate[$fieldName] = $ldapAttributeValue;
if (isset($arrayUser[$username][$fieldName])) {
if ($ldapAttributeValue != $arrayUser[$username][$fieldName]) {
$arrayUserDataUpdate[$fieldName] = $ldapAttributeValue;
}
} else {
$extendedData[$fieldName] = $ldapAttributeValue;
}
}
}
//update the extended data
if (!empty($extendedData)) {
$json = $arrayUser[$username]['USR_EXTENDED_ATTRIBUTES_DATA'];
$oldExtendedData = empty($json) ? [] : json_decode($json, true);
$extendedData = array_merge($oldExtendedData, $extendedData);
$arrayUserDataUpdate['USR_EXTENDED_ATTRIBUTES_DATA'] = json_encode($extendedData);
}
if (!empty($arrayUserDataUpdate)) {
$arrayUserDataUpdate['USR_UID'] = $arrayUser[$username]['USR_UID'];

View File

@@ -4016,8 +4016,8 @@ msgstr "Case Description"
# TRANSLATION
# LABEL/ID_CASE_DOES_NOT_EXIST
#: LABEL/ID_CASE_DOES_NOT_EXIST
msgid "Case {CASE_NUMBER} does not exist"
msgstr "Case {CASE_NUMBER} does not exist"
msgid "Case {0} does not exist"
msgstr "Case {0} does not exist"
# TRANSLATION
# LABEL/ID_CASE_DOES_NOT_EXIST2

View File

@@ -57481,7 +57481,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CASE_DELETED_SUCCESSFULLY','en','The Case {APP_NUMBER} was deleted successfully!','2014-01-15') ,
( 'LABEL','ID_CASE_DEL_INDEX_DOES_NOT_EXIST','en','The case {0}: {1} with {2}: {3} does not exist.','2015-09-30') ,
( 'LABEL','ID_CASE_DESCRIPTION','en','Case Description','2014-01-15') ,
( 'LABEL','ID_CASE_DOES_NOT_EXIST','en','Case {CASE_NUMBER} does not exist','2014-01-15') ,
( 'LABEL','ID_CASE_DOES_NOT_EXIST','en','Case {0} does not exist','2022-04-19') ,
( 'LABEL','ID_CASE_DOES_NOT_EXIST2','en','The case with {0}: {1} does not exist.','2014-06-05') ,
( 'LABEL','ID_CASE_DOES_NOT_EXISTS','en','This case does not exist','2014-01-15') ,
( 'LABEL','ID_CASE_DOES_NOT_EXIST_JS','en','Case {0} does not exist','2014-01-15') ,

View File

@@ -109,14 +109,15 @@
deleteAttributeProcess() {
this.rows.splice(this.selectedRowIndex - 1, 1);
},
saveRow(obj) {
saveRow(object) {
let obj = Object.assign({}, object);//important to clone the object
if (obj.index === null) {
delete obj.index;
this.rows.push(obj);
} else {
let i = obj.index;
delete obj.index;
this.rows[i - 1] = obj;
Object.assign(this.rows[i - 1], obj);
}
},
connectionSettings() {

View File

@@ -91,13 +91,13 @@ class Search extends AbstractCases
// Filter by user who started
if ($this->getUserStartedId()) {
// Get the case numbers related to this filter
$result = Delegation::casesStartedBy($this->getUserStartedId(), $this->getOffset(), $this->getLimit());
$result = Delegation::casesStartedBy($this->getUserStartedId());
$query->specificCases($result);
}
// Filter by user who completed
if ($this->getUserCompletedId()) {
// Get the case numbers related to this filter
$result = Delegation::casesCompletedBy($this->getUserCompletedId(), $this->getOffset(), $this->getLimit());
$result = Delegation::casesCompletedBy($this->getUserCompletedId());
$query->specificCases($result);
}
// Filter by task

View File

@@ -366,6 +366,7 @@ class CaseList extends Model
[
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'case_number',
'idFilter' => 'case_number',
'name' => G::LoadTranslation('ID_MYCASE_NUMBER'),
'type' => 'integer',
'source' => 'APPLICATION',
@@ -375,6 +376,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'case_title',
'idFilter' => 'caseTitle',
'name' => G::LoadTranslation('ID_CASE_THREAD_TITLE'),
'type' => 'string',
'source' => 'APPLICATION',
@@ -384,6 +386,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'process_category',
'idFilter' => 'process_category',
'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'),
'type' => 'string',
'source' => 'APPLICATION',
@@ -393,6 +396,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'process_name',
'idFilter' => 'process_name',
'name' => G::LoadTranslation('ID_PROCESS_NAME'),
'type' => 'string',
'source' => 'APPLICATION',
@@ -402,6 +406,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'task',
'idFilter' => 'task',
'name' => G::LoadTranslation('ID_TASK'),
'type' => 'string',
'source' => 'APPLICATION',
@@ -411,6 +416,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'send_by',
'idFilter' => 'send_by',
'name' => G::LoadTranslation('ID_SEND_BY'),
'type' => 'string',
'source' => 'APPLICATION',
@@ -420,6 +426,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'paused', 'unassigned'],
'field' => 'due_date',
'idFilter' => 'due_date',
'name' => G::LoadTranslation('ID_DUE_DATE'),
'type' => 'date',
'source' => 'APPLICATION',
@@ -429,6 +436,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'paused', 'unassigned'],
'field' => 'delegation_date',
'idFilter' => 'delegation_date',
'name' => G::LoadTranslation('ID_DELEGATION_DATE'),
'type' => 'date',
'source' => 'APPLICATION',
@@ -438,6 +446,7 @@ class CaseList extends Model
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'priority',
'idFilter' => 'priority',
'name' => G::LoadTranslation('ID_PRIORITY'),
'type' => 'string',
'source' => 'APPLICATION',

View File

@@ -2131,12 +2131,10 @@ class Delegation extends Model
* Get cases completed by specific user
*
* @param int $userId
* @param int $offset
* @param int $limit
*
* @return array
*/
public static function casesCompletedBy(int $userId, int $offset = 0, int $limit = 15)
public static function casesCompletedBy(int $userId)
{
// Get the case numbers related to this filter
$query = Delegation::query()->select(['APP_NUMBER']);
@@ -2144,8 +2142,6 @@ class Delegation extends Model
$query->participated($userId);
// Filter the last thread
$query->lastThread();
// Apply the limit
$query->offset($offset)->limit($limit);
// Get the result
$results = $query->get();
@@ -2156,12 +2152,10 @@ class Delegation extends Model
* Get cases started by specific user
*
* @param int $userId
* @param int $offset
* @param int $limit
*
* @return array
*/
public static function casesStartedBy(int $userId, int $offset = 0, int $limit = 15)
public static function casesStartedBy(int $userId)
{
// Get the case numbers related to this filter
$query = Delegation::query()->select(['APP_NUMBER']);
@@ -2169,8 +2163,6 @@ class Delegation extends Model
$query->participated($userId);
// Filter the first thread
$query->caseStarted();
// Apply the limit
$query->offset($offset)->limit($limit);
// Get the result
$results = $query->get();

View File

@@ -93,4 +93,65 @@ class UserConfig extends Model
->delete();
return $userConfig;
}
/**
* This updates the filter settings on custom case list.
* @param string $id
* @param array $caseList
*/
public static function updateUserConfig(string $id, array $caseList)
{
//get columns deactivates
$columnsDisableFilter = [];
if (isset($caseList['columns'])) {
foreach ($caseList['columns'] as $column) {
if ($column->enableFilter === false) {
$columnsDisableFilter[] = $column;
}
}
}
//process all custom configuration
$name = 'userConfig';
$usersConfig = UserConfig::select(['USR_ID', 'USC_SETTING'])
->where('USC_NAME', '=', $name)
->get();
foreach ($usersConfig as $value) {
if (empty($value->USC_SETTING)) {
continue;
}
$lists = json_decode($value->USC_SETTING);
foreach ($lists as &$list) {
if (!property_exists($list, 'customCaseList')) {
continue;
}
foreach ($list->customCaseList as $key => &$item) {
if (intval($key) !== intval($id)) {
continue;
}
if (!property_exists($item, 'filters')) {
continue;
}
if (!is_array($item->filters)) {
continue;
}
$i = count($item->filters) - 1;
while ($i >= 0) {
if (isset($item->filters[$i])) {
foreach ($columnsDisableFilter as $column) {
if ($item->filters[$i]->fieldId === $column->field) {
unset($item->filters[$i]);
//reindex array keys
$item->filters = array_values($item->filters);
}
}
}
$i--;
}
}
}
//update database
$lists = (array) $lists;
UserConfig::editSetting($value->USR_ID, $name, $lists);
}
}
}

View File

@@ -6,6 +6,7 @@ use Exception;
use G;
use Luracast\Restler\RestException;
use ProcessMaker\Model\CaseList as CaseListBusinessModel;
USE ProcessMaker\Model\UserConfig;
use ProcessMaker\Services\Api;
use RBAC;
@@ -62,6 +63,7 @@ class CaseList extends Api
throw new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_DOES_NOT_EXIST'));
}
$caseList = CaseListBusinessModel::getAliasFromColumnName($caseList->toArray());
UserConfig::updateUserConfig($id, $caseList);
return $caseList;
}

View File

@@ -1815,9 +1815,9 @@ class Light extends Api
*
* @access protected
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
* @url GET /:app_uid/variables
* @url GET /:appUid/variables
*
* @param string $app_uid {@min 1}{@max 32}
* @param string $appUid {@min 1}{@max 32}
* @param string $dyn_uid
* @param string $pro_uid
* @param string $act_uid
@@ -1825,7 +1825,7 @@ class Light extends Api
* @return mixed
* @throws RestException
*/
public function doGetCaseVariables($app_uid, $dyn_uid = null, $pro_uid = null, $act_uid = null, $app_index = null)
public function doGetCaseVariables($appUid, $dyn_uid = null, $pro_uid = null, $act_uid = null, $app_index = null)
{
try {
$usr_uid = $this->getUserId();
@@ -1834,7 +1834,7 @@ class Light extends Api
if (!empty($pro_uid)) {
$_SESSION['PROCESS'] = $pro_uid;
}
$response = $cases->getCaseVariables($app_uid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index);
$response = $cases->getCaseVariables($appUid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index);
return DateTime::convertUtcToTimeZone($response);
} catch (Exception $e) {