Trying to setup create invoices
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Mar 2018 20:50:15 +0000 (16:50 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 15 Mar 2018 20:50:15 +0000 (16:50 -0400)
Finally got to output the create invoice view file.

models/admin/management/billing.php
models/admin/management/import.php [new file with mode: 0644]
models/admin/management/transfer.php [deleted file]
setup/validActions.php
views/admin/management/createInvoices.html [new file with mode: 0644]
views/admin/management/import.html [deleted file]
views/admin/management/subHeader.html

index 9456246..37c05dd 100644 (file)
@@ -113,6 +113,7 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
         $settingsUpdated     = false;
         $settingsUpdateError = false;
         $regSettings         = false;
+        $view                = 'billing';
 
         // General settings are always stored in a record with ID=1.
         $id = 1;
@@ -132,10 +133,14 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
 
         // Check for submission option
         $option = '';
-        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+        if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
         }
 
+        if ( !isset( $option ) ) {
+            $option = '';
+        }
+
         switch( $option ) {
 
             // Update the settings and redisplay the form
@@ -156,6 +161,10 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
 
                 break;
 
+            case 'createInvoices':
+                $view = 'createInvoices';
+                break;
+
             // Default is to get the current settings and display the form
             default:
 
@@ -188,7 +197,8 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
         $template_data = array(
             'regSettings'         => $regSettings,
             'settingsUpdated'     => $settingsUpdated,
-            'settingsUpdateError' => $settingsUpdateError
+            'settingsUpdateError' => $settingsUpdateError,
+            'option'              => $option,
         );
 
         // echo "<pre>" . print_r($regSettings, true) . "</pre>";
@@ -198,7 +208,7 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
             'status'           => true,
             'menuItemRedirect' => false,
             'modelRedirect'    => false,
-            'view'             => 'admin/management/billing.html',
+            'view'             => 'admin/management/' . $view . '.html',
             'data'             => $template_data
         );
     }
diff --git a/models/admin/management/import.php b/models/admin/management/import.php
new file mode 100644 (file)
index 0000000..3c40dce
--- /dev/null
@@ -0,0 +1,166 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Billing Add-on - Management Billing 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 Billing data abstract
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataManagement.php';
+
+/**
+ * GlmMembersAdmin_management_import
+ *
+ * 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_import // extends GlmDataBillingManagement
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * dbh Postgres database connection
+     *
+     * @var mixed
+     * @access public
+     */
+    public $config;
+    /**
+     * settings used for the schema and tablenames
+     *
+     * @var mixed
+     * @access public
+     */
+//    public $settings = array();
+//    /**
+//     * billing
+//     *
+//     * @var bool
+//     * @access public
+//     */
+//    public $billing = 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;
+        $importResults = importResults;
+
+        // General settings are always stored in a record with ID=1.
+        $id = 1;
+
+        // Determine if current user can import billing
+        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 import.'
+                )
+            );
+        }
+
+        // Check for submission option
+        $option = '';
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $option = $_REQUEST['option'];
+        }
+
+        switch( $option ) {
+
+            // Update the settings and redisplay the form
+            case 'submit':
+
+                break;
+
+            // Default is to get the current settings and display the form
+            default:
+
+                break;
+
+        }
+
+        // Compile template data
+        $template_data = array(
+            'importResults' => $importResults,
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => true,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'admin/management/import.html',
+            'data'             => $template_data
+        );
+    }
+}
+?>
diff --git a/models/admin/management/transfer.php b/models/admin/management/transfer.php
deleted file mode 100644 (file)
index 61fab85..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members DB - Billing Add-on - Management Billing 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 Billing 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_transfer // extends GlmDataBillingManagement
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * dbh Postgres database connection
-     *
-     * @var mixed
-     * @access public
-     */
-    public $config;
-    /**
-     * settings used for the schema and tablenames
-     *
-     * @var mixed
-     * @access public
-     */
-//    public $settings = array();
-//    /**
-//     * billing
-//     *
-//     * @var bool
-//     * @access public
-//     */
-//    public $billing = 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;
-        $importResults = importResults;
-
-        // General settings are always stored in a record with ID=1.
-        $id = 1;
-
-        // Determine if current user can import billing
-        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 import.'
-                )
-            );
-        }
-
-        // Check for submission option
-        $option = '';
-        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
-            $option = $_REQUEST['option'];
-        }
-
-        switch( $option ) {
-
-            // Update the settings and redisplay the form
-            case 'submit':
-
-                break;
-
-            // Default is to get the current settings and display the form
-            default:
-
-                break;
-
-        }
-
-        // Compile template data
-        $template_data = array(
-            'importResults' => $importResults,
-        );
-
-        // Return status, suggested view, and data to controller
-        return array(
-            'status'           => true,
-            'menuItemRedirect' => false,
-            'modelRedirect'    => false,
-            'view'             => 'admin/management/import.html',
-            'data'             => $template_data
-        );
-    }
-}
-?>
index a5fbdb8..c83fa54 100644 (file)
@@ -66,8 +66,7 @@ $glmMembersBillingAddOnValidActions = array(
             'invoiceTypes' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         ),
         'management' => array(
-            'billing'       => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
-            'transfer' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
+            'billing' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
         ),
         'settings' => array(
             'billing'           => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
diff --git a/views/admin/management/createInvoices.html b/views/admin/management/createInvoices.html
new file mode 100644 (file)
index 0000000..a127aea
--- /dev/null
@@ -0,0 +1,8 @@
+{include file='admin/management/header.html'}
+
+{include file='admin/management/subHeader.html'}
+
+<table class="glm-admin-table glm-settings-table">
+</table>
+
+{include file='admin/management/footer.html'}
diff --git a/views/admin/management/import.html b/views/admin/management/import.html
deleted file mode 100644 (file)
index c9227fa..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{include file='admin/management/header.html'}
-
-<table class="glm-admin-table glm-settings-table">
-</table>
-
-{include file='admin/management/footer.html'}
index 9b0d5b8..c46a790 100644 (file)
@@ -1,7 +1,7 @@
 
 <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
     <a href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=billing"
-    class="glm-settings-tab nav-tab nav-tab-active">General Settings</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=transfer"
-    class="glm-settings-tab nav-tab nav-tab-active">Import Billing</a>
+    class="glm-settings-tab nav-tab{if $option == ''} nav-tab-active{/if}">General Settings</a>
+    <a href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=billing&option=createInvoices"
+    class="glm-settings-tab nav-tab{if $option == 'createInvoices'} nav-tab-active{/if}">Create Invoices</a>
 </h2>