From 79a0b781166e155f64654bfb430fff13c1a3879f Mon Sep 17 00:00:00 2001 From: Jyhere Date: Mon, 27 Mar 2023 15:49:19 +0200 Subject: [PATCH 1/2] Fix array of field names passed to class/method when using a field with compute rule --- htdocs/core/modules/import/import_csv.modules.php | 4 ++-- htdocs/core/modules/import/import_xlsx.modules.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 1213cc4cf16..199baf1e1c7 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -649,7 +649,7 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, ($key - 1))); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1))); $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); @@ -809,7 +809,7 @@ class ImportCsv extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, ($key - 1))); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1))); $fieldArr = explode('.', $fieldname); if (count($fieldArr) > 0) { $fieldname = $fieldArr[1]; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index c7f6df31d03..949c6bd9258 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -694,7 +694,7 @@ class ImportXlsx extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, $key)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key)); $newval = $res; // We get new value computed. } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); @@ -853,7 +853,7 @@ class ImportXlsx extends ModeleImports break; } $classinstance = new $class($this->db); - $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, $key)); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key)); $fieldArr = explode('.', $fieldname); if (count($fieldArr) > 0) { $fieldname = $fieldArr[1]; From ac81fa925b36d461906525eb80c7a7b9d51687dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Mar 2023 09:54:50 +0200 Subject: [PATCH 2/2] add since info --- htdocs/core/lib/functions.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2bba488f51b..51cc78b0ca2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11403,6 +11403,7 @@ function isAFileWithExecutableContent($filename) * Return the value of token currently saved into session with name 'newtoken'. * This token must be send by any POST as it will be used by next page for comparison with value in session. * + * @since Dolibarr v10.0.7 * @return string */ function newToken() @@ -11414,6 +11415,7 @@ function newToken() * Return the value of token currently saved into session with name 'token'. * For ajax call, you must use this token as a parameter of the call into the js calling script (the called ajax php page must also set constant NOTOKENRENEWAL). * + * @since Dolibarr v10.0.7 * @return string */ function currentToken()