From: Steve Sutton Date: Fri, 19 Jul 2019 20:14:54 +0000 (-0400) Subject: Move Management into billing X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=e89952eb971c859dfbc4ca269be9fd5bbc946026;p=WP-Plugins%2Fglm-member-db-billing.git Move Management into billing Use responsive navigation. medium up is dropdown small is drilldown. --- diff --git a/classes/billingSupport.php b/classes/billingSupport.php index 071836c..c29168b 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -1093,6 +1093,7 @@ class GlmBillingSupport || !isset( $invoice_data['member_invoice'] ) || !isset( $invoice_data['employee_data'] ) ) { + echo '
$invoice_data: ' . print_r( $invoice_data, true ) . '
'; return false; } extract( $invoice_data ); @@ -1140,7 +1141,7 @@ class GlmBillingSupport 'recurrence' => $new_member_invoice_type['recurrence'], ) ); - // echo '
$invoice_id: ' . print_r( $invoice_id, true ) . '
'; + echo '
$invoice_id: ' . print_r( $invoice_id, true ) . '
'; if ( $invoice_id ) { if ( isset( $employees ) && is_array( $employees ) ) { // Add line items for each employee. diff --git a/classes/data/dataAccounts.php b/classes/data/dataAccounts.php index 00e7292..9a254f8 100644 --- a/classes/data/dataAccounts.php +++ b/classes/data/dataAccounts.php @@ -469,6 +469,7 @@ class GlmDataAccounts extends GlmDataAbstract 'anniversary_date' => $fSave['anniversary_date'], 'invoice_type' => $fSave['invoice_type'], ); + $this->fields['invoice_type']['type'] = 'integer'; $accountList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit); diff --git a/models/admin/ajax/ajaxNotificationPreview.php b/models/admin/ajax/ajaxNotificationPreview.php new file mode 100644 index 0000000..a524265 --- /dev/null +++ b/models/admin/ajax/ajaxNotificationPreview.php @@ -0,0 +1,76 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +require_once GLM_MEMBERS_BILLING_PLUGIN_PATH . '/models/admin/billing/notifications.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_ajaxNotificationPreview extends GlmMembersAdmin_billing_notifications +{ + + /** + * 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 9e39dfe..39c6e65 100644 --- a/models/admin/billing/accounts.php +++ b/models/admin/billing/accounts.php @@ -501,7 +501,6 @@ class GlmMembersAdmin_billing_accounts extends GlmDataAccounts 'filterExpired' => $filterExpired, 'filterActive' => $filterActive, 'filterArchived' => $filterArchived, - 'pluginAssetsUrl' => GLM_MEMBERS_BILLING_PLUGIN_BASE_URL . '/assets/' ); // Return status, any suggested view, and any data to controller diff --git a/models/admin/billing/invoicing.php b/models/admin/billing/invoicing.php index d44c0be..65b54b0 100644 --- a/models/admin/billing/invoicing.php +++ b/models/admin/billing/invoicing.php @@ -182,17 +182,22 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts // echo '
$wParts: ' . print_r( $wParts, true ) . '
'; if ( $option2 ) { + $successCounter = 0; // $where used in all places. - $where = implode( ' AND ', $wParts ); - // echo '
$where: ' . print_r( $where, true ) . '
'; - $accounts = $Accounts->getSimpleAccountList( $where ); + $where = implode( ' AND ', $wParts ); + $accounts = $Accounts->getSimpleAccountList( $where ); + $successMsg = ''; foreach ( $accounts as $account ) { + + echo '
$account: ' . print_r( $account, true ) . '
'; + // Get the invoice type $invoiceType = $BillingSupport->getInvoiceTypeById( $account['invoice_type'] ); + echo '
$invoiceType: ' . print_r( $invoiceType, true ) . '
'; // Create the invoice for this member account - $BillingSupport->createMemberInvoiceWithEmployees( + $newInvoiceId = $BillingSupport->createMemberInvoiceWithEmployees( array( 'account_id' => $account['id'], 'renew_type_id' => $account['invoice_type'], @@ -203,8 +208,11 @@ class GlmMembersAdmin_billing_invoicing //extends GlmDataAccounts 'employees' => array(), ) ); + if ( $newInvoiceId ) { + $successCounter++; + } } - $successMsg = 'Invoices Created'; + $successMsg .= "$successCounter Invoices Created"; } break; diff --git a/models/admin/billing/notifications.php b/models/admin/billing/notifications.php index 394fbb4..aca1492 100644 --- a/models/admin/billing/notifications.php +++ b/models/admin/billing/notifications.php @@ -148,6 +148,26 @@ class GlmMembersAdmin_billing_notifications extends GlmDataNotificationTypes switch( $option ) { + case 'preview': + $view = 'preview'; + // Compile template data + $templateData = array( + 'id' => $id, + 'contact' => array( + 'fname' => 'Test', + 'lname' => 'Person', + ) + ); + // Return status, suggested view, and data to controller + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'admin/billing/' . $view . '.html', + 'data' => $templateData + ); + break; + case 'add': /** * add: diff --git a/setup/standardTemplateParams.php b/setup/standardTemplateParams.php index d91438f..7f09750 100644 --- a/setup/standardTemplateParams.php +++ b/setup/standardTemplateParams.php @@ -23,10 +23,11 @@ */ // Common to both admin and front-end -$smarty->templateAssign('glmPluginName', GLM_MEMBERS_BILLING_PLUGIN_NAME ); +$smarty->templateAssign( 'glmPluginName', GLM_MEMBERS_BILLING_PLUGIN_NAME ); +$smarty->templateAssign( 'pluginAssetsUrl', GLM_MEMBERS_BILLING_PLUGIN_BASE_URL . '/assets/' ); if ( current_user_can( 'glm_members_management' ) ) { - $smarty->templateAssign('glmMemberManager', true); + $smarty->templateAssign( 'glmMemberManager', true ); } else { - $smarty->templateAssign('glmMemberManager', false); + $smarty->templateAssign( 'glmMemberManager', false ); } diff --git a/setup/validActions.php b/setup/validActions.php index f75376a..7d76bc2 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -78,6 +78,7 @@ $glmMembersBillingAddOnValidActions = array( 'billingFixActiveUsers' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, 'ajaxBillingInfo' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, 'ajaxBillingSettings' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'ajaxNotificationPreview' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, ), 'management' => array( 'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, diff --git a/views/admin/billing/accountReveals.html b/views/admin/billing/accountReveals.html index f01b7f6..7776791 100644 --- a/views/admin/billing/accountReveals.html +++ b/views/admin/billing/accountReveals.html @@ -16,6 +16,19 @@ +{* Reveal for Payment Success *} +
+

Payment Complete!

+
+

Successfully saved your data!

+ +
+ +
{* Reveal for Billing Statements *}
+Cancel + {include file='ui/f6/errorCallout.html'} diff --git a/views/admin/billing/editNotificationType.html b/views/admin/billing/editNotificationType.html index 4ecd3eb..ed5c2b1 100644 --- a/views/admin/billing/editNotificationType.html +++ b/views/admin/billing/editNotificationType.html @@ -229,6 +229,8 @@ + Cancel + diff --git a/views/admin/billing/header.html b/views/admin/billing/header.html index 234a966..4991737 100644 --- a/views/admin/billing/header.html +++ b/views/admin/billing/header.html @@ -2,42 +2,104 @@

Billing

- {*