From d41908e52a5263a893572ab577a45baa86ada2ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Mar 2018 17:46:50 +0200 Subject: [PATCH] Update import_xlsx.modules.php --- htdocs/core/modules/import/import_xlsx.modules.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 18cf7c767ac..80436abacd5 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -651,6 +651,9 @@ class ImportXlsx extends ModeleImports } } else { // We have a last INSERT ID. Check if we have a row referencing this foreign key. + // This is required when updating table with some extrafields. When inserting a record in parent table, we can make + // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record + // may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid. $sqlSelect = 'SELECT rowid FROM '.$tablename; if(empty($keyfield)) $keyfield = 'rowid';