From: Steve Sutton Date: Wed, 19 Jun 2019 20:41:58 +0000 (-0400) Subject: Rework for account page. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=9b43a64039a9d148396719374f69a7c46b34acf8;p=WP-Plugins%2Fglm-member-db-billing.git Rework for account page. Working on statements in ajax popup. Also need to redo the forms with foundation 6 markup so can use abide form validation. --- diff --git a/classes/data/dataAccounts.php b/classes/data/dataAccounts.php index 86eddc2..f602db8 100644 --- a/classes/data/dataAccounts.php +++ b/classes/data/dataAccounts.php @@ -122,6 +122,7 @@ class GlmDataAccounts extends GlmDataAbstract $billingAccountEnabled = $this->config['settings']['account_number_enabled']; $billingAccountRequired = $this->config['settings']['account_number_required']; $billingAccountUnique = $this->config['settings']['account_number_unique']; + $memberTypesEnabled = $this->config['settings']['member_types_enabled']; if ( $billingFieldsRequired && $billingContactNameEnabled ) { $billingContactNameRequired = true; } else if ( $billingFieldsRequired && !$billingContactNameEnabled ) { @@ -211,8 +212,6 @@ class GlmDataAccounts extends GlmDataAbstract 'use' => 'a', ), - - 'invoice_type' => array( 'field' => 'invoice_type', 'type' => 'integer', @@ -372,27 +371,16 @@ class GlmDataAccounts extends GlmDataAbstract 'required' => false, ), - // Customer Profile Id - // 'customer_profile_id' => array( - // 'field' => 'customer_profile_id', - // 'type' => 'text', - // 'use' => 'a', - // ), - // Payment Profile Id - // 'payment_profile_id' => array( - // 'field' => 'payment_profile_id', - // 'type' => 'text', - // 'use' => 'a', - // ), - // Payment Profile Card - // 'payment_profile_card' => array( - // 'field' => 'payment_profile_card', - // 'type' => 'text', - // 'use' => 'a', - // ), - ); + if ( !$memberTypesEnabled ) { + $this->fields['invoice_type']['type'] = 'pointer'; + $this->fields['invoice_type']['p_table'] = GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'invoice_types'; + $this->fields['invoice_type']['p_field'] = "CONCAT( name, ' ($', amount , ')' )"; + $this->fields['invoice_type']['p_orderby'] = 'name'; + $this->fields['invoice_type']['p_blank'] = true; + } + } diff --git a/models/admin/ajax/ajaxStatements.php b/models/admin/ajax/ajaxStatements.php new file mode 100644 index 0000000..5675a53 --- /dev/null +++ b/models/admin/ajax/ajaxStatements.php @@ -0,0 +1,76 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +require_once GLM_MEMBERS_BILLING_PLUGIN_PATH . '/models/admin/member/billing.php'; + +/** + * Steve Note + * + * You can get to this using the following URL. + * + * + {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=runQueue + * + * You should be able to do this as POST or GET and should be able to add and read additional parameters. + * I added a "mystuff" parameter to the URL above and it does output from the code in the + * modelAction() function below. + * + * To add another model under models/admin/ajax all you need to do is create it and add it to the + * setup/validActions.php file. + * + */ + +/** + * This class handles the work of creating new invoices based on. + * 1) Member Type of member matching a paid invoiceType + * 2) Member renewal date past + * 3) Member has Billing Account + * 4) Member has no active Invoice + * 5) Renewal date is within the next 30 Days + * + */ +class GlmMembersAdmin_ajax_ajaxBillingInfo extends GlmMembersAdmin_member_billing +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + public $ajaxSide = true; + + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + +} diff --git a/models/admin/billing/accounts.php b/models/admin/billing/accounts.php index b664190..721cd66 100644 --- a/models/admin/billing/accounts.php +++ b/models/admin/billing/accounts.php @@ -135,8 +135,8 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts } // Enqueue GLMA Foundation - wp_enqueue_style( 'Foundation6', GLM_MEMBERS_BILLING_PLUGIN_URL . '/css/foundation.min.css' ); - wp_enqueue_script( 'Foundation6', GLM_MEMBERS_BILLING_PLUGIN_URL . '/js/foundation.min.js' ); + wp_enqueue_style( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/css/foundation-6.min.css' ); + wp_enqueue_script( 'Foundation6', GLM_MEMBERS_PLUGIN_URL . '/js/foundation-6.min.js' ); // Do selected option switch ($option) { diff --git a/models/admin/member/billing.php b/models/admin/member/billing.php index 7ab390e..cc0f046 100644 --- a/models/admin/member/billing.php +++ b/models/admin/member/billing.php @@ -663,18 +663,13 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling $account = $Accounts->updateEntry( $_REQUEST['id'] ); if ( !$account['status'] ) { $accountUpdateError = true; - if ( $this->ajaxSide ) { - header( 'Content-type:application/json;charset=utf-8', true ); - echo json_encode( false, true ); - exit; - } } else { $accountUpdated = true; - if ( $this->ajaxSide ) { - header( 'Content-type:application/json;charset=utf-8', true ); - echo json_encode( true, true ); - exit; - } + } + if ( $this->ajaxSide ) { + header( 'Content-type:application/json;charset=utf-8', true ); + echo json_encode( $account, true ); + exit; } } @@ -790,6 +785,9 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling // echo '
$account: ' . print_r( $account, true ) . '
'; $view = 'editAccount'; + if ( $this->ajaxSide ) { + $view = 'editAccountAjax'; + } break; case 'view': diff --git a/views/admin/billing/accountSearchForm.html b/views/admin/billing/accountSearchForm.html index f760448..2d8ba41 100644 --- a/views/admin/billing/accountSearchForm.html +++ b/views/admin/billing/accountSearchForm.html @@ -93,7 +93,7 @@ jQuery(document).ready(function($) {
Member Account:  - +