[REF] genericise function to add pseudoconstant data to fields to process
authoreileen <emcnaughton@wikimedia.org>
Wed, 19 Dec 2018 23:05:40 +0000 (12:05 +1300)
committereileen <emcnaughton@wikimedia.org>
Wed, 19 Dec 2018 23:05:40 +0000 (12:05 +1300)
CRM/Contribute/BAO/Contribution.php
CRM/Core/BAO/Mapping.php
CRM/Core/DAO.php

index bfc3956ccaf06c834ec520e359eb4369706b13c2..9440b936b0bb8d0e8e78f8bcade8ffb47d71501c 100644 (file)
@@ -786,15 +786,6 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     return self::$_importableFields;
   }
 
-  /**
-   * Get exportable fields with pseudoconstants rendered as an extra field.
-   */
-  public static function getExportableFieldsWithPseudoConstants() {
-    $fields = self::exportableFields();
-    CRM_Core_DAO::appendPseudoConstantsToFields($fields);
-    return $fields;
-  }
-
   /**
    * Combine all the exportable fields from the lower level objects.
    *
index ebe3c8c0daf0cbdde6dfac854b626522bd3e4953..faccc831cb68bce084f3a603e43043cb86fa1f9f 100644 (file)
@@ -430,7 +430,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
 
     if (($mappingType == 'Search Builder') || ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT)) {
       if (CRM_Core_Permission::access('CiviContribute')) {
-        $fields['Contribution'] = CRM_Contribute_BAO_Contribution::getExportableFieldsWithPseudoConstants();
+        $fields['Contribution'] = CRM_Core_DAO::getExportableFieldsWithPseudoConstants('CRM_Contribute_BAO_Contribution');
         unset($fields['Contribution']['contribution_contact_id']);
         $compArray['Contribution'] = ts('Contribution');
       }
index b130576df270947efb7909e5d1626fb1381b07fa..0567485e0d2594cece1a7c7de7de5ff31bab952e 100644 (file)
@@ -2812,4 +2812,22 @@ SELECT contact_id
     }
   }
 
+  /**
+   * Get exportable fields with pseudoconstants rendered as an extra field.
+   *
+   * @param string $baoClass
+   *
+   * @return array
+   */
+  public static function getExportableFieldsWithPseudoConstants($baoClass) {
+    if (method_exists($baoClass, 'exportableFields')) {
+      $fields = $baoClass::exportableFields();
+    }
+    else {
+      $fields = $baoClass::export();
+    }
+    CRM_Core_DAO::appendPseudoConstantsToFields($fields);
+    return $fields;
+  }
+
 }