From ee769c0004d01b5ef8b5f2d18b40726a678d6e8c Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 16 Jul 2019 09:43:42 +1200 Subject: [PATCH] dev/core#1120 remove multiple export handling --- CRM/Export/BAO/ExportProcessor.php | 23 +++++------------------ CRM/Export/Form/Select.php | 4 ++-- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index e1b87117d2..076804b051 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -1889,12 +1889,11 @@ class CRM_Export_BAO_ExportProcessor { * Build array for merging same addresses. * * @param $sql - * @param array $exportParams * @param bool $sharedAddress * * @return array */ - public function buildMasterCopyArray($sql, $exportParams, $sharedAddress = FALSE) { + public function buildMasterCopyArray($sql, $sharedAddress = FALSE) { $addresseeOptions = CRM_Core_OptionGroup::values('addressee'); $postalOptions = CRM_Core_OptionGroup::values('postal_greeting'); @@ -1953,13 +1952,7 @@ class CRM_Export_BAO_ExportProcessor { if (!$sharedAddress && !array_key_exists($copyID, $merge[$masterID]['copy'])) { - if (!empty($exportParams['postal_greeting_other']) && - count($merge[$masterID]['copy']) >= 1 - ) { - // use static greetings specified if no of contacts > 2 - $merge[$masterID]['postalGreeting'] = $exportParams['postal_greeting_other']; - } - elseif ($copyPostalGreeting) { + if ($copyPostalGreeting) { $this->trimNonTokensFromAddressString($copyPostalGreeting, $postalOptions[$dao->copy_postal_greeting_id], $this->getPostalGreetingTemplate() @@ -1969,13 +1962,7 @@ class CRM_Export_BAO_ExportProcessor { $merge[$masterID]['postalGreeting'] = str_replace(" {$copyPostalGreeting},", "", $merge[$masterID]['postalGreeting']); } - if (!empty($exportParams['addressee_other']) && - count($merge[$masterID]['copy']) >= 1 - ) { - // use static greetings specified if no of contacts > 2 - $merge[$masterID]['addressee'] = $exportParams['addressee_other']; - } - elseif ($copyAddressee) { + if ($copyAddressee) { $this->trimNonTokensFromAddressString($copyAddressee, $addresseeOptions[$dao->copy_addressee_id], $this->getAddresseeGreetingTemplate() @@ -2041,7 +2028,7 @@ FROM $tableName r1 INNER JOIN civicrm_address adr ON r1.master_id = adr.id INNER JOIN $tableName r2 ON adr.contact_id = r2.civicrm_primary_id ORDER BY r1.id"; - $linkedMerge = $this->buildMasterCopyArray($sql, $exportParams, TRUE); + $linkedMerge = $this->buildMasterCopyArray($sql, TRUE); // find all the records that have the same street address BUT not in a household // require match on city and state as well @@ -2068,7 +2055,7 @@ AND ( r1.street_address != '' ) AND r2.id > r1.id ORDER BY r1.id "; - $merge = $this->buildMasterCopyArray($sql, $exportParams); + $merge = $this->buildMasterCopyArray($sql); // unset ids from $merge already present in $linkedMerge foreach ($linkedMerge as $masterID => $values) { diff --git a/CRM/Export/Form/Select.php b/CRM/Export/Form/Select.php index c2a97d0acb..182e4fdba8 100644 --- a/CRM/Export/Form/Select.php +++ b/CRM/Export/Form/Select.php @@ -291,7 +291,7 @@ FROM {$this->_componentTable} $this->_greetingOptions = self::getGreetingOptions(); foreach ($this->_greetingOptions as $key => $value) { - $fieldLabel = ts('%1 (merging > 2 contacts)', [1 => ucwords(str_replace('_', ' ', $key))]); + $fieldLabel = ts('%1 (when merging contacts)', [1 => ucwords(str_replace('_', ' ', $key))]); $this->addElement('select', $key, $fieldLabel, $value, ['onchange' => "showOther(this);"] ); @@ -361,7 +361,7 @@ FROM {$this->_componentTable} if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && empty($params[$value])) { $label = ucwords(str_replace('_', ' ', $key)); - $errors[$value] = ts('Please enter a value for %1 (merging > 2 contacts), or select a pre-configured option from the list.', [1 => $label]); + $errors[$value] = ts('Please enter a value for %1 (when merging contacts), or select a pre-configured option from the list.', [1 => $label]); } } } -- 2.25.1