From ccc3ac8afa6531c5a93d52c901582ce27ec27b60 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 9 Jul 2019 09:35:32 +1200 Subject: [PATCH] Move function onto the processor class I went to extract the function that determines fields off to be a funciton on the processor class but moving this first simplifies it --- CRM/Export/BAO/Export.php | 38 +----------------------------- CRM/Export/BAO/ExportProcessor.php | 34 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 207fea2218..1320d24f61 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -41,42 +41,6 @@ class CRM_Export_BAO_Export { // CRM-7675 const EXPORT_ROW_COUNT = 100000; - /** - * Get default return property for export based on mode - * - * @param int $exportMode - * Export mode. - * - * @return string - * Default Return property - */ - public static function defaultReturnProperty($exportMode) { - // hack to add default return property based on export mode - $property = NULL; - if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) { - $property = 'contribution_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) { - $property = 'participant_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) { - $property = 'membership_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) { - $property = 'pledge_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) { - $property = 'case_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::GRANT_EXPORT) { - $property = 'grant_id'; - } - elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) { - $property = 'activity_id'; - } - return $property; - } - /** * Get Export component * @@ -251,7 +215,7 @@ class CRM_Export_BAO_Export { } } } - $defaultExportMode = self::defaultReturnProperty($exportMode); + $defaultExportMode = $processor->defaultReturnProperty(); if ($defaultExportMode) { $returnProperties[$defaultExportMode] = 1; } diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 8034f215a2..e83faf4673 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -1405,4 +1405,38 @@ class CRM_Export_BAO_ExportProcessor { return in_array($contactID, $this->householdsToSkip); } + /** + * Get default return property for export based on mode + * + * @return string + * Default Return property + */ + public function defaultReturnProperty() { + // hack to add default return property based on export mode + $property = NULL; + $exportMode = $this->getExportMode(); + if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) { + $property = 'contribution_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) { + $property = 'participant_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) { + $property = 'membership_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) { + $property = 'pledge_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) { + $property = 'case_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::GRANT_EXPORT) { + $property = 'grant_id'; + } + elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) { + $property = 'activity_id'; + } + return $property; + } + } -- 2.25.1