Fixed JSON values import and export for dashboards

This commit is contained in:
Enrique Martin 2024-02-13 15:15:10 +01:00
parent c7d61902fb
commit 23bd170ff0
1 changed files with 36 additions and 28 deletions

View File

@ -2155,6 +2155,7 @@ class Prd
$ref['id'],
$val
);
if ($ref_val !== false) {
if (isset($ref['values_as_keys']) === true
&& $ref['values_as_keys'] === true
) {
@ -2163,6 +2164,7 @@ class Prd
$ref_arr[] = $ref_val;
}
}
}
$value = $ref_arr;
}
@ -2269,6 +2271,7 @@ class Prd
$ref['id'],
$val
);
if ($ref_val !== false) {
if (isset($ref['values_as_keys']) === true
&& $ref['values_as_keys'] === true
) {
@ -2277,6 +2280,7 @@ class Prd
$ref_arr[] = $ref_val;
}
}
}
$value = $ref_arr;
}
@ -2358,20 +2362,22 @@ class Prd
is_array($val) ? json_encode($val) : $val
);
if ($ref_val === false && $ref_val != $val) {
if ($this->evalAutocreateItem($condition['ref'], $val, $column) === false) {
if ($ref_val === false && $ref_val != is_array($val) ? json_encode($val) : $val) {
if ($this->evalAutocreateItem($condition['ref'], is_array($val) ? json_encode($val) : $val, $column) === false) {
return false;
}
}
if (isset($condition['ref']['values_as_keys']) === true
&& $condition['ref']['values_as_keys'] === true
if ($ref_val !== false) {
if (isset($ref['values_as_keys']) === true
&& $ref['values_as_keys'] === true
) {
$ref_arr[$ref_val] = $ref_val;
} else {
$ref_arr[] = $ref_val;
}
}
}
$value = $ref_arr;
}
@ -2445,12 +2451,13 @@ class Prd
is_array($val) ? json_encode($val) : $val
);
if ($ref_val === false && $ref_val != $val) {
if ($this->evalAutocreateItem($ref, $val, $column) === false) {
if ($ref_val === false && $ref_val != is_array($val) ? json_encode($val) : $val) {
if ($this->evalAutocreateItem($ref, is_array($val) ? json_encode($val) : $val, $column) === false) {
return false;
}
}
if ($ref_val !== false) {
if (isset($ref['values_as_keys']) === true
&& $ref['values_as_keys'] === true
) {
@ -2459,6 +2466,7 @@ class Prd
$ref_arr[] = $ref_val;
}
}
}
$value = json_encode($ref_arr);
}