/**
* Gaslight Media Members Database
- * Admin PaymentTypes List
+ * Admin InvoiceTypes List
*
* PHP version 5.5
*
*/
// 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
{
/**
{
$success = true;
- $havePaymentTypes = false;
- $paymentTypes = false;
+ $haveInvoiceTypes = false;
+ $invoiceTypes = false;
$error = false;
$enable_members = $this->config['settings']['enable_members'];
}
// Get a current list of members
- $paymentTypes = $this->getList('', 'name');
+ $invoiceTypes = $this->getList('', 'name');
- // echo '<pre>$paymentTypes: ' . print_r( $paymentTypes, true ) . '</pre>';
+ // echo '<pre>$invoiceTypes: ' . print_r( $invoiceTypes, true ) . '</pre>';
// 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;
}
}
// 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
'status' => $success,
'menuItemRedirect' => false,
'modelRedirect' => false,
- 'view' => 'admin/settings/paymentTypes.html',
+ 'view' => 'admin/settings/invoiceTypes.html',
'data' => $templateData
);
{include file='admin/settings/header.html'}
- <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
- <a id="glm-settings" data-show-table="glm-table-settings" class="glm-settings-tab nav-tab{if $option=='settings'} nav-tab-active{/if}">Settings</a>
- </h2>
+{include file='admin/settings/subHeader.html'}
- <!-- Management Settings -->
+ <!-- Billing Settings -->
<table id="glm-table-settings" class="glm-admin-table glm-settings-table{if $option!='settings'} glm-hidden{/if}">
<tr>
<td colspan="2">
{if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
{if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
- <h2>Management Settings</h2>
+ <h2>Billing Invoice Settings</h2>
</td>
</tr>
<tr>
<input type="hidden" name="option2" value="submit">
<table class="glm-admin-table">
- <tr> <th colspan="2"> Defaults </th> </tr>
-
- <tr>
- <th {if $billingSettings.fieldRequired.billing_period} class="glm-required"}{/if}>Default Billing Period</th>
- <td {if $billingSettings.fieldFail.billing_period}class="glm-form-bad-input" data-tabid="glm-billing-period"{/if}>
- <input type="text" name="billing_period" value="{$billingSettings.fieldData.billing_period}" class="glm-form-text-input-short">
- {if $billingSettings.fieldFail.billing_period}<p>{$billingSettings.fieldFail.billing_period}</p>{/if}<br>
- </td>
- </tr>
-
- <tr>
- <th {if $billingSettings.fieldRequired.invoice_date} class="glm-required"}{/if}>Default Invoice Date</th>
- <td {if $billingSettings.fieldFail.invoice_date}class="glm-form-bad-input" data-tabid="glm-invoice-date"{/if}>
- <input type="text" name="invoice_date" value="{$billingSettings.fieldData.invoice_date}" class="glm-form-text-input-short">
- {if $billingSettings.fieldFail.invoice_date}<p>{$billingSettings.fieldFail.invoice_date}</p>{/if}<br>
- </td>
- </tr>
-
- <tr> <th colspan="2"> Invoice Settings </th> </tr>
-
- <tr>
- <th {if $billingSettings.fieldRequired.notification_from} class="glm-required"}{/if}>Notification From</th>
- <td {if $billingSettings.fieldFail.notification_from}class="glm-form-bad-input" data-tabid="glm-notification-from"{/if}>
- <input type="text" name="notification_from" value="{$billingSettings.fieldData.notification_from}" class="glm-form-text-input-short">
- {if $billingSettings.fieldFail.notification_from}<p>{$billingSettings.fieldFail.notification_from}</p>{/if}<br>
- </td>
- </tr>
-
- <tr>
- <th {if $billingSettings.fieldRequired.notification_message} class="glm-required"}{/if}>Notification Message</th>
- <td {if $billingSettings.fieldFail.notification_message}class="glm-form-bad-input" data-tabid="glm-notification-message"{/if}>
- <textarea name="notification_message" class="glm-form-textarea">{$billingSettings.fieldData.notification_message}</textarea>
- {if $billingSettings.fieldFail.notification_message}
- <p>{$billingSettings.fieldFail.notification_message}</p>
- {/if}<br>
- </td>
- </tr>
-
- <tr> <th colspan="2"> Invoice Settings </th> </tr>
-
<tr>
<th {if $billingSettings.fieldRequired.company_logo} class="glm-required"}{/if}>Company Logo</th>
<td {if $billingSettings.fieldFail.company_logo}class="glm-form-bad-input" data-tabid="glm-company-logo"{/if}>
{include file='admin/settings/header.html'}
- <!-- Add PaymentTypes Button and Dialog Box -->
- <div id="newPaymentTypeButton" class="button button-primary glm-right">Add a Payment Type</div>
- <div id="newPaymentTypeDialog" class="glm-dialog-box" title="Enter a New PaymentType">
+{include file='admin/settings/subHeader.html'}
+
+ <!-- Add InvoiceTypes Button and Dialog Box -->
+ <div id="newInvoiceTypeButton" class="button button-primary glm-right">Add a Invoice Type</div>
+ <div id="newInvoiceTypeDialog" class="glm-dialog-box" title="Enter a New InvoiceType">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="paymentTypes">
+ <input type="hidden" name="glm_action" value="invoiceTypes">
<input type="hidden" name="option" value="addNew">
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Payment Type Name:</th>
+ <th class="glm-required">Invoice Type Name:</th>
<td>
<input type="text" name="name" class="glm-form-text-input" required>
</td>
</tr>
</table>
<p><span class="glm-required">*</span> Required</p>
- <a id="newPaymentTypeCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Add new Payment Type" class="button button-primary">
+ <a id="newInvoiceTypeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Add new Invoice Type" class="button button-primary">
</form>
</div>
- <!-- Add PaymentTypes Button -->
- <div id="deletePaymentTypeDialog" class="glm-dialog-box" title="Delete PaymentType">
+ <!-- Add InvoiceTypes Button -->
+ <div id="deleteInvoiceTypeDialog" class="glm-dialog-box" title="Delete InvoiceType">
<center>
- <p>Are you sure you want to delete this paymentType?</p>
- <p><div id="deletePaymentTypeConfirm" class="button button-primary">Yes, delete this paymentType</div></p>
- <p><div id="deletePaymentTypeCancel" class="button button-primary">Cancel</div></p>
+ <p>Are you sure you want to delete this inoiceType?</p>
+ <p><div id="deleteInvoiceTypeConfirm" class="button button-primary">Yes, delete this inoiceType</div></p>
+ <p><div id="deleteInvoiceTypeCancel" class="button button-primary">Cancel</div></p>
</center>
</div>
- <!-- Edit PaymentTypes Dialog Box -->
- <div id="editPaymentTypeDialog" class="glm-dialog-box" title="Edit this PaymentType">
+ <!-- Edit InvoiceTypes Dialog Box -->
+ <div id="editInvoiceTypeDialog" class="glm-dialog-box" title="Edit this InvoiceType">
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
- <input type="hidden" name="glm_action" value="paymentTypes">
+ <input type="hidden" name="glm_action" value="invoiceTypes">
<input type="hidden" name="option" value="update">
- <input id="editPaymentTypeID" type="hidden" name="id" value="">
+ <input id="editInvoiceTypeID" type="hidden" name="id" value="">
<table class="glm-admin-table">
<tr>
- <th class="glm-required">Payment Type Name:</th>
+ <th class="glm-required">Invoice Type Name:</th>
<td>
- <input id="editPaymentTypeName" type="text" name="name" class="glm-form-text-input" required>
+ <input id="editInvoiceTypeName" type="text" name="name" class="glm-form-text-input" required>
</td>
</tr>
<tr>
<th>Code:</th>
<td>
- <input id="editPaymentTypeQCode" type="text" name="qcode" class="glm-form-text-input">
+ <input id="editInvoiceTypeQCode" type="text" name="qcode" class="glm-form-text-input">
</td>
</tr>
<tr>
<th class="glm-required">Category:</th>
<td>
- <input id="editPaymentTypeCategory" type="text" name="category" class="glm-form-text-input" required>
+ <input id="editInvoiceTypeCategory" type="text" name="category" class="glm-form-text-input" required>
</td>
</tr>
<tr>
<th class="glm-required">Amount:</th>
<td>
- <input id="editPaymentTypeAmount" type="text" name="amount" class="glm-form-text-input" required>
+ <input id="editInvoiceTypeAmount" type="text" name="amount" class="glm-form-text-input" required>
</td>
</tr>
<tr>
<th>Dynamic Amount:</th>
<td>
<input type="hidden" name="dynamic_amount" class="glm-form-text-input" value="0">
- <input id="editPaymentTypeDynamicAmount" type="checkbox" name="dynamic_amount" class="glm-form-text-input" value="1">
+ <input id="editInvoiceTypeDynamicAmount" type="checkbox" name="dynamic_amount" class="glm-form-text-input" value="1">
</td>
</tr>
<tr>
<th>Notes:</th>
<td>
- <textarea id="editPaymentTypeNotes" name="notes" class="glm-form-textarea"></textarea>
+ <textarea id="editInvoiceTypeNotes" name="notes" class="glm-form-textarea"></textarea>
</td>
</tr>
</table>
<p><span class="glm-required">*</span> Required</p>
- <a id="editPaymentTypeCancel" class="button button-primary glm-right">Cancel</a>
- <input type="submit" value="Update this Payment Type">
+ <a id="editInvoiceTypeCancel" class="button button-primary glm-right">Cancel</a>
+ <input type="submit" value="Update this Invoice Type">
</form>
</div>
- <h2>PaymentTypes</h2>
+ <h2>InvoiceTypes</h2>
<table class="wp-list-table widefat fixed posts glm-admin-table">
<thead>
<tr>
<th>ID</th>
- <th>PaymentType</th>
+ <th>InvoiceType</th>
<th>Amount</th>
<th> </th>
</tr>
</thead>
<tbody>
- {if $havePaymentTypes}
+ {if $haveInvoiceTypes}
{assign var="i" value="0"}
- {foreach $paymentTypes as $t}
+ {foreach $invoiceTypes as $t}
{if $i++ is odd by 1}
<tr>
{else}
{/if}
<td>{$t.id}</td>
<td>
- <a class="editPaymentType"
- data-paymentTypeID="{$t.id}"
- data-paymentTypeName="{$t.name}"
- data-paymentTypeQCode="{$t.qcode}"
- data-paymentTypeCategory="{$t.category}"
- data-paymentTypeAmount="{$t.amount}"
- data-paymentTypeDynamicAmount="{$t.dynamic_amount}"
- data-paymentTypeNotes="{$t.notes}">{$t.name}</a>
+ <a class="editInvoiceType"
+ data-inoiceTypeID="{$t.id}"
+ data-inoiceTypeName="{$t.name}"
+ data-inoiceTypeQCode="{$t.qcode}"
+ data-inoiceTypeCategory="{$t.category}"
+ data-inoiceTypeAmount="{$t.amount}"
+ data-inoiceTypeDynamicAmount="{$t.dynamic_amount}"
+ data-inoiceTypeNotes="{$t.notes}">{$t.name}</a>
</td>
<td>
{$t.amount}
</td>
<td>
- <div class="deletePaymentTypeButton button button-secondary glm-button-small glm-right" data-paymentTypeID="{$t.id}">Delete</div>
+ <div class="deleteInvoiceTypeButton button button-secondary glm-button-small glm-right" data-inoiceTypeID="{$t.id}">Delete</div>
</td>
</tr>
{/foreach}
{else}
- <tr class="alternate"><td colspan="2">(no paymentTypes listed)</td></tr>
+ <tr class="alternate"><td colspan="2">(no Invoice Types listed)</td></tr>
{/if}
</tbody>
</table>
<script type="text/javascript">
jQuery(document).ready(function($) {
- $("#newPaymentTypeDialog").dialog({
+ $("#newInvoiceTypeDialog").dialog({
autoOpen: false,
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
- $("#editPaymentTypeDialog").dialog({
+ $("#editInvoiceTypeDialog").dialog({
autoOpen: false,
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
- $("#deletePaymentTypeDialog").dialog({
+ $("#deleteInvoiceTypeDialog").dialog({
autoOpen: false,
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
- $('#newPaymentTypeButton').click( function() {
- $("#newPaymentTypeDialog").dialog("open");
+ $('#newInvoiceTypeButton').click( function() {
+ $("#newInvoiceTypeDialog").dialog("open");
});
- $('.editPaymentType').click( function() {
- $('#editPaymentTypeDynamicAmount').prop( 'checked', false );
+ $('.editInvoiceType').click( function() {
+ $('#editInvoiceTypeDynamicAmount').prop( 'checked', false );
- var paymentTypeID = $(this).data('paymenttypeid');
- var paymentTypeName = $(this).data('paymenttypename');
- var paymentTypeQCode = $(this).data('paymenttypeqcode');
- var paymentTypeCategory = $(this).data('paymenttypecategory');
- var paymentTypeAmount = $(this).data('paymenttypeamount');
- var paymentTypeDynamicAmount = $(this).data('paymenttypedynamicamount');
- var paymentTypeNotes = $(this).data('paymenttypenotes');
+ var inoiceTypeID = $(this).data('inoicetypeid');
+ var inoiceTypeName = $(this).data('inoicetypename');
+ var inoiceTypeQCode = $(this).data('inoicetypeqcode');
+ var inoiceTypeCategory = $(this).data('inoicetypecategory');
+ var inoiceTypeAmount = $(this).data('inoicetypeamount');
+ var inoiceTypeDynamicAmount = $(this).data('inoicetypedynamicamount');
+ var inoiceTypeNotes = $(this).data('inoicetypenotes');
- // Set the values of the edit form for the selected paymentType
- $('#editPaymentTypeID').val( paymentTypeID );
- $('#editPaymentTypeName').val( paymentTypeName );
- $('#editPaymentTypeQCode').val( paymentTypeQCode );
- $('#editPaymentTypeCategory').val( paymentTypeCategory );
- $('#editPaymentTypeAmount').val( paymentTypeAmount );
- if ( paymentTypeDynamicAmount === 1 ) {
- $('#editPaymentTypeDynamicAmount').prop( 'checked', true );
+ // Set the values of the edit form for the selected inoiceType
+ $('#editInvoiceTypeID').val( inoiceTypeID );
+ $('#editInvoiceTypeName').val( inoiceTypeName );
+ $('#editInvoiceTypeQCode').val( inoiceTypeQCode );
+ $('#editInvoiceTypeCategory').val( inoiceTypeCategory );
+ $('#editInvoiceTypeAmount').val( inoiceTypeAmount );
+ if ( inoiceTypeDynamicAmount === 1 ) {
+ $('#editInvoiceTypeDynamicAmount').prop( 'checked', true );
}
- $('#editPaymentTypeNotes').val( paymentTypeNotes );
+ $('#editInvoiceTypeNotes').val( inoiceTypeNotes );
- $("#editPaymentTypeDialog").dialog("open");
+ $("#editInvoiceTypeDialog").dialog("open");
});
- $('#editPaymentTypeCancel').click( function() {
- $("#editPaymentTypeDialog").dialog("close");
+ $('#editInvoiceTypeCancel').click( function() {
+ $("#editInvoiceTypeDialog").dialog("close");
});
- $('#newPaymentTypeCancel').click( function() {
- $("#newPaymentTypeDialog").dialog("close");
+ $('#newInvoiceTypeCancel').click( function() {
+ $("#newInvoiceTypeDialog").dialog("close");
});
var id = false;
- $('.deletePaymentTypeButton').click( function() {
- id = $(this).attr('data-paymentTypeID');
- $("#deletePaymentTypeDialog").dialog("open");
+ $('.deleteInvoiceTypeButton').click( function() {
+ id = $(this).attr('data-inoiceTypeID');
+ $("#deleteInvoiceTypeDialog").dialog("open");
});
- $('#deletePaymentTypeConfirm').click( function() {
- $("#deletePaymentTypeDialog").dialog("close");
- window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=paymentTypes&option=delete&id=" + id;
+ $('#deleteInvoiceTypeConfirm').click( function() {
+ $("#deleteInvoiceTypeDialog").dialog("close");
+ window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=invoiceTypes&option=delete&id=" + id;
});
- $('#deletePaymentTypeCancel').click( function() {
- $("#deletePaymentTypeDialog").dialog("close");
+ $('#deleteInvoiceTypeCancel').click( function() {
+ $("#deleteInvoiceTypeDialog").dialog("close");
});
});