diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 3e8b324a360b..29ea4dcf5f70 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -440,6 +440,7 @@ public static function buildMappingForm(&$form, $mappingType, $mappingId, $colum if (CRM_Core_Permission::access('CiviEvent')) { $fields['Participant'] = CRM_Event_BAO_Participant::exportableFields(); //get the component payment fields + // @todo - review this - inconsistent with other entities & hacky. if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) { $componentPaymentFields = array(); foreach (CRM_Export_BAO_Export::componentPaymentFields() as $payField => $payTitle) { diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php index 00214262afd4..198c0a8342cd 100644 --- a/CRM/Export/BAO/Export.php +++ b/CRM/Export/BAO/Export.php @@ -439,7 +439,7 @@ public static function exportComponents( // If we haven't selected specific payment fields, load in all the // payment headers. if (!$processor->isExportSpecifiedPaymentFields()) { - $paymentHeaders = self::componentPaymentFields(); + $paymentHeaders = $processor->getcomponentPaymentFields(); if (!empty($paymentDetails)) { $addPaymentHeader = TRUE; } @@ -1304,6 +1304,11 @@ public static function postalMailingFormat($exportTempTable, &$headerRows, &$sql /** * Build componentPayment fields. + * + * This is no longer used by export but BAO_Mapping still calls it & we + * should find a generic way to handle this or move this to that class. + * + * @deprecated */ public static function componentPaymentFields() { static $componentPaymentFields; @@ -1345,8 +1350,8 @@ public static function setHeaderRows($field, $headerRows, $processor) { // @todo - set this correctly in the xml rather than here. $headerRows[] = ts('IM Service Provider'); } - elseif ($processor->isExportPaymentFields() && array_key_exists($field, self::componentPaymentFields())) { - $headerRows[] = CRM_Utils_Array::value($field, self::componentPaymentFields()); + elseif ($processor->isExportPaymentFields() && array_key_exists($field, $processor->getcomponentPaymentFields())) { + $headerRows[] = CRM_Utils_Array::value($field, $processor->getcomponentPaymentFields()); } else { $headerRows[] = $field; @@ -1817,7 +1822,7 @@ protected static function getTransformedFieldValue($field, $iterationDAO, $field } } } - elseif ($processor->isExportSpecifiedPaymentFields() && array_key_exists($field, self::componentPaymentFields())) { + elseif ($processor->isExportSpecifiedPaymentFields() && array_key_exists($field, $processor->getcomponentPaymentFields())) { $paymentTableId = $processor->getPaymentTableID(); $paymentData = CRM_Utils_Array::value($iterationDAO->$paymentTableId, $paymentDetails); $payFieldMapper = array( diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 0b77a52eda6e..2cf81b34db0f 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -519,9 +519,11 @@ protected function hasRequestedComponentPaymentFields() { /** * Get fields that indicate payment fields have been requested for a component. * + * Ideally this should be protected but making it temporarily public helps refactoring.. + * * @return array */ - protected function getComponentPaymentFields() { + public function getComponentPaymentFields() { return [ 'componentPaymentField_total_amount' => ts('Total Amount'), 'componentPaymentField_contribution_status' => ts('Contribution Status'),