Skip to content

Commit

Permalink
Remove provider_id & duplicate key additions from export 'primary' (A…
Browse files Browse the repository at this point in the history
…KA all) fields

In testing all these fields except for provider_id are already in the primary field.

Provider ID is a psynonym for im_provider. Possibly it is the better name choice
but it has a lot of hacks associated with it that can go by removing it

Change-Id: I3bd1491d05b98b9aeb90b633b5f9fbceffb00c8b
  • Loading branch information
eileenmcnaughton committed Nov 17, 2018
1 parent 36c5896 commit e3cec82
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
9 changes: 0 additions & 9 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,6 @@ public static function setHeaderRows($field, $headerRows, $processor) {
elseif (isset($queryFields[$field]['title'])) {
$headerRows[] = $queryFields[$field]['title'];
}
elseif ($field == 'provider_id') {
// @todo - set this correctly in the xml rather than here.
$headerRows[] = ts('IM Service Provider');
}
elseif ($processor->isExportPaymentFields() && array_key_exists($field, $processor->getcomponentPaymentFields())) {
$headerRows[] = CRM_Utils_Array::value($field, $processor->getcomponentPaymentFields());
}
Expand Down Expand Up @@ -1403,11 +1399,6 @@ public static function getExportStructureArrays($returnProperties, $processor) {
$headerRows[] = $headerName;
self::sqlColumnDefn($processor, $sqlColumns, $headerName);
}
elseif ($relationField == 'provider_id') {
$headerName = $field . '-' . 'Im Service Provider';
$headerRows[] = $headerName;
self::sqlColumnDefn($processor, $sqlColumns, $headerName);
}
elseif ($relationField == 'state_province_id') {
$headerName = $field . '-' . 'state_province_id';
$headerRows[] = $headerName;
Expand Down
10 changes: 1 addition & 9 deletions CRM/Export/BAO/ExportProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,6 @@ public function runQuery($params, $order, $returnProperties) {
* Array of fields to return in the format ['field_name' => 1,...]
*/
public function getAdditionalReturnProperties() {

$missing = [
'location_type',
'im_provider',
'phone_type_id',
'provider_id',
'current_employer',
];
if ($this->getQueryMode() === CRM_Contact_BAO_Query::MODE_CONTACTS) {
$componentSpecificFields = [];
}
Expand All @@ -446,7 +438,7 @@ public function getAdditionalReturnProperties() {
$componentSpecificFields = array_merge($componentSpecificFields, CRM_Contribute_BAO_Query::softCreditReturnProperties(TRUE));
unset($componentSpecificFields['contribution_status_id']);
}
return array_merge(array_fill_keys($missing, 1), $componentSpecificFields);
return $componentSpecificFields;
}

/**
Expand Down
13 changes: 1 addition & 12 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1182,13 +1182,7 @@ public function allFieldsDataProvider() {
* Get return properties manually added in.
*/
public function getExtraReturnProperties() {
return [
'location_type' => 1,
'im_provider' => 1,
'phone_type_id' => 1,
'provider_id' => 1,
'current_employer' => 1,
];
return [];
}

/**
Expand Down Expand Up @@ -1284,7 +1278,6 @@ protected function getBasicReturnProperties($isContactMode) {
'tags' => 1,
'notes' => 1,
'phone_type_id' => 1,
'provider_id' => 1,
];
if (!$isContactMode) {
unset($returnProperties['groups']);
Expand Down Expand Up @@ -1342,7 +1335,6 @@ public function getMembershipReturnProperties() {
'location_type' => 1,
'im_provider' => 1,
'phone_type_id' => 1,
'provider_id' => 1,
'current_employer' => 1,
'contact_type' => 1,
'contact_sub_type' => 1,
Expand Down Expand Up @@ -1975,7 +1967,6 @@ protected function getBasicHeaderDefinition($isContactExport) {
80 => 'Group(s)',
81 => 'Tag(s)',
82 => 'Note(s)',
83 => 'IM Service Provider',
];
if (!$isContactExport) {
unset($headers[80]);
Expand Down Expand Up @@ -2273,7 +2264,6 @@ protected function getBasicSqlColumnDefinition($isContactExport) {
'groups' => 'groups text',
'tags' => 'tags text',
'notes' => 'notes text',
'provider_id' => 'provider_id varchar(255)',
];
if (!$isContactExport) {
unset($columns['groups']);
Expand Down Expand Up @@ -2457,7 +2447,6 @@ public function getContributionSqlColumns() {
'world_region' => 'world_region varchar(128)',
'url' => 'url varchar(128)',
'phone_type_id' => 'phone_type_id varchar(16)',
'provider_id' => 'provider_id varchar(255)',
'financial_type' => 'financial_type varchar(64)',
'contribution_source' => 'contribution_source varchar(255)',
'receive_date' => 'receive_date varchar(32)',
Expand Down

0 comments on commit e3cec82

Please sign in to comment.