From bbd661dae4a974048b49400eb4f843e545dfb2f5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 1 Nov 2022 13:25:02 +1300 Subject: [PATCH] Import regression, fix loading of saved mapping with soft-credit email mapped --- CRM/Contribute/Import/Form/MapField.php | 3 ++- CRM/Import/Forms.php | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CRM/Contribute/Import/Form/MapField.php b/CRM/Contribute/Import/Form/MapField.php index 7f96270c5a..abc42a05b2 100644 --- a/CRM/Contribute/Import/Form/MapField.php +++ b/CRM/Contribute/Import/Form/MapField.php @@ -221,7 +221,8 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { if (!empty($entityData)) { $softCreditTypeID = (int) $entityData['soft_credit']['soft_credit_type_id']; } - $defaults["mapper[$i]"] = [$fieldMapping['name'], $softCreditTypeID]; + $fieldName = $this->isQuickFormMode ? str_replace('.', '__', $fieldMapping['name']) : $fieldMapping['name']; + $defaults["mapper[$i]"] = [$fieldName, $softCreditTypeID]; } } } diff --git a/CRM/Import/Forms.php b/CRM/Import/Forms.php index 485195c5c1..0e59a70507 100644 --- a/CRM/Import/Forms.php +++ b/CRM/Import/Forms.php @@ -68,6 +68,16 @@ class CRM_Import_Forms extends CRM_Core_Form { */ protected $parser; + /** + * Is the code being accessed in QuickForm mode. + * + * If false, ie functions being called to support the angular form, then we + * 'quick-form-ify' the fields with dots over to double underscores. + * + * @var bool + */ + protected $isQuickFormMode = TRUE; + /** * Get User Job. * @@ -771,6 +781,7 @@ class CRM_Import_Forms extends CRM_Core_Form { $contactTypes[] = ['id' => $contactType['name'], 'text' => $contactType['label']]; } $parser = $this->getParser(); + $this->isQuickFormMode = FALSE; Civi::resources()->addVars('crmImportUi', [ 'defaults' => $this->getDefaults(), 'rows' => $this->getDataRows([], 2), -- 2.25.1