From a41eae8b5c7c2fb0dbbb16f06c6700add2342408 Mon Sep 17 00:00:00 2001 From: Enrique Martin Date: Tue, 13 Feb 2024 20:13:58 +0100 Subject: [PATCH] Fixed several items import and export --- pandora_console/include/class/Prd.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/class/Prd.class.php b/pandora_console/include/class/Prd.class.php index 93829be5d4..4b065eb049 100644 --- a/pandora_console/include/class/Prd.class.php +++ b/pandora_console/include/class/Prd.class.php @@ -2213,12 +2213,16 @@ class Prd $value_arr = explode($csv_separator, $value); $ref_arr = []; foreach ($value_arr as $val) { - $ref_arr[] = $this->searchValue( + $ref_val = $this->searchValue( $ref['columns'], $ref['table'], $ref['id'], $val ); + if (is_array($ref_val) === true) { + $ref_val = json_encode($ref_val); + } + $ref_arr[] = $ref_val; } $value = implode($csv_separator, $ref_arr); @@ -2332,12 +2336,16 @@ class Prd $value_arr = explode($csv_separator, $value); $ref_arr = []; foreach ($value_arr as $val) { - $ref_arr[] = $this->searchValue( + $ref_val = $this->searchValue( $ref['columns'], $ref['table'], $ref['id'], $val ); + if (is_array($ref_val) === true) { + $ref_val = json_encode($ref_val); + } + $ref_arr[] = $ref_val; } $value = implode($csv_separator, $ref_arr); @@ -2872,7 +2880,7 @@ class Prd $json_value ) === true ) { - $this->updateJsonArrayValue($array_value, $json_key, json_decode($json_value, true)); + $this->updateJsonArrayValue($array_value, $json_key, $json_value); } else { $create_item = false; break;