Running testing on all sections.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Jul 2019 20:53:20 +0000 (16:53 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 25 Jul 2019 20:53:20 +0000 (16:53 -0400)
Testing each section
Added payment type column correctly on the report and invoicing pages.

12 files changed:
classes/billingSupport.php
classes/data/dataSettings.php
models/admin/billing/accounts.php
models/admin/billing/index.php
models/admin/billing/invoices.php
models/admin/billing/invoicing.php
models/admin/billing/payments.php
models/admin/member/billing.php
setup/validActions.php
views/admin/billing/editAccountAjax.html
views/admin/billing/invoicing.html
views/admin/billing/reports.html

index 2aa1cbb..f4b7cf2 100644 (file)
@@ -295,7 +295,7 @@ class GlmBillingSupport
                 '%d',
                 '%d',
                 '%s',
-                '%d'
+                '%s'
             )
         );
 
index 62b8d0a..6ba4eec 100644 (file)
@@ -405,5 +405,3 @@ class GlmDataBillingSettings extends GlmDataAbstract
     }
 
 }
-
-?>
index 39c6e65..97d2808 100644 (file)
@@ -399,23 +399,21 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts
                 // $where_params[] = "T.renewal_date >= now()";
                 // $where_params[] = "T.renewal_date + INTERVAL 1 YEAR - INTERVAL $days_before_renewal DAY  <= '$curDate'";
                 // $where_params[] = "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate'";
-                $sub_where_parts[] = "(T.renewal_date + INTERVAL 1 YEAR - INTERVAL $days_before_renewal DAY  <= '$curDate' AND " .
-                "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate')";
-                $sub_where_parts[] = "invoice_type != 0";
+                $sub_where_parts[] = "(T.renewal_date + INTERVAL 1 YEAR - INTERVAL $days_before_renewal DAY  <= '$curDate' AND T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate')";
+                $where_params['invoice_type'] = "invoice_type != 0";
             }
             if ( isset( $_REQUEST['filterOverdue'] ) ) {
                 $filterOverdue = filter_var( $_REQUEST['filterOverdue'], FILTER_VALIDATE_BOOLEAN );
                 // $where_params[] = "T.renewal_date + INTERVAL 1 YEAR < '$curDate'";
                 // $where_params[] = "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate'";
-                $sub_where_parts[] = "(T.renewal_date + INTERVAL 1 YEAR < '$curDate' AND " .
-                "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY >= '$curDate')";
-                $sub_where_parts[] = "invoice_type != 0";
+                $sub_where_parts[] = "(T.renewal_date + INTERVAL 1 YEAR < '$curDate' AND T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY <= '$curDate')";
+                $where_params['invoice_type'] = "invoice_type != 0";
             }
             if ( isset( $_REQUEST['filterExpired'] ) ) {
                 $filterExpired = filter_var( $_REQUEST['filterExpired'], FILTER_VALIDATE_BOOLEAN );
                 // $where_params[] = "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY < '$curDate'";
                 $sub_where_parts[] = "T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY < '$curDate'";
-                $sub_where_parts[] = "invoice_type != 0";
+                $where_params['invoice_type'] = "invoice_type != 0";
             }
 
             if ( !empty( $sub_where_parts ) ) {
@@ -427,8 +425,10 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts
             // By implode with AND.
             $where = implode( ' AND ', $where_params );
 
+            // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
+
             // Get the list of accounts and determine number of accounts in list
-            $orderBy             = 'renewal_date ASC';
+            $orderBy             = 'ref_name ASC';
             $this->postEmployees = true;
             $accountsResult      = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
             $this->postEmployees = false;
@@ -454,11 +454,8 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts
             if ( count( $accounts ) > 0 ) {
                 $haveAccounts = true;
             }
-            // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
             unset( $accountsResult );
 
-            // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
-
             break;
 
         }
index f5eef1a..2ba6026 100644 (file)
@@ -224,7 +224,8 @@ class GlmMembersAdmin_billing_index extends GlmDataAccounts
             if ( $this->config['billing_settings']['dashboard_overdue_renewals'] ) {
                 // Get the number of over due renewals
                 $overDueWhere        = "T.archived <> true AND invoice_type != 0";
-                $overDueWhere       .= " AND T.renewal_date + INTERVAL 1 YEAR < '$curDate'";
+                // $overDueWhere       .= " AND T.renewal_date + INTERVAL 1 YEAR < '$curDate'";
+                $overDueWhere       .= " AND ( T.renewal_date + INTERVAL 1 YEAR < '$curDate' AND T.renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY <= '$curDate')";
                 $start               = 1;
                 $this->postEmployees = true;
                 $overdue             = $this->getList( $overDueWhere, $orderBy, true, 'id', $start, $limit );
index 57ad5d3..a520add 100644 (file)
@@ -197,7 +197,6 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
                     $Notifications->sendEmailNotification( $notice['id'], $account_id, $data );
                 }
             }
-            // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
             $invoiceSent = true;
         }
 
@@ -247,14 +246,13 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
                 $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
                 $this->invoice_id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT );
                 $invoices         = $this->editEntry( $this->invoice_id );
-                // echo '<pre>$invoices: ' . print_r( $invoices, true ) . '</pre>';
-                $view            = 'editInvoice';
-                $InvoiceTypesObj = new GlmDataInvoiceTypes( $this->wpdb, $this->config );
-                $invoiceTypes    = $InvoiceTypesObj->getList();
-                $lineItems       = $BillingSupport->getLineItemsForInvoice( $this->invoice_id );
+                $view             = 'editInvoice';
+                $InvoiceTypesObj  = new GlmDataInvoiceTypes( $this->wpdb, $this->config );
+                $invoiceTypes     = $InvoiceTypesObj->getList();
+                $lineItems        = $BillingSupport->getLineItemsForInvoice( $this->invoice_id );
+
                 // Sort the types by parent child
-                $invoiceTypes    = $InvoiceTypesObj->sortParentChild($invoiceTypes);
-                // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
+                $invoiceTypes = $InvoiceTypesObj->sortParentChild($invoiceTypes);
                 if ( isset( $invoiceTypes ) ) {
                     foreach ( $invoiceTypes as $invoiceType ) {
                         $invTypes[$invoiceType['id']] = array(
@@ -697,7 +695,6 @@ class GlmMembersAdmin_billing_invoices extends GlmDataInvoices
             $orderBy = 'due_date ASC, transaction_time DESC';
             $this->line_items_post = true;
             $invoicesResult = $this->getList($where, $orderBy, true, 'id', $start, $limit);
-            // echo '<pre>$invoicesResult: ' . print_r( $invoicesResult, true ) . '</pre>';
             $totalInvoices = $this->getStats($where);
             $this->line_items_post = false;
 
index 65b54b0..ac1fa78 100644 (file)
@@ -190,11 +190,11 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts
 
                 foreach ( $accounts as $account ) {
 
-                    echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+                    // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
 
                     // Get the invoice type
                     $invoiceType = $BillingSupport->getInvoiceTypeById( $account['invoice_type'] );
-                    echo '<pre>$invoiceType: ' . print_r( $invoiceType, true ) . '</pre>';
+                    // echo '<pre>$invoiceType: ' . print_r( $invoiceType, true ) . '</pre>';
 
                     // Create the invoice for this member account
                     $newInvoiceId = $BillingSupport->createMemberInvoiceWithEmployees(
index 1edf13d..43560f1 100644 (file)
@@ -231,23 +231,6 @@ class GlmMembersAdmin_billing_payments extends GlmDataPayments
             $where = 'true';
             $where_params = array( 'true' );
 
-            // Check for paging
-            // if ( isset( $_REQUEST['pageSelect'] ) ) {
-            //     $_SESSION['search']['pageSelect'] = $_REQUEST['pageSelect'];
-            // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['pageSelect'] ) ) {
-            //     unset( $_SESSION['search']['pageSelect'] );
-            // }
-            // if ( isset( $_REQUEST['nextStart'] ) ) {
-            //     $_SESSION['search']['nextStart'] = $_REQUEST['nextStart'];
-            // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['nextStart'] ) ) {
-            //     unset( $_SESSION['search']['nextStart'] );
-            // }
-            // if ( isset( $_REQUEST['prevStart'] ) ) {
-            //     $_SESSION['search']['prevStart'] = $_REQUEST['prevStart'];
-            // } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) {
-            //     unset( $_SESSION['search']['prevStart'] );
-            // }
-
             // Check if we're doing paging
             if (isset($_REQUEST['pageSelect'])) {
                 // If request is for Next
@@ -264,20 +247,6 @@ class GlmMembersAdmin_billing_payments extends GlmDataPayments
                 }
             }
 
-            // if( isset($_SESSION['search']['pageSelect']) ){
-            //      // If request is for Next
-            //     if ($_SESSION['search']['pageSelect'][0] == 'N') {
-            //         $newStart = $_SESSION['search']['nextStart'] - 0;
-            //
-            //     // Otherwise it must be Previous
-            //     } else {
-            //         $newStart = $_SESSION['search']['prevStart'] - 0;
-            //     }
-            //     if ($newStart > 0) {
-            //         $start = $newStart;
-            //     }
-            // }
-
             // Get any search parameters.
             $reg_options = array(
                 'options' => array(
@@ -311,12 +280,9 @@ class GlmMembersAdmin_billing_payments extends GlmDataPayments
             // By implode with AND.
             $where = implode( ' AND ', $where_params );
 
-            // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
-
             // Get the list of payments and determine number of payments in list
-            $orderBy = 'transaction_time asc';
+            $orderBy = 'transaction_time DESC';
             $paymentsResult = $this->getList($where, $orderBy, true, 'id', $start, $limit);
-            // echo '<pre>$paymentsResult: ' . print_r( $paymentsResult, true ) . '</pre>';
 
             // Get paging results
             $numbDisplayed = $paymentsResult['returned'];
index 38fcb0c..e38c064 100644 (file)
@@ -223,7 +223,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
             require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
             $account = $Accounts->editEntry( $accountID );
             if ( $account && $account['fieldData'] ) {
-                $invoiceTypeId = $account['fieldData']['invoice_type'];
+                $invoiceTypeId = $account['fieldData']['invoice_type']['value'];
 
                 if ( $invoiceTypeId ) {
                     $member_invoice = $BillingSupport->getInvoiceTypeById( $invoiceTypeId );
@@ -244,8 +244,8 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
             // Get tho account data
             $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
             $account  = $Accounts->editEntry( $accountID );
-            if ( $account && $account['fieldData']['invoice_type'] ) {
-                $invoiceTypeId = $account['fieldData']['invoice_type'];
+            if ( $account && $account['fieldData']['invoice_type']['value'] ) {
+                $invoiceTypeId = $account['fieldData']['invoice_type']['value'];
             } else {
                 $invoiceError = true;
                 $messages[]   = 'No account Payment Type set!';
@@ -334,7 +334,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling
                 require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
                 $account = $Accounts->editEntry( $accountID );
                 if ( $account && $account['fieldData'] ) {
-                    $invoiceTypeId = $account['fieldData']['invoice_type'];
+                    $invoiceTypeId = $account['fieldData']['invoice_type']['value'];
 
                     if ( $invoiceTypeId ) {
                         $member_invoice = $BillingSupport->getInvoiceTypeById( $invoiceTypeId );
index 7d76bc2..ddc0edb 100644 (file)
@@ -118,5 +118,3 @@ $glmMembersBillingAddOnValidActions = array(
         ),
     )
 );
-
-?>
index fb15b91..3dd27c6 100644 (file)
     {$data = $account}
 
     <div class="glm-billing-form">
-        <form id="billingInfoForm" action="{$ajaxUrl}?action=glm_members_admin_ajax" method="post" data-abide novalidate>
 
-            <input type="hidden" name="glm_action" value="ajaxBillingInfo" />
-
-            <input type="hidden" name="member" value="{$memberID}" />
-            <input type="hidden" name="ref_dest" value="{$memberID}" />
-            <input type="hidden" name="option" value="account" />
-
-            {if $settings.member_types_enabled}
-                <input type="hidden" name="invoice_type" value="{$account.fieldData.invoice_type}" />
-            {/if}
-            {if $lockedToMember}
-                <input type="hidden" name="anniversary_date" value="{$account.fieldData.anniversary_date.date}" />
-                <input type="hidden" name="renewal_date" value="{$account.fieldData.renewal_date.date}" />
-                <input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />
-            {/if}
-
-            {if $accountID}
-                <input type="hidden" name="id" value="{$accountID}">
-            {/if}
-            {if !$settings.account_number_enabled}<input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />{/if}
-
-            {include file='ui/f6/errorCallout.html'}
-
-            <fieldset class="fieldset cell small-12">
-                <legend>Account Information</legend>
-
-                {* Name *}
-                {$ui = [
-                    'value'       => $data.fieldData.ref_name,
-                    'field'       => 'ref_name',
-                    'label'       => 'Name',
-                    'placeholder' => 'Name',
-                    'required'    => $data.fieldRequired.ref_name,
-                    'errorText'   => 'Name is Required'
-                ]}
-                {include file='ui/f6/text.html'}
-
-
-                {if !$lockedToMember}
-                    {if $settings.account_number_enabled}
-
-                        {* Account Number *}
-                        {$ui = [
-                            'value'       => $data.fieldData.account_number,
-                            'field'       => 'account_number',
-                            'label'       => 'Account Number',
-                            'placeholder' => 'Account Number',
-                            'required'    => $data.fieldRequired.account_number,
-                            'errorText'   => 'Account Number is Required'
-                        ]}
-                        {include file='ui/f6/text.html'}
-
-                    {/if}
-
-                    {if !$settings.member_types_enabled}
-
-                        {* Payment Type *}
-                        {$ui = [
-                            'value'     => $data.fieldData.invoice_type.value,
-                            'field'     => 'invoice_type',
-                            'label'     => 'Payment Type',
-                            'list'      => $data.fieldData.invoice_type.list,
-                            'l_label'   => 'name',
-                            'l_value'   => 'value',
-                            'l_blank'   => false,
-                            'required'  => $data.fieldRequired.invoice_type,
-                            'errorText' => 'Payment Type is Required'
-                        ]}
-                        {include file='ui/f6/select.html'}
-
-                    {/if}
-
-                    {if $settings.invoice_methods_enabled}
-
-                        {* Payment Methods *}
-                        {$ui = [
-                            'value'     => [
-                                'email_invoice' => $data.fieldData.invoice_type.value,
-                                'usmail_invoice' => $data.fieldData.usmail_invoice.value,
-                                'fax_invoice' => $data.fieldData.fax_invoice.value
-                                ],
-                            'field'     => 'invoice_type',
-                            'list'      => ['email_invoice' => 'By Email','usmail_invoice' => 'By US Email','fax_invoice' => 'By Fax'],
-                            'label'     => 'Invoice Delivery Methods',
-                            'required'  => false,
-                            'errorText' => 'At least one Invoice Delivery Method is Required'
-                        ]}
-                        {include file='ui/f6/multicheckboxes.html'}
-
-                    {/if}
-
-                    {* Anniversary Date *}
+        {* Form Start *}
+        {$ui = [
+            'id'               => 'billingInfoForm',
+            'action'           => "{$ajaxUrl}?action=glm_members_admin_ajax",
+            'method'           => 'post',
+            'file'             => false,
+            'validate'         => true,
+            'validateFocusMsg' => true
+        ]}
+        {include file='ui/f6/form-start.html'}
+
+        <input type="hidden" name="glm_action" value="ajaxBillingInfo" />
+
+        <input type="hidden" name="member" value="{$memberID}" />
+        <input type="hidden" name="ref_dest" value="{$memberID}" />
+        <input type="hidden" name="option" value="account" />
+
+        {if $settings.member_types_enabled}
+            <input type="hidden" name="invoice_type" value="{$account.fieldData.invoice_type}" />
+        {/if}
+        {if $lockedToMember}
+            <input type="hidden" name="anniversary_date" value="{$account.fieldData.anniversary_date.date}" />
+            <input type="hidden" name="renewal_date" value="{$account.fieldData.renewal_date.date}" />
+            <input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />
+        {/if}
+
+        {if $accountID}
+            <input type="hidden" name="id" value="{$accountID}">
+        {/if}
+        {if !$settings.account_number_enabled}<input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />{/if}
+
+        <fieldset class="fieldset cell small-12">
+            <legend>Account Information</legend>
+
+            {* Name *}
+            {$ui = [
+                'value'       => $data.fieldData.ref_name,
+                'field'       => 'ref_name',
+                'label'       => 'Name',
+                'placeholder' => 'Name',
+                'required'    => $data.fieldRequired.ref_name,
+                'errorText'   => 'Name is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+
+            {if !$lockedToMember}
+                {if $settings.account_number_enabled}
+
+                    {* Account Number *}
                     {$ui = [
-                        'value'       => $data.fieldData.anniversary_date.date,
-                        'field'       => 'anniversary_date',
-                        'label'       => 'Anniversary Date',
-                        'placeholder' => 'Anniversary Date',
-                        'required'    => $data.fieldRequired.anniversary_date,
-                        'errorText'   => 'Anniversary Date is Required'
+                        'value'       => $data.fieldData.account_number,
+                        'field'       => 'account_number',
+                        'label'       => 'Account Number',
+                        'placeholder' => 'Account Number',
+                        'required'    => $data.fieldRequired.account_number,
+                        'errorText'   => 'Account Number is Required'
                     ]}
                     {include file='ui/f6/text.html'}
 
-                    {* Renewal Date *}
+                {/if}
+
+                {if !$settings.member_types_enabled}
+
+                    {* Payment Type *}
                     {$ui = [
-                        'value'       => $data.fieldData.renewal_date.date,
-                        'field'       => 'renewal_date',
-                        'label'       => 'Renewal Date',
-                        'placeholder' => 'Renewal Date',
-                        'required'    => $data.fieldRequired.renewal_date,
-                        'errorText'   => 'Renewal Date is Required'
+                        'value'     => $data.fieldData.invoice_type.value,
+                        'field'     => 'invoice_type',
+                        'label'     => 'Payment Type',
+                        'list'      => $data.fieldData.invoice_type.list,
+                        'l_label'   => 'name',
+                        'l_value'   => 'value',
+                        'l_blank'   => false,
+                        'required'  => $data.fieldRequired.invoice_type,
+                        'errorText' => 'Payment Type is Required'
                     ]}
-                    {include file='ui/f6/text.html'}
+                    {include file='ui/f6/select.html'}
 
                 {/if}
 
-                {if $settings.allow_employees}
-
-                    <div class="glm-billing-field">
-                        <div class="glm-billing-label{if $account.fieldRequired.boss} glm-required{/if}">Boss</div>
-                        <div class="glm-billing-input{if $account.fieldFail.boss} glm-form-bad-input{/if}" data-tabid="glm-name">
-                            <input id="billing-boss" type="checkbox" name="boss"{if $account.fieldData.boss.value} checked{/if}>
-                        {if $account.fieldFail.boss}<p>{$account.fieldFail.boss}</p>{/if}<br>
-                        </div>
-                    </div>
+                {if $settings.invoice_methods_enabled}
 
-                    <div id="glm-emp-list" class="glm-billing-field">
-                        <div class="glm-billing-label">
-                            <strong>Associated Members/Employees</strong>
-                        </div>
-                        <div class="glm-billing-input">
-                            <input id="glm-billing-member-list" placeholder="Lookup Member">
-                            <div id="glm-billing-employees">
-                                {if $employees}
-                                    {foreach $employees as $employee}
-                                        <div class="glm-billing-employee">
-                                            <input type="hidden" name="employees[{$employee.employee}]" value="1">
-                                            {$employee.employee_name}
-                                            <span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>
-                                        </div>
-                                    {/foreach}
-                                {/if}
-                            </div>
-                        </div>
-                    </div>
+                    {* Payment Methods *}
+                    {$ui = [
+                        'value'     => [
+                            'email_invoice' => $data.fieldData.invoice_type.value,
+                            'usmail_invoice' => $data.fieldData.usmail_invoice.value,
+                            'fax_invoice' => $data.fieldData.fax_invoice.value
+                            ],
+                        'field'     => 'invoice_type',
+                        'list'      => ['email_invoice' => 'By Email','usmail_invoice' => 'By US Email','fax_invoice' => 'By Fax'],
+                        'label'     => 'Invoice Delivery Methods',
+                        'required'  => false,
+                        'errorText' => 'At least one Invoice Delivery Method is Required'
+                    ]}
+                    {include file='ui/f6/multicheckboxes.html'}
 
                 {/if}
 
-            </fieldset>
-
-            <fieldset class="fieldset cell small-12">
-                <legend>Billing Information</legend>
-
-                {* Billing Email *}
+                {* Anniversary Date *}
                 {$ui = [
-                    'value'       => $data.fieldData.email,
-                    'field'       => 'email',
-                    'label'       => 'Billing Email',
-                    'placeholder' => 'Billing Email',
-                    'required'    => $data.fieldRequired.email,
-                    'errorText'   => 'Billing Email is Required'
+                    'value'       => $data.fieldData.anniversary_date.date,
+                    'field'       => 'anniversary_date',
+                    'label'       => 'Anniversary Date',
+                    'placeholder' => 'Anniversary Date',
+                    'required'    => $data.fieldRequired.anniversary_date,
+                    'errorText'   => 'Anniversary Date is Required'
                 ]}
                 {include file='ui/f6/text.html'}
 
-                {* Billing Company *}
+                {* Renewal Date *}
                 {$ui = [
-                    'value'       => $data.fieldData.billing_company,
-                    'field'       => 'billing_company',
-                    'label'       => 'Billing Company',
-                    'placeholder' => 'Billing Company',
-                    'required'    => $data.fieldRequired.billing_company,
-                    'errorText'   => 'Billing Company is Required'
+                    'value'       => $data.fieldData.renewal_date.date,
+                    'field'       => 'renewal_date',
+                    'label'       => 'Renewal Date',
+                    'placeholder' => 'Renewal Date',
+                    'required'    => $data.fieldRequired.renewal_date,
+                    'errorText'   => 'Renewal Date is Required'
                 ]}
                 {include file='ui/f6/text.html'}
 
-                {* Billing Position *}
-                {$ui = [
-                    'value'       => $data.fieldData.billing_position,
-                    'field'       => 'billing_position',
-                    'label'       => 'Billing Position',
-                    'placeholder' => 'Billing Position',
-                    'required'    => $data.fieldRequired.billing_position,
-                    'errorText'   => 'Billing Position is Required'
-                ]}
-                {include file='ui/f6/text.html'}
+            {/if}
 
-                {if $settings.billing_contact_name_enabled}
+            {if $settings.allow_employees}
 
-                    {* Billing Contact Name *}
-                    {$ui = [
-                        'value'       => $data.fieldData.billing_contact_name,
-                        'field'       => 'billing_contact_name',
-                        'label'       => 'Billing Contact Name',
-                        'placeholder' => 'Billing Contact Name',
-                        'required'    => $data.fieldRequired.billing_contact_name,
-                        'errorText'   => 'Billing Contact Name is Required'
-                    ]}
-                    {include file='ui/f6/text.html'}
-                {else}
-                    {* Billing First Name *}
-                    {$ui = [
-                        'value'       => $data.fieldData.billing_fname,
-                        'field'       => 'billing_fname',
-                        'label'       => 'Billing First Name',
-                        'placeholder' => 'Billing First Name',
-                        'required'    => $data.fieldRequired.billing_fname,
-                        'errorText'   => 'Billing First Name is Required'
-                    ]}
-                    {include file='ui/f6/text.html'}
+                <div class="glm-billing-field">
+                    <div class="glm-billing-label{if $account.fieldRequired.boss} glm-required{/if}">Boss</div>
+                    <div class="glm-billing-input{if $account.fieldFail.boss} glm-form-bad-input{/if}" data-tabid="glm-name">
+                        <input id="billing-boss" type="checkbox" name="boss"{if $account.fieldData.boss.value} checked{/if}>
+                    {if $account.fieldFail.boss}<p>{$account.fieldFail.boss}</p>{/if}<br>
+                    </div>
+                </div>
 
-                    {* Billing Last Name *}
-                    {$ui = [
-                        'value'       => $data.fieldData.billing_lname,
-                        'field'       => 'billing_lname',
-                        'label'       => 'Billing Last Name',
-                        'placeholder' => 'Billing Last Name',
-                        'required'    => $data.fieldRequired.billing_lname,
-                        'errorText'   => 'Billing Last Name is Required'
-                    ]}
-                    {include file='ui/f6/text.html'}
-                {/if}
+                <div id="glm-emp-list" class="glm-billing-field">
+                    <div class="glm-billing-label">
+                        <strong>Associated Members/Employees</strong>
+                    </div>
+                    <div class="glm-billing-input">
+                        <input id="glm-billing-member-list" placeholder="Lookup Member">
+                        <div id="glm-billing-employees">
+                            {if $employees}
+                                {foreach $employees as $employee}
+                                    <div class="glm-billing-employee">
+                                        <input type="hidden" name="employees[{$employee.employee}]" value="1">
+                                        {$employee.employee_name}
+                                        <span class="glm-billing-employee-del dashicons dashicons-trash glm-right"></span>
+                                    </div>
+                                {/foreach}
+                            {/if}
+                        </div>
+                    </div>
+                </div>
 
-                {* Billing Address 1 *}
+            {/if}
+
+        </fieldset>
+
+        <fieldset class="fieldset cell small-12">
+            <legend>Billing Information</legend>
+
+            {* Billing Email *}
+            {$ui = [
+                'value'       => $data.fieldData.email,
+                'field'       => 'email',
+                'label'       => 'Billing Email',
+                'placeholder' => 'Billing Email',
+                'required'    => $data.fieldRequired.email,
+                'errorText'   => 'Billing Email is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Company *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_company,
+                'field'       => 'billing_company',
+                'label'       => 'Billing Company',
+                'placeholder' => 'Billing Company',
+                'required'    => $data.fieldRequired.billing_company,
+                'errorText'   => 'Billing Company is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Position *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_position,
+                'field'       => 'billing_position',
+                'label'       => 'Billing Position',
+                'placeholder' => 'Billing Position',
+                'required'    => $data.fieldRequired.billing_position,
+                'errorText'   => 'Billing Position is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {if $settings.billing_contact_name_enabled}
+
+                {* Billing Contact Name *}
                 {$ui = [
-                    'value'       => $data.fieldData.billing_addr1,
-                    'field'       => 'billing_addr1',
-                    'label'       => 'Billing Address 1',
-                    'placeholder' => 'Billing Address 1',
-                    'required'    => $data.fieldRequired.billing_addr1,
-                    'errorText'   => 'Billing Address 1 is Required'
+                    'value'       => $data.fieldData.billing_contact_name,
+                    'field'       => 'billing_contact_name',
+                    'label'       => 'Billing Contact Name',
+                    'placeholder' => 'Billing Contact Name',
+                    'required'    => $data.fieldRequired.billing_contact_name,
+                    'errorText'   => 'Billing Contact Name is Required'
                 ]}
                 {include file='ui/f6/text.html'}
-
-                {* Billing Address 2 *}
+            {else}
+                {* Billing First Name *}
                 {$ui = [
-                    'value'       => $data.fieldData.billing_addr2,
-                    'field'       => 'billing_addr2',
-                    'label'       => 'Billing Address 2',
-                    'placeholder' => 'Billing Address 2',
-                    'required'    => $data.fieldRequired.billing_addr2,
-                    'errorText'   => 'Billing Address 2 is Required'
+                    'value'       => $data.fieldData.billing_fname,
+                    'field'       => 'billing_fname',
+                    'label'       => 'Billing First Name',
+                    'placeholder' => 'Billing First Name',
+                    'required'    => $data.fieldRequired.billing_fname,
+                    'errorText'   => 'Billing First Name is Required'
                 ]}
                 {include file='ui/f6/text.html'}
 
-                {* Billing City *}
+                {* Billing Last Name *}
                 {$ui = [
-                    'value'       => $data.fieldData.billing_city,
-                    'field'       => 'billing_city',
-                    'label'       => 'Billing City',
-                    'placeholder' => 'Billing City',
-                    'required'    => $data.fieldRequired.billing_city,
-                    'errorText'   => 'Billing City is Required'
+                    'value'       => $data.fieldData.billing_lname,
+                    'field'       => 'billing_lname',
+                    'label'       => 'Billing Last Name',
+                    'placeholder' => 'Billing Last Name',
+                    'required'    => $data.fieldRequired.billing_lname,
+                    'errorText'   => 'Billing Last Name is Required'
                 ]}
                 {include file='ui/f6/text.html'}
+            {/if}
 
-                {if $settings.billing_county_enabled}
-                    {* Billing County *}
-                    {$ui = [
-                        'value'     => $data.fieldData.billing_county.value,
-                        'field'     => 'billing_county',
-                        'label'     => 'Billing County',
-                        'list'      => $data.fieldData.billing_county.list,
-                        'l_label'   => 'name',
-                        'l_value'   => 'value',
-                        'l_blank'   => false,
-                        'required'  => $data.fieldRequired.billing_county,
-                        'errorText' => 'Billing County is Required'
-                    ]}
-                    {include file='ui/f6/select.html'}
-                {else}
-                    <input type="hidden" name="billing_county" value="{$account.fieldData.billing_county.value}">
-                {/if}
-
-                {* Billing State *}
+            {* Billing Address 1 *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_addr1,
+                'field'       => 'billing_addr1',
+                'label'       => 'Billing Address 1',
+                'placeholder' => 'Billing Address 1',
+                'required'    => $data.fieldRequired.billing_addr1,
+                'errorText'   => 'Billing Address 1 is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Address 2 *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_addr2,
+                'field'       => 'billing_addr2',
+                'label'       => 'Billing Address 2',
+                'placeholder' => 'Billing Address 2',
+                'required'    => $data.fieldRequired.billing_addr2,
+                'errorText'   => 'Billing Address 2 is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing City *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_city,
+                'field'       => 'billing_city',
+                'label'       => 'Billing City',
+                'placeholder' => 'Billing City',
+                'required'    => $data.fieldRequired.billing_city,
+                'errorText'   => 'Billing City is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {if $settings.billing_county_enabled}
+                {* Billing County *}
                 {$ui = [
-                    'value'     => $data.fieldData.billing_state.value,
-                    'field'     => 'billing_state',
-                    'label'     => 'Billing State',
-                    'list'      => $data.fieldData.billing_state.list,
+                    'value'     => $data.fieldData.billing_county.value,
+                    'field'     => 'billing_county',
+                    'label'     => 'Billing County',
+                    'list'      => $data.fieldData.billing_county.list,
                     'l_label'   => 'name',
                     'l_value'   => 'value',
                     'l_blank'   => false,
-                    'required'  => $data.fieldRequired.billing_state,
-                    'errorText' => 'Billing State is Required'
+                    'required'  => $data.fieldRequired.billing_county,
+                    'errorText' => 'Billing County is Required'
                 ]}
                 {include file='ui/f6/select.html'}
+            {else}
+                <input type="hidden" name="billing_county" value="{$account.fieldData.billing_county.value}">
+            {/if}
 
-                {* Billing Zip *}
-                {$ui = [
-                    'value'       => $data.fieldData.billing_zip,
-                    'field'       => 'billing_zip',
-                    'label'       => 'Billing Zip',
-                    'placeholder' => 'Billing Zip',
-                    'required'    => $data.fieldRequired.billing_zip,
-                    'errorText'   => 'Billing Zip is Required'
-                ]}
-                {include file='ui/f6/text.html'}
-
-                {* Billing Country *}
-                {$ui = [
-                    'value'       => $data.fieldData.billing_country,
-                    'field'       => 'billing_country',
-                    'label'       => 'Billing Country',
-                    'placeholder' => 'Billing Country',
-                    'required'    => $data.fieldRequired.billing_country,
-                    'errorText'   => 'Billing Country is Required'
-                ]}
-                {include file='ui/f6/text.html'}
-
-                {* Billing Phone *}
-                {$ui = [
-                    'value'       => $data.fieldData.billing_phone,
-                    'field'       => 'billing_phone',
-                    'label'       => 'Billing Phone',
-                    'placeholder' => 'Billing Phone',
-                    'required'    => $data.fieldRequired.billing_phone,
-                    'errorText'   => 'Billing Phone is Required'
-                ]}
-                {include file='ui/f6/text.html'}
-
-                {* Billing Fax *}
-                {$ui = [
-                    'value'       => $data.fieldData.billing_fax,
-                    'field'       => 'billing_fax',
-                    'label'       => 'Billing Fax',
-                    'placeholder' => 'Billing Fax',
-                    'required'    => $data.fieldRequired.billing_fax,
-                    'errorText'   => 'Billing Fax is Required'
-                ]}
-                {include file='ui/f6/text.html'}
-
-            </fieldset>
-
-            {include file='ui/f6/errorCallout.html'}
-
-            <button class="button button-primary" type="submit" style="margin-top: 0;">{if $haveAccount}Save{else}Create{/if} Account</button>
-
-            <button class="button glm-right" data-close aria-label="Cancel" type="button">
-                <span>Cancel</span>
-            </button>
-
-        </form>
+            {* Billing State *}
+            {$ui = [
+                'value'     => $data.fieldData.billing_state.value,
+                'field'     => 'billing_state',
+                'label'     => 'Billing State',
+                'list'      => $data.fieldData.billing_state.list,
+                'l_label'   => 'name',
+                'l_value'   => 'value',
+                'l_blank'   => false,
+                'required'  => $data.fieldRequired.billing_state,
+                'errorText' => 'Billing State is Required'
+            ]}
+            {include file='ui/f6/select.html'}
+
+            {* Billing Zip *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_zip,
+                'field'       => 'billing_zip',
+                'label'       => 'Billing Zip',
+                'placeholder' => 'Billing Zip',
+                'required'    => $data.fieldRequired.billing_zip,
+                'errorText'   => 'Billing Zip is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Country *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_country,
+                'field'       => 'billing_country',
+                'label'       => 'Billing Country',
+                'placeholder' => 'Billing Country',
+                'required'    => $data.fieldRequired.billing_country,
+                'errorText'   => 'Billing Country is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Phone *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_phone,
+                'field'       => 'billing_phone',
+                'label'       => 'Billing Phone',
+                'placeholder' => 'Billing Phone',
+                'required'    => $data.fieldRequired.billing_phone,
+                'errorText'   => 'Billing Phone is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+            {* Billing Fax *}
+            {$ui = [
+                'value'       => $data.fieldData.billing_fax,
+                'field'       => 'billing_fax',
+                'label'       => 'Billing Fax',
+                'placeholder' => 'Billing Fax',
+                'required'    => $data.fieldRequired.billing_fax,
+                'errorText'   => 'Billing Fax is Required'
+            ]}
+            {include file='ui/f6/text.html'}
+
+        </fieldset>
+
+        {include file='ui/f6/errorCallout.html'}
+
+        <button class="button button-primary" type="submit" style="margin-top: 0;">{if $haveAccount}Save{else}Create{/if} Account</button>
+
+        <button class="button glm-right" data-close aria-label="Cancel" type="button">
+            <span>Cancel</span>
+        </button>
+
+        {* Form End *}
+        {include file='ui/f6/form-end.html'}
     </div>
 
     <script>
         .on('submit', function(ev){
             ev.preventDefault();
             var validForm = $('#billingInfoForm').foundation('validateForm');
-            //console.log('ValidForm: ',validForm);
             var data = $('#billingInfoForm').serialize();
-            //console.log('data: ', data);
-            //console.log('Submit for form id '+ev.target.id+' intercepted');
             $.ajax({
                 url: '{$ajaxUrl}?action=glm_members_admin_ajax&' + data,
                 cache: false,
                 beforeSend: startAjax,
                 complete: completeAjax,
             }).done(function(rsp){
-                //console.log( 'rsp:', rsp );
                 if ( rsp.status == '1' ) {
                     var $sucessModal = $('#billingInfoSuccess');
                     $sucessModal.foundation('open').trigger('resizeme.zp.reveal');
                     var ref_name = rsp.fieldData.ref_name;
                     // kill this abide form
                     $('#billingInfoForm').foundation('_destroy');
-                    //console.log('name: ', ref_name);
-                    //$('#account-ref-dest-' + id).text( ref_name );
                 } else {
                     return false;
                 }
index 8fcbcbd..d6b28cb 100644 (file)
                     {if isset( $settings.account_number_enabled ) && $settings.account_number_enabled}
                         <td> {$t.account_number} </td>
                     {/if}
-                    <td> {$t.payment_type} </td>
+                    <td> {$t.invoice_type} </td>
                     <td> {$t.balance_due|string_format:"%.2f"} </td>
                 </tr>
             {/foreach}
index be4f9e5..d4c1f61 100644 (file)
                     {if isset( $settings.account_number_enabled ) && $settings.account_number_enabled}
                         <td> {$t.account_number} </td>
                     {/if}
-                    <td> {$t.payment_type} </td>
+                    <td> {$t.invoice_type} </td>
                     <td>
                         {if $t.balance_due == 'N/A'}
-                            {$t.balance_due}
+
                         {else}
                             {$t.balance_due|string_format:"%.2f"}
                         {/if}