'p_orderby' => 'name',
'p_blank' => true,
'force_list' => true,
- 'required' => false,
+ 'required' => true,
'use' => 'a'
),
// Name of red_dest
'ref_name' => array(
- 'field' => 'ref_name',
- 'type' => 'text',
- 'use' => 'a',
+ 'field' => 'ref_name',
+ 'type' => 'text',
+ 'use' => 'a',
+ 'required' => true,
),
// Anniversary Date
'anniversary_date' => array(
- 'field' => 'anniversary_date',
- 'type' => 'date',
- 'use' => 'a',
+ 'field' => 'anniversary_date',
+ 'type' => 'date',
+ 'use' => 'a',
+ 'default' => '',
+ 'required' => true,
),
// Payment Data
'payment_data' => array(
- 'field' => 'payment_data',
- 'type' => 'text',
- 'use' => 'a',
+ 'field' => 'payment_data',
+ 'type' => 'text',
+ 'use' => 'a',
+ 'required' => false,
),
// Email
'email' => array(
- 'field' => 'email',
- 'type' => 'text',
- 'use' => 'a',
+ 'field' => 'email',
+ 'type' => 'text',
+ 'use' => 'a',
+ 'required' => true,
),
);
public function entryPostProcessing($r, $a)
{
$sql = "
- SELECT M.name
- FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members M,
- " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I,
- " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts A
- WHERE A.ref_dest = M.id
- AND I.account = A.id";
+ SELECT A.ref_name
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices I
+ LEFT OUTER JOIN " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts A
+ ON ( I.account = A.id )";
$r['member_name'] = $this->wpdb->get_var( $sql );
return $r;
}
* version from this plugin.
*/
define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.1');
+define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.2');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_BILLING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
/**
* Billing ID
*
- * @var $billingID
+ * @var $memberID
* @access public
*/
- public $billingID = false;
+ public $memberID = false;
/**
* Constructor
public function modelAction($actionData = false)
{
// Initialize Variables Here
- $numbPending = 0;
- $namesList = false;
- $haveCategories = false;
- $numberPending = 0;
+ $numbPending = 0;
+ $namesList = false;
+ $haveCategories = false;
+ $numberPending = 0;
+ $fromMemberMenu = false;
+ $this->memberID = false;
+ $memberData = false;
+ $memberName = false;
+ $haveMember = false;
+ $haveAccount = false;
+ $option = 'list';
+ $view = 'index';
+ $account = false;
+ $accountID = 0;
+ $accountUpdated = false;
+ $accountUpdateError = false;
+ $accountAdded = false;
+ $accountInsertError = false;
// For lockedToMember
$lockedToMember = false;
$lockedWhere .= ' AND ';
}
+ if ( defined( 'GLM_MEMBERS_BILLING_MEMBER_MENU' ) && GLM_MEMBERS_BILLING_MEMBER_MENU ) {
+ $fromMemberMenu = true;
+
+ if ( isset( $_REQUEST['member'] ) ) {
+ $this->memberID = $_REQUEST['member'];
+ }
+ }
+
+ require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php';
+ $this->Members = new GlmDataMembers( $this->wpdb, $this->config );
+
+ if ( $this->memberID ) {
+ $memberData = $this->Members->getEntry( $this->memberID );
+ }
+
+ if ( isset( $memberData ) && is_array( $memberData ) && $memberData['id'] > 0 ) {
+ $haveMember = true;
+ $memberName = $memberData['name'];
+ }
+
+ if ( isset( $_REQUEST['option'] ) ) {
+ $option = $_REQUEST['option'];
+ }
+
+ switch ( $option ) {
+ case 'account':
+ require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+ $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
+
+ // Check to see if we're adding an account or editing one.
+ if ( isset( $_REQUEST['ref_name'] ) ) {
+ $_REQUEST['anniversary_date'] = date('Y-m-d', strtotime($_REQUEST['anniversary_date']));
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ // if there's no id then add account
+ if ( !isset( $_REQUEST['id'] ) ) {
+ $account = $Accounts->insertEntry();
+ if ( !$account['status'] ) {
+ $accountInsertError = true;
+ } else {
+ $accountAdded = true;
+ }
+ } else {
+ $account = $Accounts->updateEntry( $_REQUEST['id'] );
+ if ( !$account['status'] ) {
+ $accountUpdateError = true;
+ } else {
+ $accountUpdated = true;
+ }
+ }
+ }
+
+ // Need to see if there's an account for this member.
+ $accountID = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE ref_dest = %d",
+ $this->memberID
+ )
+ );
+ if ( !$account ) {
+ if ( $accountID ) {
+ $account = $Accounts->editEntry( $accountID );
+ $haveAccount = true;
+ } else {
+ $accountID = 0;
+ $account = $Accounts->newEntry();
+ // Set the ref_name from memberData
+ $account['fieldData']['ref_name'] = $memberData['name'];
+ $haveAccount = false;
+ }
+ } else {
+ $haveAccount = true;
+ // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+ }
+
+ // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+ $view = 'editAccount';
+ break;
+ case 'list':
+ break;
+ }
+
// Compile template data
$templateData = array(
- 'lockedToMember' => $lockedToMember,
- 'numberPending' => $numberPending,
+ 'accountID' => $accountID,
+ 'option' => $option,
+ 'fromMemberMenu' => ( defined('GLM_MEMBERS_BILLING_MEMBER_MENU' ) ? true: false ),
+ 'lockedToMember' => $lockedToMember,
+ 'numberPending' => $numberPending,
+ 'memberID' => $this->memberID,
+ 'haveMember' => $haveMember,
+ 'haveAccount' => $haveAccount,
+ 'memberData' => $memberData,
+ 'memberName' => $memberName,
+ 'account' => $account,
+ 'accountUpdated' => $accountUpdated,
+ 'accountUpdateError' => $accountUpdateError,
+ 'accountAdded' => $accountAdded,
+ 'accountInsertError' => $accountInsertError,
);
+ // echo '<pre>$templateData: ' . print_r( $templateData, true ) . '</pre>';
// Return status, any suggested view, and any data to controller
return array(
'status' => true,
'modelRedirect' => false,
- 'view' => 'admin/billing/index.html',
+ 'view' => 'admin/billing/'.$view.'.html',
'data' => $templateData
);
}
unset($invoicesResult);
- // echo '<pre>$invoices: ' . print_r( $invoices, true ) . '</pre>';
+ echo '<pre>$invoices: ' . print_r( $invoices, true ) . '</pre>';
foreach ( $invoices as $invoice ) {
// $this->generateInvoiceTotal( $invoice['id'] );
--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin Member Billing List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Inform the billing code that we're working from the member area
+define('GLM_MEMBERS_BILLING_MEMBER_MENU', true);
+
+// Load the events index
+require GLM_MEMBERS_BILLING_PLUGIN_PATH."/models/admin/billing/index.php";
+
+class GlmMembersAdmin_member_billing extends GlmMembersAdmin_billing_index
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+ /**
+ * Billing List
+ *
+ * @var $billing
+ * @access public
+ */
+ public $billing = false;
+ /**
+ * Contact Info
+ *
+ * @var $contactInfo
+ * @access public
+ */
+ public $contactInfo = false;
+ /**
+ * Member ID
+ *
+ * @var $memberID
+ * @access public
+ */
+ public $memberID = false;
+ /**
+ * Contact ID
+ *
+ * @var $contactID
+ * @access public
+ */
+ public $contactID = false;
+
+
+ /*
+ * Constructor
+ *
+ * This contructor performs the work for this model. This model returns
+ * an array containing the following.
+ *
+ * 'status'
+ *
+ * True if successfull and false if there was a fatal failure.
+ *
+ * 'view'
+ *
+ * A suggested view name that the contoller should use instead of the
+ * default view for this model or false to indicate that the default view
+ * should be used.
+ *
+ * 'data'
+ *
+ * Data that the model is returning for use in merging with the view to
+ * produce output.
+ *
+ * @wpdb object WordPress database object
+ *
+ * @return array Array containing status, suggested view, and any data
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct($wpdb, $config);
+
+ }
+
+}
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(
);
}
);
+
+ add_filter(
+ 'glm-member-db-add-tab-for-member',
+ function( $addOnTabs ){
+ $newTabs = array(
+ array(
+ 'text' => 'Billing',
+ 'menu' => 'billing',
+ 'action' => 'billing'
+ )
+ );
+ $addOnTabs = array_merge( $addOnTabs, $newTabs );
+ return $addOnTabs;
+ }
+ );
}
+++ /dev/null
--- Gaslight Media Billing Module
--- File Created: 11/08/2017
--- Database Version: 0.0.1
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Billing Accounts
-CREATE TABLE {prefix}accounts (
- id INT NOT NULL AUTO_INCREMENT,
- ref_dest INT NOT NULL, -- reference to member id
- ref_name TINYTEXT NOT NULL, -- Name of reference member
- anniversary_date DATE NOT NULL, -- anniversary date - used for main invoice generation
- payment_data TEXT NULL, -- stored payment data
- email TINYTEXT NULL, -- billing email
- PRIMARY KEY (id)
-);
-
-----
-
--- transactions
-CREATE TABLE {prefix}transactions (
- id INT NOT NULL AUTO_INCREMENT,
- type INT NOT NULL, -- type of transaction (payment,invoice,etc)
- type_id INT NOT NULL, -- reference to type id
- transaction_time DATETIME NOT NULL, -- datetime for the transaction
- current_invoice_total DECIMAL(8, 2) NOT NULL, -- invoice total
- current_payment_total DECIMAL(8, 2) NOT NULL, -- payment total
- PRIMARY KEY (id)
-);
-
-----
-
--- Invoices
-CREATE TABLE {prefix}invoices (
- id INT NOT NULL AUTO_INCREMENT,
- transaction_time DATETIME NOT NULL, -- datetime for the invoice
- account INT NOT NULL, -- ref to account id
- amount_total DECIMAL(8, 2) NOT NULL, -- total amount for invoice
- balance DECIMAL(8, 2) NOT NULL, -- balance for this invoice
- due_date DATE NOT NULL, -- Due date for this invoice
- paid BOOLEAN DEFAULT '0', -- true/false if invoice is paid
- notes TINYTEXT, -- notes for this invoice
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- Line Item Types
-CREATE TABLE {prefix}invoice_types (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NOT NULL, -- name
- parent INT NOT NULL DEFAULT 0, -- 0 if top level otherwise ref to another line_item_type as it's parent
- amount DECIMAL(8,2) NOT NULL DEFAULT '0.00', -- amount
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- Line Items
-CREATE TABLE {prefix}line_items (
- id INT NOT NULL AUTO_INCREMENT,
- invoice INT NOT NULL, -- reference to invoice
- line_item_type INT NOT NULL, -- reference to line item type
- name TEXT NOT NULL, -- line item name
- amount DECIMAL(8,2) DEFAULT '0.00', -- line item amount per item
- quantity INT DEFAULT 1, -- quantity
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- payments
-CREATE TABLE {prefix}payments (
- id INT NOT NULL AUTO_INCREMENT,
- transaction_time DATETIME NOT NULL, -- datetime of payment
- account INT NOT NULL, -- ref to account
- amount DECIMAL(8, 2) NOT NULL, -- payment amount
- payment_method TINYTEXT NOT NULL, -- payment method
- payment_data TINYTEXT NULL, -- additional payment info
- PRIMARY KEY (id)
-);
-
-----
-
--- Notification Types
-CREATE TABLE {prefix}notification_types (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NOT NULL, -- name
- from_header TINYTEXT NOT NULL, -- from headers
- replyto TINYTEXT NULL, -- reply-to headers
- subject TINYTEXT NOT NULL, -- Subject
- message TEXT NOT NULL, -- Message
- send_by_date BOOLEAN NULL DEFAULT '0', -- true/false send by date based on due date
- send_by_action BOOLEAN NULL DEFAULT '0', -- send notice based on an action
- send_action INT NULL DEFAULT 0, -- (create invoice or receive payment)
- send_date_number INT NULL DEFAULT 0, -- number to apply to send by date
- send_date_period INT NULL DEFAULT 0, -- (days,weeks,months,years)
- send_date_when INT NULL DEFAULT 0, -- (before or after)
- PRIMARY KEY (id)
-);
-
-----
-
--- Notifications
-CREATE TABLE {prefix}notifications (
- id INT NOT NULL AUTO_INCREMENT,
- notification_type INT NOT NULL, -- ref to notification type
- account INT NOT NULL, -- ref to account
- from_replyto TINYTEXT NOT NULL, -- from reply-to header
- subject TEXT NOT NULL, -- subject
- message TEXT NOT NULL, -- message
- date_sent DATETIME NOT NULL, -- Date the notice was sent
- email_sent TINYTEXT NOT NULL, -- email used
- PRIMARY KEY (id)
-);
-
-----
-
--- Gateway Settings
-CREATE TABLE {prefix}gateway_settings (
- id INT NOT NULL AUTO_INCREMENT,
- name TEXT NOT NULL,
- login_id TINYTEXT NOT NULL,
- transaction_key TINYTEXT NOT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Settings
-CREATE TABLE {prefix}settings (
- id INT NOT NULL AUTO_INCREMENT,
- company_logo TINYTEXT NULL,
- company_logo_height INT NULL,
- company_name TINYTEXT NULL,
- company_name2 TINYTEXT NULL,
- company_addr1 TINYTEXT NULL,
- company_addr2 TINYTEXT NULL,
- company_city TINYTEXT NULL,
- company_state TINYTEXT NULL,
- company_zip TINYTEXT NULL,
- company_phone TINYTEXT NULL,
- company_email TINYTEXT NULL,
- company_url TINYTEXT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Settings entry
-INSERT INTO {prefix}settings
- ( id )
- VALUES
- ( 1 )
-;
--- /dev/null
+-- Gaslight Media Billing Module
+-- File Created: 11/08/2017
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Billing Accounts
+CREATE TABLE {prefix}accounts (
+ id INT NOT NULL AUTO_INCREMENT,
+ ref_dest INT NOT NULL, -- reference to member id
+ ref_name TINYTEXT NOT NULL, -- Name of reference member
+ anniversary_date DATE NOT NULL, -- anniversary date - used for main invoice generation
+ payment_data TEXT NULL, -- stored payment data
+ email TINYTEXT NULL, -- billing email
+ PRIMARY KEY (id)
+);
+
+----
+
+-- transactions
+CREATE TABLE {prefix}transactions (
+ id INT NOT NULL AUTO_INCREMENT,
+ type INT NOT NULL, -- type of transaction (payment,invoice,etc)
+ type_id INT NOT NULL, -- reference to type id
+ transaction_time DATETIME NOT NULL, -- datetime for the transaction
+ current_invoice_total DECIMAL(8, 2) NOT NULL, -- invoice total
+ current_payment_total DECIMAL(8, 2) NOT NULL, -- payment total
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Invoices
+CREATE TABLE {prefix}invoices (
+ id INT NOT NULL AUTO_INCREMENT,
+ transaction_time DATETIME NOT NULL, -- datetime for the invoice
+ account INT NOT NULL, -- ref to account id
+ amount_total DECIMAL(8, 2) NOT NULL, -- total amount for invoice
+ balance DECIMAL(8, 2) NOT NULL, -- balance for this invoice
+ due_date DATE NOT NULL, -- Due date for this invoice
+ paid BOOLEAN DEFAULT '0', -- true/false if invoice is paid
+ notes TINYTEXT, -- notes for this invoice
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Line Item Types
+CREATE TABLE {prefix}invoice_types (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL, -- name
+ parent INT NOT NULL DEFAULT 0, -- 0 if top level otherwise ref to another line_item_type as it's parent
+ amount DECIMAL(8,2) NOT NULL DEFAULT '0.00', -- amount
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Line Items
+CREATE TABLE {prefix}line_items (
+ id INT NOT NULL AUTO_INCREMENT,
+ invoice INT NOT NULL, -- reference to invoice
+ line_item_type INT NOT NULL, -- reference to line item type
+ name TEXT NOT NULL, -- line item name
+ amount DECIMAL(8,2) DEFAULT '0.00', -- line item amount per item
+ quantity INT DEFAULT 1, -- quantity
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- payments
+CREATE TABLE {prefix}payments (
+ id INT NOT NULL AUTO_INCREMENT,
+ transaction_time DATETIME NOT NULL, -- datetime of payment
+ account INT NOT NULL, -- ref to account table
+ invoice INT NOT NULL, -- ref to an invoice table
+ amount DECIMAL(8, 2) NOT NULL, -- payment amount
+ payment_method TINYTEXT NOT NULL, -- payment method
+ payment_data TINYTEXT NULL, -- additional payment info
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Types
+CREATE TABLE {prefix}notification_types (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL, -- name
+ from_header TINYTEXT NOT NULL, -- from headers
+ replyto TINYTEXT NULL, -- reply-to headers
+ subject TINYTEXT NOT NULL, -- Subject
+ message TEXT NOT NULL, -- Message
+ send_by_date BOOLEAN NULL DEFAULT '0', -- true/false send by date based on due date
+ send_by_action BOOLEAN NULL DEFAULT '0', -- send notice based on an action
+ send_action INT NULL DEFAULT 0, -- (create invoice or receive payment)
+ send_date_number INT NULL DEFAULT 0, -- number to apply to send by date
+ send_date_period INT NULL DEFAULT 0, -- (days,weeks,months,years)
+ send_date_when INT NULL DEFAULT 0, -- (before or after)
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Notifications
+CREATE TABLE {prefix}notifications (
+ id INT NOT NULL AUTO_INCREMENT,
+ notification_type INT NOT NULL, -- ref to notification type
+ account INT NOT NULL, -- ref to account
+ from_replyto TINYTEXT NOT NULL, -- from reply-to header
+ subject TEXT NOT NULL, -- subject
+ message TEXT NOT NULL, -- message
+ date_sent DATETIME NOT NULL, -- Date the notice was sent
+ email_sent TINYTEXT NOT NULL, -- email used
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Gateway Settings
+CREATE TABLE {prefix}gateway_settings (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TEXT NOT NULL,
+ login_id TINYTEXT NOT NULL,
+ transaction_key TINYTEXT NOT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+ id INT NOT NULL AUTO_INCREMENT,
+ company_logo TINYTEXT NULL,
+ company_logo_height INT NULL,
+ company_name TINYTEXT NULL,
+ company_name2 TINYTEXT NULL,
+ company_addr1 TINYTEXT NULL,
+ company_addr2 TINYTEXT NULL,
+ company_city TINYTEXT NULL,
+ company_state TINYTEXT NULL,
+ company_zip TINYTEXT NULL,
+ company_phone TINYTEXT NULL,
+ company_email TINYTEXT NULL,
+ company_url TINYTEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Settings entry
+INSERT INTO {prefix}settings
+ ( id )
+ VALUES
+ ( 1 )
+;
$glmMembersBillingDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 10),
+ '0.0.2' => array('version' => '0.0.2', 'tables' => 10),
);
--- /dev/null
+-- Gaslight Media Billing Database
+-- File Created: 12/07/2017
+-- Database Version: 0.0.2
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separeted by a line with four dashes
+
+-- Add new field for payments table
+ALTER TABLE {prefix}payments ADD invoice INT NOT NULL; -- ref to invoice table
'list' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'invoices' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
),
+ 'member' => array(
+ 'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+ ),
),
'frontActions' => array(
)
--- /dev/null
+{if $fromMemberMenu}
+ {include file='admin/member/header.html'}
+ {include file='admin/billing/memberBillingSubHeader.html'}
+{else}
+ {include file='admin/billing/header.html'}
+{/if}
+
+{if $accountUpdated}<span class="glm-notice glm-flash-updated">Account Updated</span>{/if}
+{if $accountUpdateError}<span class="glm-notice glm-flash-updated">Account Update Error</span>{/if}
+{if $accountInsertError}<span class="glm-notice glm-flash-updated">Account Insert Error</span>{/if}
+{if $accountAdded}<span class="glm-notice glm-flash-updated">Account Added</span>{/if}
+
+<form action="{$thisUrl}?page=glm-members-admin-menu-member" method="post">
+ <input type="hidden" name="page" value="glm-members-admin-menu-member">
+ <input type="hidden" name="glm_action" value="billing">
+ <input type="hidden" name="member" value="{$memberID}">
+ <input type="hidden" name="ref_dest" value="{$memberID}">
+ <input type="hidden" name="option" value="account">
+
+ {if $accountID}
+ <input type="hidden" name="id" value="{$accountID}">
+ {/if}
+
+ <table class="glm-admin-table">
+
+ <tr>
+ <th {if $account.fieldRequired.ref_name} class="glm-required"}{/if}>Name</th>
+ <td {if $account.fieldFail.ref_name}class="glm-form-bad-input" data-tabid="glm-name"{/if}>
+ <input type="text" name="ref_name" value="{$account.fieldData.ref_name}" class="glm-form-text-input-medium">
+ {if $account.fieldFail.ref_name}<p>{$account.fieldFail.ref_name}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $account.fieldRequired.anniversary_date} class="glm-required"}{/if}>Anniversary Date</th>
+ <td {if $account.fieldFail.anniversary_date}class="glm-form-bad-input" data-tabid="glm-anniversary-date"{/if}>
+ <input type="text" name="anniversary_date" value="{$account.fieldData.anniversary_date.date}" class="glm-form-text-input-medium">
+ {if $account.fieldFail.anniversary_date}<p>{$account.fieldFail.anniversary_date}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $account.fieldRequired.email} class="glm-required"}{/if}>Billing Email</th>
+ <td {if $account.fieldFail.email}class="glm-form-bad-input" data-tabid="glm-email"{/if}>
+ <input type="text" name="email" value="{$account.fieldData.email}" class="glm-form-text-input-medium">
+ {if $account.fieldFail.email}<p>{$account.fieldFail.email}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <input class="button button-primary" type="submit" value="{if $haveAccount}Save{else}Create{/if} Account">
+ </td>
+ </tr>
+
+
+ </table>
+</form>
+
+<script>
+jQuery(document).ready(function($){
+
+ // Flash certain elements for a short time after display
+ $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+
+});
+</script>
+
+{include file='admin/footer.html'}
-{include file='admin/billing/header.html'}
+{if $fromMemberMenu}
+ {include file='admin/member/header.html'}
+ {include file='admin/billing/memberBillingSubHeader.html'}
+{else}
+ {include file='admin/billing/header.html'}
+{/if}
<table class="glm-admin-table">
<tr>
--- /dev/null
+<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}"
+ class="nav-tab{if $option == 'list'} nav-tab-active{/if}">Statements</a>
+ <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=billing&member={$memberID}&option=account"
+ class="nav-tab{if $option == 'account'} nav-tab-active{/if}">Account Info</a>
+</h2>