+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
* $Id$
*
*/
$this->get('exportMode')
);
- $this->addButtons(array(
- array(
- 'type' => 'back',
- 'name' => ts('Previous'),
- ),
- array(
- 'type' => 'next',
- 'name' => ts('Export'),
- 'spacing' => ' ',
- ),
- array(
- 'type' => 'done',
- 'icon' => 'fa-times',
- 'name' => ts('Done'),
- ),
- )
- );
+ $this->addButtons([
+ [
+ 'type' => 'back',
+ 'name' => ts('Previous'),
+ ],
+ [
+ 'type' => 'next',
+ 'name' => ts('Export'),
+ 'spacing' => ' ',
+ ],
+ [
+ 'type' => 'done',
+ 'icon' => 'fa-times',
+ 'name' => ts('Done'),
+ ],
+ ]);
}
/**
* list of errors to be posted back to the form
*/
public static function formRule($fields, $values, $mappingTypeId) {
- $errors = array();
+ $errors = [];
if (!empty($fields['saveMapping']) && !empty($fields['_qf_Map_next'])) {
$nameField = CRM_Utils_Array::value('saveMappingName', $fields);
$params = $this->controller->exportValues($this->_name);
$exportParams = $this->controller->exportValues('Select');
- $greetingOptions = CRM_Export_Form_Select::getGreetingOptions();
-
- if (!empty($greetingOptions)) {
- foreach ($greetingOptions as $key => $value) {
- if ($option = CRM_Utils_Array::value($key, $exportParams)) {
- if ($greetingOptions[$key][$option] == ts('Other')) {
- $exportParams[$key] = $exportParams["{$key}_other"];
- }
- elseif ($greetingOptions[$key][$option] == ts('List of names')) {
- $exportParams[$key] = '';
- }
- else {
- $exportParams[$key] = $greetingOptions[$key][$option];
- }
- }
- }
- }
-
$currentPath = CRM_Utils_System::currentPath();
$urlParams = NULL;
$mapperKeys = $params['mapper'][1];
- $checkEmpty = 0;
- foreach ($mapperKeys as $value) {
- if ($value[0]) {
- $checkEmpty++;
+ $mappedFields = [];
+ foreach ((array) $mapperKeys as $field) {
+ if (!empty($field[1])) {
+ $mappedFields[] = CRM_Core_BAO_Mapping::getMappingParams([], $field);
}
}
- if (!$checkEmpty) {
+ if (!$mappedFields) {
$this->set('mappingId', NULL);
CRM_Utils_System::redirect(CRM_Utils_System::url($currentPath, '_qf_Map_display=true' . $urlParams));
}
}
if (!empty($params['saveMapping'])) {
- $mappingParams = array(
+ $mappingParams = [
'name' => $params['saveMappingName'],
'description' => $params['saveMappingDesc'],
'mapping_type_id' => $this->get('mappingTypeId'),
- );
+ ];
$saveMapping = CRM_Core_BAO_Mapping::add($mappingParams);
$this->get('componentIds'),
(array) $this->get('queryParams'),
$this->get(CRM_Utils_Sort::SORT_ORDER),
- $mapperKeys,
+ $mappedFields,
$this->get('returnProperties'),
$this->get('exportMode'),
$this->get('componentClause'),