Skip to content
Snippets Groups Projects
Commit 4d98dbb0 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix regression in function isXtraFormActive

parent 4fb363a5
No related branches found
No related tags found
1 merge request!611REDMINE_ISSUE-17999 | Regression : l'affichage des champs conditionnels ne marche plus à la création d'un signalement
......@@ -130,11 +130,13 @@ export function findCurrentValue(feature, customField) {
export function isXtraFormActive(extraForms, config) { // return true if no config or if the condition is fullfilled
if (config) { // if conditional field configuration is not null
// get name and value in condition
const [conditionFieldName, conditionFieldValue] = Object.entries(config)[0];
// get the customForm which activates conditional field
const conditioningXForm = extraForms.find((xForm) => xForm.name === config.conditionField);
const conditioningXForm = extraForms.find((xForm) => xForm.name === conditionFieldName);
// check if its value match the condition value
if (conditioningXForm) { // use JSON.stringify() to compare arrays (works with other field type too)
return JSON.stringify(conditioningXForm.value) === JSON.stringify(config.conditionValue);
return JSON.stringify(conditioningXForm.value) === JSON.stringify(conditionFieldValue);
}
}
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment