Update view for the invoice.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 30 Mar 2018 13:49:54 +0000 (09:49 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 30 Mar 2018 13:49:54 +0000 (09:49 -0400)
When getting the payment data for viewing invoice need to get payment
data not invoice_payment data.

classes/billingSupport.php

index 7c2189d..8be0568 100644 (file)
@@ -576,9 +576,11 @@ class GlmBillingSupport
     {
         return $this->wpdb->get_results(
             $this->wpdb->prepare(
-                "SELECT *
-                   FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX .  "invoice_payments
-                  WHERE invoice = %d",
+                "SELECT P.*
+                   FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX .  "invoice_payments IP
+                LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "payments P
+                ON ( IP.payment = P.id )
+                  WHERE IP.invoice = %d",
                 $invoice
             ),
             ARRAY_A