Merged in bugfix/PMCORE-3824 (pull request #8441)

PMCORE-3824: Update with 3.7.5

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2022-05-03 16:35:25 +00:00
committed by Julio Cesar Laura Avendaño
17 changed files with 118 additions and 136 deletions

View File

@@ -251,7 +251,7 @@
</b-col>
<b-col cols="6">
<b-form-checkbox
v-if="props.row.field =='process_category' || props.row.field =='process_name'"
v-if="disabledField(props.row.field)"
v-model="enabledFilterRows"
@change="onTongleFilter(props.row.field)"
name="check-button"
@@ -432,7 +432,7 @@ export default {
this.dataCaseList =this.params.columns.filter(elem => elem.set === true);
this.dataCaseList.forEach(function (value) {
//Force to false in process_category & process_name
if (value.enableFilter && (value.field != "process_category" && value.field != "process_name" )) {
if (value.enableFilter && !that.disabledField(value.field)) {
that.enabledFilterRows.push(value.field);
}
});
@@ -741,6 +741,10 @@ export default {
columns.push('actions');
columns.unshift('detail');
return columns
},
disabledField(field){
const fields = [ "due_date" , "process_category" , "process_name" , "priority" ];
return !(fields.indexOf(field) == -1);
}
},
};

View File

@@ -127,7 +127,7 @@
<span v-if="column === 'case_number'" class="v-card-text-highlight">
{{ props["item"]["CASE_NUMBER"] }}
</span>
<span v-if="column === 'thread_title'" class="v-card-text-highlight">
<span v-if="column === 'case_title'" class="v-card-text-highlight">
{{ props["item"]["THREAD_TITLE"] }}
</span>
<span v-if="column === 'process_category'" class="v-card-text-highlight">
@@ -184,7 +184,7 @@
<span v-if="column === 'case_number'" class="v-card-text-highlight">
{{ props["item"]["CASE_NUMBER"] }}
</span>
<span v-if="column === 'thread_title'" class="v-card-text-highlight">
<span v-if="column === 'case_title'" class="v-card-text-highlight">
{{ props["item"]["THREAD_TITLE"] }}
</span>
<span v-if="column === 'process_category'" class="v-card-text-highlight">
@@ -398,7 +398,7 @@ export default {
},
itemMap: {
case_number: "caseNumber",
task_title: "taskTitle",
task: "taskTitle",
thread_title: "caseTitle",
delegation_date: "delegationDate",
send_by: "bySendBy",
@@ -849,7 +849,7 @@ export default {
product.optionLabel = item.name;
product.tagPrefix = item.name;
if (product.items && product.items[0]) {
product.items[0].id = item.field;
product.items[0].id = item.idFilter?item.idFilter : item.field;
}
product.placeholder = "";
return product;

View File

@@ -11,7 +11,7 @@ export default {
dataCasesList: [],
defaultColumns: [
"case_number",
"thread_title",
"case_title",
"process_name",
"task",
"send_by",
@@ -69,7 +69,7 @@ export default {
},
headings: {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
case_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),

View File

@@ -71,7 +71,7 @@ export default {
"task"
],
requestFunction(data) {
return that.getCases(data);
return that.getCasesViewMore(data);
},
requestFunctionViewMore(data) {
return that.getCasesViewMore(data);
@@ -83,31 +83,6 @@ export default {
},
methods: {
/**
* Get cases for Vue Card View
*/
getCases(data) {
let that = this,
dt,
filters = {};
_.forIn(this.filters, function (item, key) {
filters[item.filterVar] = item.value;
});
return new Promise((resolutionFunc, rejectionFunc) => {
api.cases
.draft(filters)
.then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({
data: dt,
count: response.data.total,
});
})
.catch((e) => {
rejectionFunc(e);
});
});
},
/**
* Get cases for Vue Card View
*/

View File

@@ -74,7 +74,7 @@ export default {
"send_by",
],
requestFunction(data) {
return that.getCases(data);
return that.getCasesViewMore(data);
},
requestFunctionViewMore(data) {
return that.getCasesViewMore(data);
@@ -86,31 +86,6 @@ export default {
},
methods: {
/**
* Get cases for Vue Card View
*/
getCases(data) {
let that = this,
dt,
filters = {};
_.forIn(this.filters, function (item, key) {
filters[item.filterVar] = item.value;
});
return new Promise((resolutionFunc, rejectionFunc) => {
api.cases
.todo(filters)
.then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({
data: dt,
count: response.data.total,
});
})
.catch((e) => {
rejectionFunc(e);
});
});
},
/**
* Get cases for Vue Card View
*/

View File

@@ -73,7 +73,7 @@ export default {
"send_by",
],
requestFunction(data) {
return that.getCases(data);
return that.getCasesViewMore(data);
},
requestFunctionViewMore(data) {
return that.getCasesViewMore(data);
@@ -85,31 +85,6 @@ export default {
},
methods: {
/**
* Get cases for Vue Card View
*/
getCases(data) {
let that = this,
dt,
filters = {};
_.forIn(this.filters, function (item, key) {
filters[item.filterVar] = item.value;
});
return new Promise((resolutionFunc, rejectionFunc) => {
api.cases
.paused(filters)
.then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({
data: dt,
count: response.data.total,
});
})
.catch((e) => {
rejectionFunc(e);
});
});
},
/**
* Get cases for Vue Card View
*/

View File

@@ -73,7 +73,7 @@ export default {
"send_by",
],
requestFunction(data) {
return that.getCases(data);
return that.getCasesViewMore(data);
},
requestFunctionViewMore(data) {
return that.getCasesViewMore(data);
@@ -85,31 +85,6 @@ export default {
},
methods: {
/**
* Get cases for Vue Card View
*/
getCases(data) {
let that = this,
dt,
filters = {};
_.forIn(this.filters, function (item, key) {
filters[item.filterVar] = item.value;
});
return new Promise((resolutionFunc, rejectionFunc) => {
api.cases
.unassigned(filters)
.then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({
data: dt,
count: response.data.total,
});
})
.catch((e) => {
rejectionFunc(e);
});
});
},
/**
* Get cases for Vue Card View
*/

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',
@@ -401,7 +405,8 @@ class CaseList extends Model
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'task_title',
'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) {