Update the management into settings.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 21 Nov 2017 19:05:50 +0000 (14:05 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 21 Nov 2017 19:05:50 +0000 (14:05 -0500)
Adding two new fields for from and message for notifications.

classes/data/dataManagement.php [deleted file]
classes/data/dataSettings.php [new file with mode: 0644]
index.php
models/admin/management/billing.php [deleted file]
models/admin/settings/billing.php [new file with mode: 0644]
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.1.sql
setup/validActions.php
views/admin/management/billing.html [deleted file]
views/admin/settings/billing.html [new file with mode: 0644]

diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php
deleted file mode 100644 (file)
index 8fa5a42..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-<?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;
-    }
-
-}
-
-?>
diff --git a/classes/data/dataSettings.php b/classes/data/dataSettings.php
new file mode 100644 (file)
index 0000000..6063294
--- /dev/null
@@ -0,0 +1,258 @@
+<?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 GlmDataBillingSettings 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 . 'settings';
+
+        /*
+         * 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',
+            ),
+
+            // Notification From Email
+            'notification_from' => array(
+                'field' => 'notification_from',
+                'type'  => 'text',
+                'use'   => 'a',
+            ),
+
+            // Notification Message
+            'notification_message' => array(
+                'field' => 'notification_message',
+                '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 b1ece21..f6d22f2 100644 (file)
--- a/index.php
+++ b/index.php
@@ -145,8 +145,8 @@ 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']);
+$glmMembersBillingSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX."settings WHERE id = 1", ARRAY_A );
+unset($glmMembersBillingSettings['id']);
 
 function glmMembersBillingRegisterAddOn($addOns) {
 
@@ -158,7 +158,7 @@ function glmMembersBillingRegisterAddOn($addOns) {
         'slug' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         'actions' => $GLOBALS['glmMembersBillingAddOnValidActions'],
         'config' => array(
-            'settings' => $GLOBALS['glmMembersBillingManagementSettings']
+            'settings' => $GLOBALS['glmMembersBillingSettings']
         ),
         'shortcodes' => $GLOBALS['glmMembersBillingShortcodes'],
         'shortcodesDescription' => $GLOBALS['glmMembersBillingShortcodesDescription']
diff --git a/models/admin/management/billing.php b/models/admin/management/billing.php
deleted file mode 100644 (file)
index 4608791..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-<?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
-        );
-
-
-    }
-
-
-}
-
diff --git a/models/admin/settings/billing.php b/models/admin/settings/billing.php
new file mode 100644 (file)
index 0000000..faf3ad8
--- /dev/null
@@ -0,0 +1,197 @@
+<?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/dataSettings.php';
+
+/**
+ * GlmMembersAdmin_settings_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_settings_billing extends GlmDataBillingSettings
+{
+
+    /**
+     * 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;
+        $enable_members        = $this->config['settings']['enable_members'];
+
+        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 settings 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(
+            'enable_members'      => $enable_members,
+            '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/settings/billing.html',
+            'data'             => $template_data
+        );
+
+
+    }
+
+
+}
+
index 3b0bd62..220d203 100644 (file)
  *
  */
 if ( current_user_can( 'glm_members_members' ) ) {
-    add_filter( 'glm-member-db-add-tab-for-management',
+    add_filter( 'glm-member-db-add-tab-for-settings',
         function( $addOnTabs ) {
             $newTabs = array(
                 array(
                     'text'   => 'Billing',
-                    'menu'   => 'management',
+                    'menu'   => 'settings',
                     'action' => 'billing',
                 )
             );
index dca366c..09ae3a9 100644 (file)
@@ -65,7 +65,7 @@ CREATE TABLE {prefix}ref_account (
 ----
 
 -- Management Options
-CREATE TABLE {prefix}management (
+CREATE TABLE {prefix}settings (
     id INT NOT NULL AUTO_INCREMENT,
     billing_period TINYTEXT NOT NULL,
     invoice_date DATE NOT NULL,
@@ -81,13 +81,15 @@ CREATE TABLE {prefix}management (
     company_phone TINYTEXT NULL,
     company_email TINYTEXT NULL,
     company_url TINYTEXT NULL,
+    notification_from TINYTEXT NULL,
+    notification_message TEXT NULL,
     PRIMARY KEY (id)
 );
 
 ----
 
--- Set default billing management entry
-INSERT INTO {prefix}management
+-- Set default billing settings entry
+INSERT INTO {prefix}settings
     ( id )
     VALUES
     ( 1 )
index 7f31196..a207c60 100644 (file)
@@ -59,7 +59,7 @@
 
 $glmMembersBillingAddOnValidActions = array(
     'adminActions' => array(
-        'management' => array(
+        'settings' => array(
             'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         ),
     ),
diff --git a/views/admin/management/billing.html b/views/admin/management/billing.html
deleted file mode 100644 (file)
index 7cfc849..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-{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}>
-                                {if $billingSettings.fieldData.company_logo}
-                                    <img src="{$glmPluginMediaUrl}/images/small/{$billingSettings.fieldData.company_logo}">
-                                    <input type="checkbox" name="company_logo_delete" > Delete Image<br>
-                                    {$billingSettings.fieldData.company_logo}<br>
-                                {/if}
-                                <b>New image:</b> <input type="file" name="company_logo_new">
-                                <div style="color: green;">Need to update the text here for best logo size (w X h)</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>
diff --git a/views/admin/settings/billing.html b/views/admin/settings/billing.html
new file mode 100644 (file)
index 0000000..67124b4
--- /dev/null
@@ -0,0 +1,183 @@
+{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>
+
+    <!-- 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 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}>
+                                {if $billingSettings.fieldData.company_logo}
+                                    <img src="{$glmPluginMediaUrl}/images/small/{$billingSettings.fieldData.company_logo}">
+                                    <input type="checkbox" name="company_logo_delete" > Delete Image<br>
+                                    {$billingSettings.fieldData.company_logo}<br>
+                                {/if}
+                                <b>New image:</b> <input type="file" name="company_logo_new">
+                                <div style="color: green;">Need to update the text here for best logo size (w X h)</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>
+{include file='admin/footer.html'}