From 0d9d522e80c8803e8ed1ab6aa4b979d4ab7175ea Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 18 Jul 2023 15:04:55 +1200 Subject: [PATCH] Fix js error on CiviImport when csv has additional fields --- ext/civiimport/ang/crmCiviimport.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/civiimport/ang/crmCiviimport.js b/ext/civiimport/ang/crmCiviimport.js index dd4280aaaf..dc1b945b06 100644 --- a/ext/civiimport/ang/crmCiviimport.js +++ b/ext/civiimport/ang/crmCiviimport.js @@ -79,8 +79,12 @@ } var fieldDefault = null; - if (Boolean(importMappings)) { + if (Boolean(importMappings) && importMappings.hasOwnProperty(index)) { // If this form has already been used for the job, load from what it saved. + // Note we also checked the importMapping was defined. This would be FALSE + // if a csv is being imported with more fields than the are in the original + // mapping. We check for that so it will skip gracefully. + // (The user will see a warning.) fieldName = importMappings[index].name; fieldDefault = importMappings[index].default_value; } -- 2.25.1