From f5adbf798365022c225f2ca706f5d0677c85dd47 Mon Sep 17 00:00:00 2001 From: Faustin Date: Sun, 11 Sep 2022 22:57:00 +0200 Subject: [PATCH] scrutinizer on core/modules/import/import_xlsx.modules.php : array $where not always defined --- htdocs/core/modules/import/import_xlsx.modules.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 6d7c5bf82fd..6b2c02de197 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -876,11 +876,12 @@ class ImportXlsx extends ModeleImports if (!empty($updatekeys)) { // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) + $where = array(); + if (empty($lastinsertid)) { // No insert done yet for a parent table $sqlSelect = "SELECT ".$fname." FROM " . $tablename; $data = array_combine($listfields, $listvalues); - $where = array(); $filters = array(); foreach ($updatekeys as $key) { $col = $objimport->array_import_updatekeys[0][$key]; @@ -929,6 +930,7 @@ class ImportXlsx extends ModeleImports // Note: For extrafield tablename, we have in importfieldshidden_array an enty 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object' $sqlSelect = "SELECT rowid FROM " . $tablename; + if (empty($keyfield)) { $keyfield = 'rowid'; }