From 4329de43213b2e100efb3ba534c6020a2e1b9385 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 19 Apr 2018 16:55:02 -0400 Subject: [PATCH] WIP setup add employees to account edit page. Adding some code for selecting and adding employee to billing account. --- classes/billingSupport.php | 2 ++ models/admin/member/billing.php | 9 +++-- views/admin/billing/editAccount.html | 50 ++++++++++++++++++++++------ 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/classes/billingSupport.php b/classes/billingSupport.php index 4b76a4b..ceb1c9f 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -874,6 +874,8 @@ class GlmBillingSupport /** * getListOfAccountEmployees * + * Returns a list of employees data for a member. + * * @param int $member_id Member id * * @access public diff --git a/models/admin/member/billing.php b/models/admin/member/billing.php index 86caab2..485e375 100644 --- a/models/admin/member/billing.php +++ b/models/admin/member/billing.php @@ -124,6 +124,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling $member_invoice = false; $payable_types = false; $account_status = false; + $accounts = false; // For lockedToMember. $lockedToMember = false; @@ -393,6 +394,9 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling // Get a list of this accounts employees. If they have any. $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID ); + // Need to get the accounts + $Accounts = new GlmDataAccounts( $this->wpdb, $this->config ); + $accounts = $Accounts->getSimpleAccountList( '', 'ref_name' ); // Need to see if there's an account for this member. $accountID = $this->wpdb->get_var( @@ -408,8 +412,8 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling $account = $Accounts->editEntry( $accountID ); $haveAccount = true; } else { - $accountID = 0; - $account = $Accounts->newEntry(); + $accountID = 0; + $account = $Accounts->newEntry(); // Set the ref_name from memberData $account['fieldData']['ref_name'] = $memberData['name']; $haveAccount = false; @@ -581,6 +585,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling 'member_invoice' => $member_invoice, 'payable_types' => $payable_types, 'account_status' => $account_status, + 'accounts' => $accounts, ); // Return status, any suggested view, and any data to controller. diff --git a/views/admin/billing/editAccount.html b/views/admin/billing/editAccount.html index 510ece3..6088005 100644 --- a/views/admin/billing/editAccount.html +++ b/views/admin/billing/editAccount.html @@ -63,17 +63,17 @@ Associated Members/Employees
- - {if $employees} - {foreach $employees as $employee} -
- {$employee.ref_name} - -
- {/foreach} - {/if} + +
+ {if $employees} + {foreach $employees as $employee} +
+ {$employee.ref_name} + Remove +
+ {/foreach} + {/if} +
{/if} @@ -175,6 +175,34 @@