From: Coleman Watts Date: Fri, 3 Apr 2015 01:31:27 +0000 (-0400) Subject: CRM-16164 - Fix adding fields when reusing saved mapping X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=eac832c5c5c4569ab468f852db42e2bda4124e36;p=civicrm-core.git CRM-16164 - Fix adding fields when reusing saved mapping --- 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() {