From: Steve Sutton Date: Wed, 29 Nov 2017 18:27:47 +0000 (-0500) Subject: Updating the settings for billing X-Git-Tag: v1.0.0^2~217 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6b0051361958cac007c501071c3d76bd54883f1b;p=WP-Plugins%2Fglm-member-db-billing.git Updating the settings for billing Add the invoice types and line items into setting for billing. Also updated the form for the invoice settings. --- diff --git a/models/admin/settings/billing.php b/models/admin/settings/billing.php index faf3ad8..d73feef 100644 --- a/models/admin/settings/billing.php +++ b/models/admin/settings/billing.php @@ -173,6 +173,7 @@ class GlmMembersAdmin_settings_billing extends GlmDataBillingSettings // Compile template data $template_data = array( + 'action' => $_REQUEST['glm_action'], 'enable_members' => $enable_members, 'option' => $option, 'settingsUpdated' => $settings_updated, diff --git a/models/admin/settings/invoiceTypes.php b/models/admin/settings/invoiceTypes.php index 1eec3ea..bee1344 100644 --- a/models/admin/settings/invoiceTypes.php +++ b/models/admin/settings/invoiceTypes.php @@ -2,7 +2,7 @@ /** * Gaslight Media Members Database - * Admin PaymentTypes List + * Admin InvoiceTypes List * * PHP version 5.5 * @@ -14,14 +14,14 @@ */ // Load Member Types data abstract -require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataPaymentTypes.php'; +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoiceTypes.php'; /* * This class performs the work for the default action of the "Members" menu * option, which is to display the members dashboard. * */ -class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes +class GlmMembersAdmin_settings_invoiceTypes extends GlmDataInvoiceTypes { /** @@ -100,8 +100,8 @@ class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes { $success = true; - $havePaymentTypes = false; - $paymentTypes = false; + $haveInvoiceTypes = false; + $invoiceTypes = false; $error = false; $enable_members = $this->config['settings']['enable_members']; @@ -137,20 +137,20 @@ class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes } // Get a current list of members - $paymentTypes = $this->getList('', 'name'); + $invoiceTypes = $this->getList('', 'name'); - // echo '
$paymentTypes: ' . print_r( $paymentTypes, true ) . '
'; + // echo '
$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '
'; // If we have list entries - even if it's an empty list $success = true; - $havePaymentTypes = false; - if ($paymentTypes !== false) { + $haveInvoiceTypes = false; + if ($invoiceTypes !== false) { $success = true; // If we have any entries - if (count($paymentTypes) > 0) { - $havePaymentTypes = true; + if (count($invoiceTypes) > 0) { + $haveInvoiceTypes = true; } } @@ -167,9 +167,10 @@ class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes // Compile template data $templateData = array( + 'action' => $_REQUEST['glm_action'], 'enable_members' => $enable_members, - 'havePaymentTypes' => $havePaymentTypes, - 'paymentTypes' => $paymentTypes + 'haveInvoiceTypes' => $haveInvoiceTypes, + 'invoiceTypes' => $invoiceTypes ); // Return status, suggested view, and data to controller @@ -177,7 +178,7 @@ class GlmMembersAdmin_settings_paymentTypes extends GlmDataPaymentTypes 'status' => $success, 'menuItemRedirect' => false, 'modelRedirect' => false, - 'view' => 'admin/settings/paymentTypes.html', + 'view' => 'admin/settings/invoiceTypes.html', 'data' => $templateData ); diff --git a/setup/adminTabs.php b/setup/adminTabs.php index 6ae2f5d..99827b5 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -46,19 +46,19 @@ if ( current_user_can( 'glm_members_members' ) ) { return $addOnTabs; } ); - add_filter( 'glm-member-db-add-tab-for-settings', - function( $addOnTabs ) { - $newTabs = array( - array( - 'text' => 'Payment Types', - 'menu' => 'settings', - 'action' => 'paymentTypes', - ) - ); - $addOnTabs = array_merge( $addOnTabs, $newTabs ); - return $addOnTabs; - } - ); + // add_filter( 'glm-member-db-add-tab-for-settings', + // function( $addOnTabs ) { + // $newTabs = array( + // array( + // 'text' => 'Payment Types', + // 'menu' => 'settings', + // 'action' => 'paymentTypes', + // ) + // ); + // $addOnTabs = array_merge( $addOnTabs, $newTabs ); + // return $addOnTabs; + // } + // ); add_filter( 'glm-member-db-add-tab-for-billing', function( $addOnTabs ){ $newTabs = array( diff --git a/setup/validActions.php b/setup/validActions.php index 8b27d65..d4f1d77 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -61,7 +61,8 @@ $glmMembersBillingAddOnValidActions = array( 'adminActions' => array( 'settings' => array( 'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, - 'paymentTypes' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'invoiceTypes' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'lineItems' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, ), 'billing' => array( 'index' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, diff --git a/views/admin/settings/billing.html b/views/admin/settings/billing.html index 67124b4..64378fd 100644 --- a/views/admin/settings/billing.html +++ b/views/admin/settings/billing.html @@ -1,17 +1,15 @@ {include file='admin/settings/header.html'} - +{include file='admin/settings/subHeader.html'} - + @@ -22,46 +20,6 @@
{if $settingsUpdated}

Settings Updated

{/if} {if $settingsUpdateError}Settings Update Error{/if} -

Management Settings

+

Billing Invoice Settings

- - - - - - - - - - - - - - - - - - - - - - - - - -
Defaults
Default Billing Period - - {if $billingSettings.fieldFail.billing_period}

{$billingSettings.fieldFail.billing_period}

{/if}
-
Default Invoice Date - - {if $billingSettings.fieldFail.invoice_date}

{$billingSettings.fieldFail.invoice_date}

{/if}
-
Invoice Settings
Notification From - - {if $billingSettings.fieldFail.notification_from}

{$billingSettings.fieldFail.notification_from}

{/if}
-
Notification Message - - {if $billingSettings.fieldFail.notification_message} -

{$billingSettings.fieldFail.notification_message}

- {/if}
-
Invoice Settings
Company Logo diff --git a/views/admin/settings/invoiceTypes.html b/views/admin/settings/invoiceTypes.html index 6644db2..2c033f7 100644 --- a/views/admin/settings/invoiceTypes.html +++ b/views/admin/settings/invoiceTypes.html @@ -1,14 +1,16 @@ {include file='admin/settings/header.html'} - -
Add a Payment Type
-
+{include file='admin/settings/subHeader.html'} + + +
Add a Invoice Type
+
- + - + @@ -46,86 +48,86 @@
Payment Type Name:Invoice Type Name:

* Required

- Cancel - + Cancel +
- -
+ +
-

Are you sure you want to delete this paymentType?

-

Yes, delete this paymentType

-

Cancel

+

Are you sure you want to delete this inoiceType?

+

Yes, delete this inoiceType

+

Cancel

- -
+ +
- + - + - +
Payment Type Name:Invoice Type Name: - +
Code: - +
Category: - +
Amount: - +
Dynamic Amount: - +
Notes: - +

* Required

- Cancel - + Cancel +
-

PaymentTypes

+

InvoiceTypes

- + - {if $havePaymentTypes} + {if $haveInvoiceTypes} {assign var="i" value="0"} - {foreach $paymentTypes as $t} + {foreach $invoiceTypes as $t} {if $i++ is odd by 1} {else} @@ -133,25 +135,25 @@ {/if} {/foreach} {else} - + {/if}
IDPaymentTypeInvoiceType Amount  
{$t.id} - {$t.name} + {$t.name} {$t.amount} -
Delete
+
Delete
(no paymentTypes listed)
(no Invoice Types listed)
@@ -159,67 +161,67 @@