From 18a0bcce31b55d76b36db966d7dfaae43e89b203 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 16 Mar 2018 14:17:36 -0400 Subject: [PATCH] Update invoice page to have links to member billing tab Link each member name to their billing tab. --- classes/data/dataInvoices.php | 13 ++++++++++--- models/admin/billing/invoices.php | 1 + views/admin/billing/invoices.html | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/classes/data/dataInvoices.php b/classes/data/dataInvoices.php index 2fefd06..39382c7 100644 --- a/classes/data/dataInvoices.php +++ b/classes/data/dataInvoices.php @@ -213,15 +213,22 @@ class GlmDataInvoices extends GlmDataAbstract */ public function entryPostProcessing($r, $a) { - $r['member_name'] = $this->wpdb->get_var( + $member_data = $this->wpdb->get_row( $this->wpdb->prepare( - "SELECT A.ref_name + "SELECT A.ref_name,A.ref_dest FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts A ON ( I.account = A.id ) WHERE I.id = %d", $r['id'] - ) + ), + ARRAY_A ); + if ( isset( $member_data ) && $member_data['ref_name'] ) { + $r['member_name'] = $member_data['ref_name']; + } + if ( isset( $member_data ) && $member_data['ref_dest'] ) { + $r['member_id'] = $member_data['ref_dest']; + } if ( $this->line_items_post ) { // Get line items for each invoice $Billing = new GlmBillingSupport( $this->wpdb, $this->config ); diff --git a/models/admin/billing/invoices.php b/models/admin/billing/invoices.php index ee5e783..66c3706 100644 --- a/models/admin/billing/invoices.php +++ b/models/admin/billing/invoices.php @@ -453,6 +453,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices // since we're doing paging, we have to break out just the invoices data $invoices = $invoicesResult['list']; + // echo '
$invoices: ' . print_r( $invoices, true ) . '
'; if (count($invoices)>0) { $haveInvoices = true; } diff --git a/views/admin/billing/invoices.html b/views/admin/billing/invoices.html index 326d111..1c66114 100644 --- a/views/admin/billing/invoices.html +++ b/views/admin/billing/invoices.html @@ -71,7 +71,7 @@ {/if} {$t.id} - {$t.member_name} + {$t.member_name} {foreach $t.line_items as $item} {$item.name} {if $item.recurring && $item.recurrence_string}( {$item.recurrence_string} ){/if} -- 2.17.1