--HR-235 Modification for showing column header label on Map field page
authorNileema <nileema@nileema.(none)>
Tue, 4 Feb 2014 06:19:56 +0000 (11:49 +0530)
committerNileema <nileema@nileema.(none)>
Tue, 4 Feb 2014 06:19:56 +0000 (11:49 +0530)
CRM/Custom/Import/Form/MapField.php

index 10d8a0c9d1b0786c5289fe700fe87de7d4ed4ab1..d3adaab7c3a0fda130db8d28c2c682984b45646e 100644 (file)
@@ -15,27 +15,27 @@ class CRM_Custom_Import_Form_MapField extends CRM_Contact_Import_Form_MapField {
    * @access public
    */
   public function preProcess() {
+    $dataSource = $this->get('dataSource');
     $this->_mapperFields = $this->get('fields');
-    asort($this->_mapperFields);
     $this->_columnCount = $this->get('columnCount');
     $this->_columnCount = $this->get('columnCount');
     $this->assign('columnCount', $this->_columnCount);
     $this->_dataValues = $this->get('dataValues');
-    $this->assign('dataValues', $this->_dataValues);
+    //Seperate column names from actual values.
+    $columnNames = $this->_dataValues[0];
+    //actual values need to be in 2d array ($array[$i][$j]) format to be parsed by the template.
+    $dataValues[] = $this->_dataValues[1];
+    $this->assign('dataValues', $dataValues);
     $this->_entity = $this->_multipleCustomData = $this->get('multipleCustomData');
-
-    $skipColumnHeader   = $this->controller->exportValue('DataSource', 'skipColumnHeader');
+    $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
     $this->_onDuplicate = $this->get('onDuplicate');
     if ($skipColumnHeader) {
-      $this->assign('skipColumnHeader', $skipColumnHeader);
-      $this->assign('rowDisplayCount', 3);
+      //showColNames needs to be true to show "Column Names" column
+      $this->assign('showColNames', $skipColumnHeader);
       /* if we had a column header to skip, stash it for later */
-
-      $this->_columnHeaders = $this->_dataValues[0];
-    }
-    else {
-      $this->assign('rowDisplayCount', 2);
+      $this->assign('columnNames', $columnNames);
     }
+    $this->assign('rowDisplayCount', 2);
     $this->assign('highlightedFields', $this->_highlightedFields);
   }