Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export class cleanup - remove some unnecessary code #13120

Merged
merged 1 commit into from
Nov 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 1 addition & 16 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 @@ -1339,11 +1332,6 @@ public function getPledgeReturnProperties() {
*/
public function getMembershipReturnProperties() {
return [
'location_type' => 1,
'im_provider' => 1,
'phone_type_id' => 1,
'provider_id' => 1,
'current_employer' => 1,
'contact_type' => 1,
'contact_sub_type' => 1,
'sort_name' => 1,
Expand Down Expand Up @@ -1975,7 +1963,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 +2260,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 +2443,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