Setting up the database and management admin page.
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 20 Nov 2017 21:55:08 +0000 (16:55 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 20 Nov 2017 21:55:08 +0000 (16:55 -0500)
Management is saving the settings. All but the image are being saved.

classes/data/dataManagement.php [new file with mode: 0644]
config/plugin.ini
index.php
misc/documentation/CreateNewAddOn.txt
models/admin/management/billing.php [new file with mode: 0644]
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.1.sql
setup/databaseScripts/dbVersions.php [new file with mode: 0644]
setup/validActions.php
views/admin/management/billing.html [new file with mode: 0644]

diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php
new file mode 100644 (file)
index 0000000..8fa5a42
--- /dev/null
@@ -0,0 +1,244 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Management
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataEvents.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataBillingManagement class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author  Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataBillingManagement extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Data Table Name
+     *
+     * @var $table
+     * @access public
+     */
+    public $table;
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+    /**
+     * MemberInfo DB object
+     *
+     * @var $MemberInfo
+     * @access public
+     */
+    public $MemberInfo;
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config, $limitedEdit = false)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+        if (!$this->wpdb) {
+
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
+
+            // Save plugin configuration object
+            $this->config = $config;
+
+        }
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'management';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field'     => 'id',
+                'type'      => 'integer',
+                'view_only' => true,
+                'use'       => 'a'
+            ),
+
+            // Default Billing Period
+            'billing_period' => array(
+                'field' => 'billing_period',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Default Invoice Date
+            'invoice_date' => array(
+                'field' => 'invoice_date',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Logo for Invioce PDF
+            'company_logo' => array(
+                'field' => 'company_logo',
+                'type'  => 'image',
+                'use'   => 'a'
+            ),
+
+            // Name
+            'company_name' => array(
+                'field' => 'company_name',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Name2
+            'company_name2' => array(
+                'field' => 'company_name2',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Address 1
+            'company_addr1' => array(
+                'field' => 'company_addr1',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Address 2
+            'company_addr2' => array(
+                'field' => 'company_addr2',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // City
+            'company_city' => array(
+                'field' => 'company_city',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // State
+            'company_state' => array (
+                'field'      => 'company_state',
+                'type'       => 'list',
+                'list'       => $this->config['states'],
+                'default'    => 'MI',
+                'force_list' => true,
+                'use'        => 'a'
+            ),
+
+            // Zip
+            'company_zip' => array(
+                'field' => 'company_zip',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Phone
+            'company_phone' => array(
+                'field' => 'company_phone',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // Email
+            'company_email' => array(
+                'field' => 'company_email',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+            // URL
+            'company_url' => array(
+                'field' => 'company_url',
+                'type'  => 'text',
+                'use'   => 'a'
+            ),
+
+         );
+
+    }
+
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each member result and also sort by member name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+        return $r;
+    }
+
+}
+
+?>
index 9222f7e..6789aba 100644 (file)
@@ -2,7 +2,20 @@
 ; Main Configuration File
 ; {descrName}
 ;
-; Place any static configuration parameters here.  
+; Place any static configuration parameters here.
 ;
 
 [common]
+
+; Billing Types
+billingType[1] = "Invoice"
+billingType[2] = "Payment"
+billingType[3] = "Adjustment"
+billingType[4] = "Comment"
+
+; Payment Method
+paymentMethod[1] = "Check"
+paymentMethod[2] = "Credit Card"
+paymentMethod[3] = "Cash"
+paymentMethod[4] = "Other"
+
index adf2a87..b1ece21 100644 (file)
--- a/index.php
+++ b/index.php
@@ -144,9 +144,9 @@ if (is_file(GLM_MEMBERS_BILLING_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
 
 // Load Add-On Management Settings data
 /* None - Need to figure out a smooth way to do this.
+*/
 $glmMembersBillingManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
 unset($glmMembersBillingManagementSettings['id']);
-*/
 
 function glmMembersBillingRegisterAddOn($addOns) {
 
@@ -158,6 +158,7 @@ function glmMembersBillingRegisterAddOn($addOns) {
         'slug' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         'actions' => $GLOBALS['glmMembersBillingAddOnValidActions'],
         'config' => array(
+            'settings' => $GLOBALS['glmMembersBillingManagementSettings']
         ),
         'shortcodes' => $GLOBALS['glmMembersBillingShortcodes'],
         'shortcodesDescription' => $GLOBALS['glmMembersBillingShortcodesDescription']
index b93235f..6da654c 100644 (file)
@@ -3,13 +3,13 @@ Procedure to create a new GLM Members add-on plugin
 
 * Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name}
 
-* From a bash prompt, run "SETUP_SCRIPT" 
+* From a bash prompt, run "SETUP_SCRIPT"
 
 * Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git
 
 * If there are any databases associated with this add-on, setup the database scripts and
   data under the "setup/databaseScripts" directory. If there are no database tables
-  with this add-on, remove all but the "readme.txt" file from that directory. 
+  with this add-on, remove all but the "readme.txt" file from that directory.
   NOTE: No "update_database..." files should be there for a new add-on with new tables.
   NOTE: There should be only one entry in the "dbVersions.php" file.
 
@@ -24,7 +24,7 @@ Procedure to create a new GLM Members add-on plugin
 
 * Adding menus
     - Update "setup/adminMenus.php" and add menu section as described there.
-    - Add an entry in the validActions.php file. Pay attention to how slug name is 
+    - Add an entry in the validActions.php file. Pay attention to how slug name is
       constructed ("glm-members-admin-{page}-{action}").
     - If needed add a database table to the create_database_V...sql file
       Also add a "classes/data/data{Table}.php file
@@ -33,10 +33,10 @@ Procedure to create a new GLM Members add-on plugin
         Note that additional possible view files should be named as...
             "views/admin/{page}/{action}{Name}.html
     - Test that when add-on is activated that the menu shows and is functional.
-    
+
 * Adding tabs
-    - Update "setup/admin/Tabs.php" and add new tab filter as described there.
-    - Add an entry in the validActions.php file. Pay attention to how slug name is 
+    - Update "setup/adminTabs.php" and add new tab filter as described there.
+    - Add an entry in the validActions.php file. Pay attention to how slug name is
       constructed ("glm-members-admin-{page}-{action}").
     - If needed add a database table to the create_database_V...sql file
       Also add a "classes/data/data{Table}.php file
@@ -45,5 +45,5 @@ Procedure to create a new GLM Members add-on plugin
         Note that additional possible view files should be named as...
             "views/admin/{page}/{action}{Name}.html
     - Test that when add-on is activated that the tab shows and is functional.
-    
- * 
\ No newline at end of file
+
+ *
diff --git a/models/admin/management/billing.php b/models/admin/management/billing.php
new file mode 100644 (file)
index 0000000..4608791
--- /dev/null
@@ -0,0 +1,195 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Events Add-on - Management Events Tab
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author     Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  billing.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Management Events data abstract
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataManagement.php';
+
+/**
+ * GlmMembersAdmin_management_billing
+ *
+ * PHP version 5
+ *
+ * @category Model
+ * @package GLM Member DB
+ * @author    Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *            @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
+ *            Exp $
+ */
+class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * dbh Postgres database connection
+     *
+     * @var mixed
+     * @access public
+     */
+    public $dbh;
+    /**
+     * settings used for the schema and tablenames
+     *
+     * @var mixed
+     * @access public
+     */
+    public $settings = array();
+
+    /**
+     * 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(false, false);
+
+    }
+
+    /**
+     * modelAction
+     *
+     * @param bool $actionData
+     * @access public
+     * @return void
+     */
+    public function modelAction($actionData = false)
+    {
+
+        $option                = false;
+        $settings_updated      = false;
+        $settings_update_error = false;
+        $billing_settings      = false;
+        $option2               = false;
+
+        if (isset($_REQUEST['option'])) {
+            $option = $_REQUEST['option'];
+        }
+
+        switch ($option) {
+
+            case 'settings':
+
+            default:
+
+                // Make sure option is set if default
+                $option = 'settings';
+
+                // Determine if current user can edit configurations
+                if (!current_user_can('glm_members_management')) {
+                    return array(
+                        'status'           => false,
+                        'menuItemRedirect' => 'error',
+                        'modelRedirect'    => 'index',
+                        'view'             => 'admin/error/index.html',
+                        'data'             => array(
+                            'reason' => 'User does not have rights to make configuration changes.'
+                        )
+                    );
+                }
+
+                // Check for submission option
+                $option2 = '';
+                if (isset($_REQUEST['option2'])) {
+                    $option2 = $_REQUEST['option2'];
+                }
+
+                switch($option2) {
+
+                    // Update the settings and redisplay the form
+                    case 'submit':
+
+                        // Update the billing management settings
+                        $billing_settings = $this->updateEntry(1);
+                        if ($billing_settings['status']) {
+                            $settings_updated = true;
+                        } else {
+                            $settings_update_error = true;
+                        }
+
+                        break;
+
+                    // Default is to get the current settings and display the form
+                    default:
+
+                        // Try to get the first (should be only) entry for general settings.
+                        $billing_settings = $this->editEntry(1);
+                        // echo '<pre>$billing_settings: ' . print_r( $billing_settings, true ) . '</pre>';
+
+                        break;
+
+                }
+
+                break;
+
+        }
+
+        // Compile template data
+        $template_data = array(
+            'option'              => $option,
+            'settingsUpdated'     => $settings_updated,
+            'settingsUpdateError' => $settings_update_error,
+            'billingSettings'    => $billing_settings,
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => true,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'admin/management/billing.html',
+            'data'             => $template_data
+        );
+
+
+    }
+
+
+}
+
index e457b40..3b0bd62 100644 (file)
  * );
  *
  */
-
+if ( current_user_can( 'glm_members_members' ) ) {
+    add_filter( 'glm-member-db-add-tab-for-management',
+        function( $addOnTabs ) {
+            $newTabs = array(
+                array(
+                    'text'   => 'Billing',
+                    'menu'   => 'management',
+                    'action' => 'billing',
+                )
+            );
+            $addOnTabs = array_merge( $addOnTabs, $newTabs );
+            return $addOnTabs;
+        }
+    );
+}
index fdb8a54..dca366c 100644 (file)
@@ -27,21 +27,21 @@ CREATE TABLE {prefix}transactions (
     paid BOOLEAN DEFAULT '0',
     invoice TEXT,
     notes TINYTEXT,
-    PRIMARY_KEY (id)
+    PRIMARY KEY (id)
 );
 
 ----
 
 -- payment_types
 CREATE TABLE {prefix}payment_types (
-    id INT _NOT NULL AUTO_INCREMENT,
+    id INT NOT NULL AUTO_INCREMENT,
     name TINYTEXT NOT NULL,
-    qcode INT,
+    qcode INT NULL,
     category TEXT NOT NULL,
     amount DECIMAL(8, 2),
-    notes TINYTEXT,
+    notes TINYTEXT NULL,
     dynamic_amount BOOLEAN DEFAULT '0',
-    PRIMARY_KEY (id)
+    PRIMARY KEY (id)
 );
 
 ----
@@ -49,10 +49,46 @@ CREATE TABLE {prefix}payment_types (
 -- ref_account
 CREATE TABLE {prefix}ref_account (
     id INT NOT NULL AUTO_INCREMENT,
+    ref_type INT NOT NULL,
     ref_dest INT NOT NULL,
     payment_type INT NOT NULL,
-    email_invoice BOOLEAN DEFAULT '0',
-    usmail_invoice BOOLEAN DEFAULT '0',
-    fax_invoice BOOLEAN DEFAULT '0',
-    PRIMARY_KEY (id)
+    billing_period TINYTEXT NOT NULL,
+    invoice_date DATE NOT NULL,
+    processed_date DATE NOT NULL,
+    notification_pref TINYTEXT NULL,
+    PRIMARY KEY (id),
+    INDEX(ref_type),
+    INDEX(ref_dest),
+    INDEX(payment_type)
+);
+
+----
+
+-- Management Options
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    billing_period TINYTEXT NOT NULL,
+    invoice_date DATE NOT NULL,
+    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 management entry
+INSERT INTO {prefix}management
+    ( id )
+    VALUES
+    ( 1 )
+;
diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php
new file mode 100644 (file)
index 0000000..5aaba3f
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Billing DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+$glmMembersBillingDbVersions = array(
+    '0.0.1' => array('version' => '0.0.1', 'tables' => 4),
+);
+
index 46509a2..7f31196 100644 (file)
 
 $glmMembersBillingAddOnValidActions = array(
     'adminActions' => array(
+        'management' => array(
+            'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+        ),
     ),
     'frontActions' => array(
     )
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/views/admin/management/billing.html b/views/admin/management/billing.html
new file mode 100644 (file)
index 0000000..4ab8123
--- /dev/null
@@ -0,0 +1,170 @@
+{include file='admin/management/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>
+
+    <!-- Management 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>
+            </td>
+        </tr>
+        <tr>
+            <td>
+                <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                    <input type="hidden" name="glm_action" value="billing">
+                    <input type="hidden" name="option" value="settings">
+                    <input type="hidden" name="option2" value="submit">
+                    <table class="glm-admin-table">
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.billing_period} class="glm-required"}{/if}>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 {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}>
+                                <table class="glm-admin-image-edit-table">
+                                    {if $billingSettings.fieldData.company_logo}
+                                        <tr>
+                                            <td>
+                                                <div class="glm-galleryImage" data-id="glm-co-logo">
+                                                    <img src="{$glmPluginMediaUrl}/images/small/{$billingSettings.fieldData.company_logo}">
+                                                </div>
+                                            </td>
+                                            <td>
+                                                <input type="checkbox" name="company_logo" > Delete Image<br>
+                                                {$billingSettings.fieldData.company_logo}<br>
+                                            </td>
+                                        </tr>
+                                    {/if}
+                                    <tr><td colspan="2"><b>New image:</b> <input type="file" name="company_logo"></td></tr>
+                                </table>
+                                <div id="glm-company-logoLarger_logo" class="glm-imageDialog">
+                                    <img src="{$glmPluginMediaUrl}/images/large/{$billingSettings.fieldData.company_logo}">
+                                </div>
+                                {if $billingSettings.fieldFail.company_logo}<p>{$billingSettings.fieldFail.company_logo}{/if}
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_name} class="glm-required"}{/if}>Company Name</th>
+                            <td {if $billingSettings.fieldFail.company_name}class="glm-form-bad-input" data-tabid="glm-company-name"{/if}>
+                                <input type="text" name="company_name" value="{$billingSettings.fieldData.company_name}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_name}<p>{$billingSettings.fieldFail.company_name}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_name2} class="glm-required"}{/if}>Company Name 2</th>
+                            <td {if $billingSettings.fieldFail.company_name2}class="glm-form-bad-input" data-tabid="glm-company-name2"{/if}>
+                                <input type="text" name="company_name2" value="{$billingSettings.fieldData.company_name2}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_name2}<p>{$billingSettings.fieldFail.company_name2}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_addr1} class="glm-required"}{/if}>Company Address 1</th>
+                            <td {if $billingSettings.fieldFail.company_addr1}class="glm-form-bad-input" data-tabid="glm-company-addr1"{/if}>
+                                <input type="text" name="company_addr1" value="{$billingSettings.fieldData.company_addr1}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_addr1}<p>{$billingSettings.fieldFail.company_addr1}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_addr2} class="glm-required"}{/if}>Company Address 2</th>
+                            <td {if $billingSettings.fieldFail.company_addr2}class="glm-form-bad-input" data-tabid="glm-company-addr2"{/if}>
+                                <input type="text" name="company_addr2" value="{$billingSettings.fieldData.company_addr2}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_addr2}<p>{$billingSettings.fieldFail.company_addr2}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_city} class="glm-required"}{/if}>Company City</th>
+                            <td {if $billingSettings.fieldFail.company_city}class="glm-form-bad-input" data-tabid="glm-company-city"{/if}>
+                                <input type="text" name="company_city" value="{$billingSettings.fieldData.company_city}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_city}<p>{$billingSettings.fieldFail.company_city}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_state} class="glm-required"}{/if}>Company State</th>
+                            <td {if $billingSettings.fieldFail.company_state}class="glm-form-bad-input" data-tabid="glm-company-state"{/if}>
+                                <select name="company_state">
+                                    <option value=""></option>
+                                    {foreach from=$billingSettings.fieldData.company_state.list item=v}
+                                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                                            {$v.name}
+                                        </option>
+                                    {/foreach}
+                                </select>
+                            {if $billingSettings.fieldFail.company_state}<p>{$billingSettings.fieldFail.company_state}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_zip} class="glm-required"}{/if}>Company Zip</th>
+                            <td {if $billingSettings.fieldFail.company_zip}class="glm-form-bad-input" data-tabid="glm-company-zip"{/if}>
+                                <input type="text" name="company_zip" value="{$billingSettings.fieldData.company_zip}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_zip}<p>{$billingSettings.fieldFail.company_zip}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_phone} class="glm-required"}{/if}>Company Phone</th>
+                            <td {if $billingSettings.fieldFail.company_phone}class="glm-form-bad-input" data-tabid="glm-company-phone"{/if}>
+                                <input type="text" name="company_phone" value="{$billingSettings.fieldData.company_phone}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_phone}<p>{$billingSettings.fieldFail.company_phone}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_email} class="glm-required"}{/if}>Company Email</th>
+                            <td {if $billingSettings.fieldFail.company_email}class="glm-form-bad-input" data-tabid="glm-company-email"{/if}>
+                                <input type="text" name="company_email" value="{$billingSettings.fieldData.company_email}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_email}<p>{$billingSettings.fieldFail.company_email}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+                        <tr>
+                            <th {if $billingSettings.fieldRequired.company_url} class="glm-required"}{/if}>Company URL</th>
+                            <td {if $billingSettings.fieldFail.company_url}class="glm-form-bad-input" data-tabid="glm-company-url"{/if}>
+                                <input type="text" name="company_url" value="{$billingSettings.fieldData.company_url}" class="glm-form-text-input-short">
+                            {if $billingSettings.fieldFail.company_url}<p>{$billingSettings.fieldFail.company_url}</p>{/if}<br>
+                            </td>
+                        </tr>
+
+
+                    </table>
+                    <input type="submit" value="Update Settings" class="button-primary">
+                </form>
+            </td>
+        </tr>
+    </table>
+
+    <script type="text/javascript">
+
+        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).fadeIn(500).fadeOut(500);
+
+        });
+    </script>