Update for billing in contact export.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 7 Aug 2018 15:33:16 +0000 (11:33 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 7 Aug 2018 15:33:16 +0000 (11:33 -0400)
Filters for adding billing to the contact exports.

setup/adminHooks.php

index 066ac8f..a906fe8 100644 (file)
@@ -129,3 +129,38 @@ add_filter(
         return $BillingSupport->saveContactBillingData( $ref_dest );
     }, 10, 1
 );
+
+/**
+ * Filter for the billing fields
+ */
+add_filter(
+    'glm-member-db-billing-get-fields',
+    function( $content ){
+        return array(
+            'renewal_date'    => 'Renewal Date',
+            'billing_fname'   => 'Billing First Name',
+            'billing_lname'   => 'Billing Last Name',
+            'billing_addr1'   => 'Billing Address 1',
+            'billing_addr2'   => 'Billing Address 2',
+            'billing_city'    => 'Billing City',
+            'billing_state'   => 'Billing State',
+            'billing_zip'     => 'Billing Zip',
+            'billing_country' => 'Billing Country',
+            'billing_phone'   => 'Billing Phone',
+            'billing_fax'     => 'Billing Fax',
+        );
+    }, 10, 1
+);
+
+/**
+ * Filter for getting billing field for a member
+ */
+add_filter(
+    'glm-member-db-billing-get-data',
+    function( $ref_dest ){
+        // Get billing info for $ref_dest.
+        require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
+        $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+        return $BillingSupport->getAccountByRefDest( $ref_dest );
+    }, 10, 1
+);