From eac832c5c5c4569ab468f852db42e2bda4124e36 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 2 Apr 2015 21:31:27 -0400 Subject: [PATCH] CRM-16164 - Fix adding fields when reusing saved mapping --- CRM/Export/Form/Map.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CRM/Export/Form/Map.php b/CRM/Export/Form/Map.php index cc26bfbd60..4697e72954 100644 --- a/CRM/Export/Form/Map.php +++ b/CRM/Export/Form/Map.php @@ -66,14 +66,22 @@ class CRM_Export_Form_Map extends CRM_Core_Form { */ public function preProcess() { $this->_exportColumnCount = $this->get('exportColumnCount'); + $this->_mappingId = $this->get('mappingId'); + if (!$this->_exportColumnCount) { - $this->_exportColumnCount = 10; + // Set default from saved mapping + if ($this->_mappingId) { + $mapping = new CRM_Core_DAO_MappingField(); + $mapping->mapping_id = $this->_mappingId; + $this->_exportColumnCount = $mapping->count(); + } + else { + $this->_exportColumnCount = 10; + } } else { - $this->_exportColumnCount = $this->_exportColumnCount + 10; + $this->_exportColumnCount += 10; } - - $this->_mappingId = $this->get('mappingId'); } public function buildQuickForm() { -- 2.25.1