From: Steve Sutton Date: Thu, 15 Mar 2018 18:49:42 +0000 (-0400) Subject: Add line items to invoice X-Git-Tag: v1.0.0^2~143 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=01c898453f95c1fa23734feb66b76734089a0a35;p=WP-Plugins%2Fglm-member-db-billing.git Add line items to invoice If line_items_post is set to true --- diff --git a/classes/data/dataInvoices.php b/classes/data/dataInvoices.php index 07b21f3..2fefd06 100644 --- a/classes/data/dataInvoices.php +++ b/classes/data/dataInvoices.php @@ -12,6 +12,8 @@ * @release SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ */ +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php'; + /** * GlmDataBillingManagement class * @@ -72,6 +74,10 @@ class GlmDataInvoices extends GlmDataAbstract * @access public */ public $fields = false; + /** + * Grab line items for each invoice + */ + public $line_items_post = false; /** * Constructor @@ -216,6 +222,11 @@ class GlmDataInvoices extends GlmDataAbstract $r['id'] ) ); + if ( $this->line_items_post ) { + // Get line items for each invoice + $Billing = new GlmBillingSupport( $this->wpdb, $this->config ); + $r['line_items'] = $Billing->getLineItemsForInvoice( $r['id'] ); + } return $r; } diff --git a/models/admin/billing/index.php b/models/admin/billing/index.php index 3f0102e..6f45be1 100644 --- a/models/admin/billing/index.php +++ b/models/admin/billing/index.php @@ -337,7 +337,10 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices // Get the list of invoices and determine number of invoices in list $orderBy = 'transaction_time desc'; + $this->line_items_post = true; $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit); + echo '
$invoicesResult: ' . print_r( $invoicesResult, true ) . '
'; + $this->line_items_post = false; // Get paging results $numbDisplayed = $invoicesResult['returned']; diff --git a/models/admin/billing/invoices.php b/models/admin/billing/invoices.php index 43c4c1b..684b094 100644 --- a/models/admin/billing/invoices.php +++ b/models/admin/billing/invoices.php @@ -415,7 +415,10 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices // Get the list of invoices and determine number of invoices in list $orderBy = 'transaction_time desc'; + $this->line_items_post = true; $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit); + echo '
$invoicesResult: ' . print_r( $invoicesResult, true ) . '
'; + $this->line_items_post = false; // Get paging results $numbDisplayed = $invoicesResult['returned'];