* Set variables up before form is built.
*/
public function preProcess() {
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
-
+ parent::preProcess();
// Get the data from the session.
$dataValues = $this->get('dataValues');
$mapper = $this->get('mapper');
}
$this->assign('savedMappingName', $mappingId ? $mapDAO->name : NULL);
- if ($skipColumnHeader) {
- $this->assign('skipColumnHeader', $skipColumnHeader);
- $this->assign('rowDisplayCount', 3);
- }
- else {
- $this->assign('rowDisplayCount', 2);
- }
-
if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Activity_Import_Parser';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
public function postProcess() {
$fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
}
$parser->run($fileName, $separator,
$mapperFields,
- $skipColumnHeader,
+ $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_IMPORT,
$onDuplicate,
$this->get('statusID'),
$showColNames = TRUE;
if ('CRM_Import_DataSource_CSV' == $this->get('dataSource') &&
- !$this->get('skipColumnHeader')
+ !$this->getSubmittedValue('skipColumnHeader')
) {
$showColNames = FALSE;
}
* Set variables up before form is built.
*/
public function preProcess() {
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
-
+ parent::preProcess();
//get the data from the session
$dataValues = $this->get('dataValues');
$mapper = $this->get('mapper');
}
$this->assign('savedMappingName', $mappingId ? $mapDAO->name : NULL);
- if ($skipColumnHeader) {
- $this->assign('skipColumnHeader', $skipColumnHeader);
- $this->assign('rowDisplayCount', 3);
- }
- else {
- $this->assign('rowDisplayCount', 2);
- }
-
if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
public function postProcess() {
$fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
}
$parser->run($fileName, $separator,
$mapperFields,
- $skipColumnHeader,
+ $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_IMPORT,
$this->get('contactType'),
$onDuplicate,
* @return void
*/
public function preProcess() {
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
-
+ parent::preProcess();
//get the data from the session
$dataValues = $this->get('dataValues');
$mapper = $this->get('mapper');
}
$this->assign('savedMappingName', $mappingId ? $mapDAO->name : NULL);
- if ($skipColumnHeader) {
- $this->assign('skipColumnHeader', $skipColumnHeader);
- $this->assign('rowDisplayCount', 3);
- }
- else {
- $this->assign('rowDisplayCount', 2);
- }
-
if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . $this->_importParserUrl;
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
public function postProcess() {
$fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
}
$parser->run($fileName, $separator,
$mapperFields,
- $skipColumnHeader,
+ $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_IMPORT,
$this->get('contactType'),
$onDuplicate
* @return void
*/
public function preProcess() {
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
+ parent::preProcess();
//get the data from the session
$dataValues = $this->get('dataValues');
}
$this->assign('savedMappingName', $mappingId ? $mapDAO->name : NULL);
- if ($skipColumnHeader) {
- $this->assign('skipColumnHeader', $skipColumnHeader);
- $this->assign('rowDisplayCount', 3);
- }
- else {
- $this->assign('rowDisplayCount', 2);
- }
-
if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Event_Import_Parser';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
public function postProcess() {
$fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
}
$parser->run($fileName, $separator,
$mapperFields,
- $skipColumnHeader,
+ $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_IMPORT,
$this->get('contactType'),
$onDuplicate
* TODO: CRM-11254 - if preProcess and postProcess functions can be reconciled between the 5 child classes,
* those classes can be removed entirely and this class will not need to be abstract
*/
-abstract class CRM_Import_Form_Preview extends CRM_Core_Form {
+abstract class CRM_Import_Form_Preview extends CRM_Import_Forms {
/**
* Return a descriptive name for the page, used in wizard header.
return ts('Preview');
}
+ /**
+ * Assign common values to the template.
+ */
+ public function preProcess() {
+ $this->assign('skipColumnHeader', $this->getSubmittedValue('skipColumnHeader'));
+ $this->assign('rowDisplayCount', $this->getSubmittedValue('skipColumnHeader') ? 3 : 2);
+ }
+
/**
* Build the form object.
*/
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+/**
+ * This class helps the forms within the import flow access submitted & parsed values.
+ */
+class CRM_Import_Forms extends CRM_Core_Form {
+
+ /**
+ * Get the submitted value, accessing it from whatever form in the flow it is submitted on.
+ * @param string $fieldName
+ *
+ * @return mixed|null
+ */
+ public function getSubmittedValue(string $fieldName) {
+ $mappedValues = [
+ 'skipColumnHeader' => 'DataSource',
+ ];
+ if (array_key_exists($fieldName, $mappedValues)) {
+ return $this->controller->exportValue($mappedValues[$fieldName], $fieldName);
+ }
+ return parent::getSubmittedValue($fieldName);
+
+ }
+
+}
* @return void
*/
public function preProcess() {
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
-
+ parent::preProcess();
//get the data from the session
$dataValues = $this->get('dataValues');
$mapper = $this->get('mapper');
}
$this->assign('savedMappingName', $mappingId ? $mapDAO->name : NULL);
- if ($skipColumnHeader) {
- $this->assign('skipColumnHeader', $skipColumnHeader);
- $this->assign('rowDisplayCount', 3);
- }
- else {
- $this->assign('rowDisplayCount', 2);
- }
-
if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Member_Import_Parser_Membership';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
public function postProcess() {
$fileName = $this->controller->exportValue('DataSource', 'uploadFile');
$separator = $this->controller->exportValue('DataSource', 'fieldSeparator');
- $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
}
$parser->run($fileName, $separator,
$mapperFields,
- $skipColumnHeader,
+ $this->getSubmittedValue('skipColumnHeader'),
CRM_Import_Parser::MODE_IMPORT,
$this->get('contactType'),
$onDuplicate,