Update logo size in invoice
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Mar 2019 13:51:18 +0000 (09:51 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Mar 2019 13:51:18 +0000 (09:51 -0400)
update the renewal form

lib/GlmPDFInvoice.php
models/admin/ajax/billingAccount.php
models/front/billing/renew.php
views/front/billing/renew.html

index f495d8b..0814e65 100644 (file)
@@ -408,7 +408,7 @@ class GlmPDFInvoice extends Cezpdf
             $this->ezImage(
                 GLM_MEMBERS_PLUGIN_MEDIA_PATH . '/images/large/' .  $this->config['settings']['company_logo'], // image
                 0,      // padding
-                260,    // width
+                130,    // width
                 'none', // resize
                 'left', // justification
                 '',     // angle
index 988021a..adfbfe2 100644 (file)
@@ -130,7 +130,7 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts
             if ( isset( $_REQUEST['account_number'] ) && $account_number = filter_var( $_REQUEST['account_number'], FILTER_SANITIZE_STRING ) ) {
                 $account = $this->wpdb->get_row(
                     $this->wpdb->prepare(
-                        "SELECT id,ref_dest
+                        "SELECT id,ref_dest,invoice_type
                            FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
                           WHERE account_number = %s",
                         $account_number
@@ -140,9 +140,10 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts
                 trigger_error( print_r( $account, E_USER_NOTICE ) );
                 if ( $account ) {
                     $return = array(
-                        'status'     => true,
-                        'member_id'  => $account['id'],
-                        'account_id' => $account['ref_dest'],
+                        'status'       => true,
+                        'member_id'    => (int)$account['id'],
+                        'account_id'   => (int)$account['ref_dest'],
+                        'invoice_type' => (int)$account['invoice_type'],
                     );
                 } else {
                     $return = array( 'status'  => false );
index 775f477..012e401 100644 (file)
@@ -166,9 +166,10 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling
             $option = $_REQUEST['option'];
         }
 
+        $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
+
         if ( isset( $memberID ) && $memberID ) {
             require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH .  '/data/dataAccounts.php';
-            $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
             $accountID = $this->wpdb->get_var(
                 $this->wpdb->prepare(
                     "SELECT id
@@ -219,10 +220,12 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling
                 $Management = new GlmDataBillingManagement( $this->wpdb, $this->config );
                 $management = $Management->getEntry( 1 );
 
+                require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH .  '/data/dataAccounts.php';
                 if ( $accountID ) {
                     // Need to see if there's an account for this member.
-                    require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH .  '/data/dataAccounts.php';
                     $account = $Accounts->editEntry( $accountID );
+                } else {
+                    $account = $Accounts->newEntry();
                 }
             }
 
index 3f11428..883f22a 100644 (file)
@@ -135,6 +135,10 @@ jQuery(document).ready(function($){
                 // Set the account and member inputs
                 $('#account_id').val( msg.account_id );
                 $('#member_id').val( msg.member_id );
+                if ( msg.invoice_type ) {
+                    $('input[name=member_renewing], input[value=' + msg.invoice_type + ']').prop('checked', true);
+                    getPageTotal();
+                }
             }
         });
     } );