Updating link for view/print invoice after one is created
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 5 Sep 2019 14:28:01 +0000 (10:28 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 5 Sep 2019 14:28:01 +0000 (10:28 -0400)
This is from the create invoice screen under the member area.

models/admin/billing/invoices.php
models/admin/member/billing.php
views/admin/billing/createInvoice.html

index 0b150ed..14ac926 100644 (file)
@@ -693,7 +693,7 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             $where = implode( ' AND ', $where_params );
 
             // Get the list of invoices and determine number of invoices in list
-            $orderBy = 'due_date ASC, transaction_time DESC';
+            $orderBy = 'due_date DESC, transaction_time DESC';
             $this->line_items_post = true;
             $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit);
             $totalInvoices = $this->getStats($where);
index aadad5a..75eaf4b 100644 (file)
@@ -302,7 +302,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
                         )
                     );
                     $BillingSupport->recordInvoice( $invoiceId, $accountId, $amount );
-                    $invoiceSuccess = true;
+                    $invoiceSuccess = $invoiceId;
                 }
             } else {
                 $invoiceError = true;
index 02fa8d1..b8bd5eb 100644 (file)
 
     {if $invoiceSuccess}
         <p>
-        Invoice is Created. <a href="{$thisUrl}?page={$thisPage}&glm_action=billing&member={$memberID}">View Invoice</a>
+        Invoice is Created.
+        {if $settings.invoice_pdf_enabled}
+        <a target="_blank" href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=createPDFInvoice&id={$invoiceSuccess}">Print Invoice</a>
+        {else}
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=billing&option=view&member={$memberID}&id={$invoiceSuccess}">View Invoice</a>
+        {/if}
         </p>
 
     {else}