Skip to content

Commit

Permalink
Merge pull request #14768 from eileenmcnaughton/export_test
Browse files Browse the repository at this point in the history
[REF] [export] . Move greeting params retrieval to the place in the code where it is used
  • Loading branch information
eileenmcnaughton authored Jul 10, 2019
2 parents 0e42e61 + 5790f42 commit d82acab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
18 changes: 18 additions & 0 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,24 @@ public static function createTempTable($sqlColumns) {
* @param array $exportParams
*/
public static function mergeSameAddress($processor, &$sqlColumns, $exportParams) {
$greetingOptions = CRM_Export_Form_Select::getGreetingOptions();

if (!empty($greetingOptions)) {
// Greeting options is keyed by 'postal_greeting' or 'addressee'.
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];
}
}
}
}
$tableName = $processor->getTemporaryTable();
// check if any records are present based on if they have used shared address feature,
// and not based on if city / state .. matches.
Expand Down
18 changes: 0 additions & 18 deletions CRM/Export/Form/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,6 @@ public function postProcess() {
$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;
Expand Down
16 changes: 0 additions & 16 deletions CRM/Export/Form/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,22 +388,6 @@ public function postProcess() {
// all submitted options or any other argument
$exportParams = $params;

if (!empty($this->_greetingOptions)) {
foreach ($this->_greetingOptions as $key => $value) {
if ($option = CRM_Utils_Array::value($key, $exportParams)) {
if ($this->_greetingOptions[$key][$option] == ts('Other')) {
$exportParams[$key] = $exportParams["{$key}_other"];
}
elseif ($this->_greetingOptions[$key][$option] == ts('List of names')) {
$exportParams[$key] = '';
}
else {
$exportParams[$key] = $this->_greetingOptions[$key][$option];
}
}
}
}

$mappingId = CRM_Utils_Array::value('mapping', $params);
if ($mappingId) {
$this->set('mappingId', $mappingId);
Expand Down

0 comments on commit d82acab

Please sign in to comment.