Fix icon for export done button
[civicrm-core.git] / CRM / Export / Form / Map.php
index db9160fa2ea768a2f9ff37a1fbcbf570a57b0a8a..76a1310a00d58d7ec60c5c0aacf985908f4f76f1 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -60,20 +60,28 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
   protected $_mappingId;
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    * @return void
    */
   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() {
@@ -88,15 +96,16 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
     $this->addButtons(array(
         array(
           'type' => 'back',
-          'name' => ts('<< Previous'),
+          'name' => ts('Previous'),
         ),
         array(
           'type' => 'next',
-          'name' => ts('Export >>'),
+          'name' => ts('Export'),
           'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
         ),
         array(
           'type' => 'done',
+          'icon' => 'close',
           'name' => ts('Done'),
         ),
       )
@@ -104,15 +113,16 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
   }
 
   /**
-   * Global validation rules for the form
+   * Global validation rules for the form.
    *
-   * @param array $fields posted values of the form
+   * @param array $fields
+   *   Posted values of the form.
    *
    * @param $values
    * @param int $mappingTypeId
    *
-   * @return array list of errors to be posted back to the form
-   * @static
+   * @return array
+   *   list of errors to be posted back to the form
    */
   public static function formRule($fields, $values, $mappingTypeId) {
     $errors = array();
@@ -142,7 +152,7 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
   }
 
   /**
-   * Process the uploaded file
+   * Process the uploaded file.
    *
    * @return void
    */
@@ -248,4 +258,5 @@ class CRM_Export_Form_Map extends CRM_Core_Form {
   public function getTitle() {
     return ts('Select Fields to Export');
   }
+
 }