Completed processing at checkout - A few minor things to complete related to checkout.
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 10 Nov 2017 20:57:05 +0000 (15:57 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 10 Nov 2017 20:57:05 +0000 (15:57 -0500)
Cleaned up some issues with password and login and fixed duplicating accounts and requests.
Built checkout summary and summary page.
Updated database to store more infomration at checkout.

24 files changed:
classes/data/dataRegRequest.php
config/plugin.ini
defines.php
index.php
models/admin/ajax/account.php
models/admin/ajax/regFront/account.php
models/admin/ajax/summaryContent.php [new file with mode: 0644]
models/admin/registrations/accounts.php
models/front/registrations/checkout.php
models/front/registrations/checkoutProcess.php
models/front/registrations/login.php
models/front/registrations/register.php
models/front/registrations/summary.php
setup/databaseScripts/create_database_V0.0.17.sql [deleted file]
setup/databaseScripts/create_database_V0.0.18.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/drop_database_V0.0.17.sql [deleted file]
setup/databaseScripts/drop_database_V0.0.18.sql [new file with mode: 0644]
setup/databaseScripts/update_database_V0.0.18.sql [new file with mode: 0644]
setup/validActions.php
views/front/registrations/checkout.html
views/front/registrations/list.html
views/front/registrations/summary.html
views/front/registrations/summaryStore.html [new file with mode: 0644]

index fe1eec1..b7a508b 100644 (file)
@@ -239,6 +239,20 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract
                 'use'       => 'a'
             ),
 
+            //
+            'bill_phone' => array (
+                'field'     => 'bill_phone',
+                'type'      => 'text',
+                'use'       => 'a'
+            ),
+
+            //
+            'bill_email' => array (
+                'field'     => 'bill_email',
+                'type'      => 'text',
+                'use'       => 'a'
+            ),
+
             //
             'date_submitted' => array (
                 'field'     => 'date_submitted',
@@ -255,13 +269,6 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract
                 'use'       => 'a'
             ),
 
-            // Pointer to user account (table: account) who submitted the registrations
-            'payment_code' => array (
-                'field'     => 'payment_code',
-                'type'      => 'text',
-                'use'       => 'lgneud'
-            ),
-
             // See submission_status in plugin.ini
            'status' => array (
                 'field'     => 'status',
@@ -278,6 +285,20 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract
                 'use'       => 'a'
             ),
 
+            // Total discounts
+            'total_discounts' => array (
+                'field'     => 'total_discounts',
+                'type'      => 'money',
+                'use'       => 'a'
+            ),
+
+            // Total registrants
+            'registrants' => array (
+                'field'     => 'registrants',
+                'type'      => 'integer',
+                'use'       => 'a'
+            ),
+
             // Credit Card type (if used) - See credit_card in plugin.ini
             'cc_type' => array (
                 'field'     => 'cc_type',
@@ -322,6 +343,13 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract
                 'use'       => 'a'
             ),
 
+            // Message received from payment processor
+            'cc_proc_mesg' => array (
+                'field'     => 'cc_proc_mesg',
+                'type'      => 'text',
+                'use'       => 'a'
+            ),
+
             // HTML summary of cart contents, costs and payment - Use same HTML displayed to user
             'summary' => array (
                 'field'     => 'summary',
index a39400d..49019dd 100644 (file)
@@ -147,6 +147,25 @@ proc_test_mode_numb['Local Decline Test']       =  2
 proc_test_mode_numb['On-Line Test']             =  3
 proc_test_mode_numb['Production Mode']          =  0
 
+;
+; Card processor result codes
+;
+proc_result[1]                                  = 'Card approved'
+proc_result[2]                                  = 'Bad data supplied to credit card processor'
+proc_result[3]                                  = 'Communications failure with credit card processor'
+proc_result[4]                                  = 'Bad response from the credit card processor'
+proc_result[5]                                  = 'Credit card processor says transaction is not valid'
+proc_result[6]                                  = 'Merchant account is not recognized by the credit card processor'
+proc_result[7]                                  = 'Credit card has been declined'
+
+proc_result_numb['Approved']                    = 1
+proc_result_numb['BadData']                     = 2
+proc_result_numb['CommFailure']                 = 3
+proc_result_numb['BadResponse']                 = 4
+proc_result_numb['NotValid']                    = 5
+proc_result_numb['BadAccount']                  = 6
+proc_result_numb['Declined']                    = 7
+
 ;
 ; Billing Field - Use as Bitmap Index only
 ;
@@ -180,34 +199,26 @@ billing_field_numb['FAX']                       = 12
 ; Submission Status - Use as list only
 ;
 submission_status[0]                            = 'CART'
-submission_status[10]                           = 'UNPAID'
-submission_status[20]                           = 'CC_PEND'
-submission_status[30]                           = 'CC_PAID'
+submission_status[10]                           = 'COMPLETE'
+submission_status[20]                           = 'UNPAID'
+submission_status[30]                           = 'CC_PEND'
 submission_status[40]                           = 'CC_DECL'
 submission_status[50]                           = 'CHECK_PEND'
-submission_status[60]                           = 'CHECK_PAID'
-submission_status[70]                           = 'COMP'
-submission_status[80]                           = 'AT_EVENT'
-submission_status[90]                           = 'CASH_PAID'
-submission_status[100]                          = 'NO_CHARGE'
-submission_status[110]                          = 'OTHER_ADMIN'
-submission_status[120]                          = 'FAILED'
-submission_status[130]                          = 'CANCELED'
+submission_status[60]                           = 'AT_EVENT'
+submission_status[70]                           = 'ADMIN HOLD'
+submission_status[80]                           = 'FAILED'
+submission_status[99]                           = 'CANCELED'
 
 submission_status_numb['CART']                  = 0
-submission_status_numb['UNPAID']                = 10
-submission_status_numb['CC_PEND']               = 20
-submission_status_numb['CC_PAID']               = 30
+submission_status_numb['COMPLETE']              = 10
+submission_status_numb['UNPAID']                = 20
+submission_status_numb['CC_PEND']               = 30
 submission_status_numb['CC_DECL']               = 40
 submission_status_numb['CHECK_PEND']            = 50
-submission_status_numb['CHECK_PAID']            = 60
-submission_status_numb['COMP']                  = 70
-submission_status_numb['AT_EVENT']              = 80
-submission_status_numb['CASH_PAID']             = 90
-submission_status_numb['NO_CHARGE']             = 100
-submission_status_numb['OTHER_ADMIN']           = 110
-submission_status_numb['FAILED']                = 120
-submission_status_numb['CANCELED']              = 130
+submission_status_numb['AT_EVENT']              = 60
+submission_status_numb['ADMIN_HOLD']            = 70
+submission_status_numb['FAILED']                = 80
+submission_status_numb['CANCELED']              = 99
 
 ;
 ; Additional Information Field Types
index 29b717b..abd0fa5 100644 (file)
@@ -72,4 +72,7 @@ define('GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIO
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/lib');
 
 // Update Server
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
\ No newline at end of file
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server');
+
+// Security Secret
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET', 'reGS3creTt!4THis');
\ No newline at end of file
index 01c8305..ff1b589 100644 (file)
--- a/index.php
+++ b/index.php
@@ -44,10 +44,10 @@ if (!defined('ABSPATH')) {
  *  version from this plugin.
  */
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.17');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.18');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.10');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.17');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
 if (GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION != get_option('glmMembersRegistrationsPluginVersion')) {
index f5e6482..962cff2 100644 (file)
@@ -122,7 +122,7 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount
                         'date_created' => date('Y-m-d'),
                         'active'       => 1,
                         'email'        => $email,
-                        'password'     => crypt( $password ),
+                        'password'     => password_hash($password, PASSWORD_DEFAULT),
                         'fname'        => $fname,
                         'lname'        => $lname,
                         'addr1'        => $addr1,
@@ -176,9 +176,12 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount
             break;
 
         case 'login':
+
+            // Get clean username (E-Mail address) and password
             $username = filter_var( $_REQUEST['username'], FILTER_SANITIZE_STRING );
             $password = filter_var( $_REQUEST['password'], FILTER_SANITIZE_STRING );
-            // Check accounts for ones that match
+
+            // Get the password from the matching user account (same E-Mail address)
             $returnData = $this->wpdb->get_row(
                 $this->wpdb->prepare(
                     "SELECT id,password,fname,lname
@@ -189,26 +192,41 @@ class GlmMembersAdmin_ajax_account extends GlmDataRegistrationsAccount
                 ),
                 ARRAY_A
             );
-            $returnPassword = $returnData['password'];
-            $returnId       = $returnData['id'];
-            if ( $returnPassword == crypt( $password, $returnPassword ) ) {
-                $return = array(
-                    'valid' => true,
-                    'email' => $username,
-                    'id'    => $returnId,
-                    'fname' => $returnData['fname'],
-                    'lname' => $returnData['lname'],
-                );
-                // Add the user to the php session
-                $_SESSION['LoginAccount'] = array(
-                    'id'    => $returnId,
-                    'email' => $username,
-                    'fname' => $returnData['fname'],
-                    'lname' => $returnData['lname'],
-                );
+
+            if ($this->wpdb->last_error || $returnData == NULL) {
+                $message = 'Login Fail';
             } else {
-                $return = array( 'valid' => false );
+
+                // Get the hashed password and ID from the user account
+                $returnPassword = $returnData['password'];
+                $returnId       = $returnData['id'];
+
+                // Check to see if the sumbitted password matches the hashed password
+                if ( hash_equals( $password, $returnPassword ) ) {
+
+                    // Build return data for logged in account
+                    $return = array(
+                        'valid' => true,
+                        'email' => $username,
+                        'id'    => $returnId,
+                        'fname' => $returnData['fname'],
+                        'lname' => $returnData['lname'],
+                    );
+
+                    // Add the user to the php session
+                    $_SESSION['LoginAccount'] = array(
+                        'id'    => $returnId,
+                        'email' => $username,
+                        'fname' => $returnData['fname'],
+                        'lname' => $returnData['lname'],
+                    );
+
+                } else {
+                    $return = array( 'valid' => false );
+                }
+
             }
+
             break;
 
         case 'checkEmail':
index eef6857..8b47b00 100644 (file)
@@ -81,8 +81,6 @@ class GlmMembersAdmin_registrations_ajax_account extends GlmDataRegistrationsReg
     public function modelAction($modelData)
     {
 
-trigger_error(print_r($modelData,1));
-
         if ( !isset( $modelData['option'] ) ) {
             $option = null;
         } else {
diff --git a/models/admin/ajax/summaryContent.php b/models/admin/ajax/summaryContent.php
new file mode 100644 (file)
index 0000000..b5c5b37
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Display summary data ONLY
+ * Used for display in an iframe
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  summary.php,v 1.0 2017/11/10 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
+
+ class GlmMembersAdmin_ajax_summaryContent extends GlmDataRegistrationsRegRequest {
+    /**
+    * WordPress Database Object
+    *
+    * @var $wpdb
+    * @access public
+    */
+    public $wpdb;
+    /**
+    * Plugin Configuration Data
+    *
+    * @var $config
+    * @access public
+    */
+    public $config;
+    /**
+     * 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 modelAction($actionData = false)
+    {
+
+        $haveRequest = false;
+
+        // Get the reg_request ID
+        if (!isset($_REQUEST['request'])) {
+            wp_die();
+        }
+        $requestId = ($_REQUEST['request'] - 0);
+        if ($requestId <= 0) {
+            wp_die();
+        }
+
+        // Try to get the request content
+        if ($requestId > 0) {
+            $request = $this->getEntry($requestId);
+        }
+
+        if (!$request) {
+            wp_die();
+        }
+
+        // Get the check code
+        if (!isset($_REQUEST['check'])) {
+            wp_die();
+        }
+        $check = $_REQUEST['check'];
+
+        // Make sure the check code matches
+        $md5 = md5($requestId.GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET.$request['account']);
+        if ($md5 != $check) {
+            wp_die();
+        }
+
+        echo $request['summary'];
+
+        wp_die();
+
+    }
+ }
index edd3c28..6433ce0 100644 (file)
@@ -165,17 +165,18 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             $account = $this->updateEntry( $accountID );
 
             if ( $account['status'] ) {
-                //echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+
                 $accountUpdated = true;
+
                 // Retrieve the Edit Entry again
                 $account = $this->editEntry( $accountID );
-                if ( $account['status'] ) {
-                    $haveAccount = true;
-                }
+
             } else {
                 $accountUpdateError = true;
             }
 
+            $haveAccount = true;
+
             $view = 'accountEdit';
             break;
 
index f50cf23..b9f08b5 100644 (file)
@@ -58,6 +58,16 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
         $payMethod      = false;
         $compCode       = false;
 
+        wp_register_script(
+            'glm-members-admin-maskedinput',
+            GLM_MEMBERS_PLUGIN_JS_URL . '/jquery.maskedinput-1.2.2.js',
+            array(
+                'jquery'
+            ),
+            GLM_MEMBERS_PLUGIN_VERSION
+            );
+        wp_enqueue_script('glm-members-admin-maskedinput');
+
         $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
 
         // Check if we received any messages during a redirect
@@ -227,7 +237,12 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
         $Management = new GlmDataRegistrationsManagement($this->wpdb, $this->config);
         $management = $Management->getEntry(1);
 
-        // Compile template data
+        // Get misc texts
+        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataMisc.php';
+        $Misc = new GlmDataRegistrationsMisc($this->wpdb, $this->config);
+        $misc = $Misc->getEntry(1);
+
+                // Compile template data
         $templateData = array(
             'page'          => 'checkout',
             'regAccountId'  => $this->cart['request']['account'],
@@ -243,7 +258,8 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
             'messages'      => $messages,
             'payMethod'     => $payMethod,
             'payMethods'    => $management['reg_payment_methods']['bitmap'],
-            'payMethodsNumb' => $this->config['payment_method_numb']
+            'payMethodsNumb' => $this->config['payment_method_numb'],
+            'misc'          => $misc
         );
 
         // echo "<pre>".print_r($templateData,1)."</pre>";
index 60b0bc6..c028f35 100644 (file)
@@ -87,9 +87,9 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
     {
 
         $messages       = array();
-        $haveCheckout   = false;
+        $cartStatus     = 0;            // Default to CART
         $requestId      = false;
-        $accountId      = false;
+        $accountId      = 0;
         $regAccount     = false;
         $modelRedirect  = false;
         $view           = 'checkout';
@@ -99,8 +99,12 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
         $regPayment     = false;
         $cardData       = false;
         $cardTypeMatch  = false;
+        $billing        = false;
+        $payment        = false;
+        $ccConfirmation = '';
 
         $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
+        $Request = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
 
         /*
          * Valid cart?
@@ -152,11 +156,18 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
             // Otherwise this is a guest so try to create the account using the submitted data
             } else {
+
+                // Create the new account
                 $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
                 $regAccount = $Account->insertEntry();
-                if (!$regAccount) {
+
+                // If that was successful
+                if ($regAccount) {
+                    $accountId = $regAccount['fieldData']['id'];
+                } else {
                     $messages[] = 'Unable to create a guest account for this request. Please try again later.';
                 }
+
             }
 
             // Check if there were any problems with the account information sumbission
@@ -176,7 +187,7 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
             reset($this->cart['events']);
             foreach ($this->cart['events'] as $event) {
 
-                if (!isset($_REQUEST['terms_'.$event['id']]) || $_REQUEST['terms_'.$event['id']] != 'accept') {
+                if (trim($event['event_terms']) != '' && (!isset($_REQUEST['terms_'.$event['id']]) || $_REQUEST['terms_'.$event['id']] != 'accept')) {
                     $messages[] = 'You did not accept the Terms and Conditions for the '.$event['event_name'].' event.';
                 }
             }
@@ -306,13 +317,11 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                     $messages[] = 'You did not supply all required credit card information.';
                 }
 
-                // Get the correct billing data
-                // Build array of billing information using either the account data or the billing data as requested
+                // Billing data
                 $billPrefix = 'bill_';
                 if (isset($_REQUEST['billing_same']) && $_REQUEST['billing_same']) {
                     $billPrefix = '';
                 }
-
                 $billing = array(
                     'fname'     => $regAccount['fieldData'][$billPrefix.'fname'],
                     'lname'     => $regAccount['fieldData'][$billPrefix.'lname'],
@@ -347,9 +356,18 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
                     // Now try to run the card processor
                     $ccResult = $CcProcessor->processPayment($payment, $billing);
-echo "<pre>".print_r($ccResult,1)."</pre>";
+
+                    // If successful submission - say we're complete
+                    if (is_array($ccResult) && isset($ccResult['status']) && $ccResult['status'] == 1) {
+                        $cartStatus = $this->config['submission_status_numb']['COMPLETE'];
+                    }
+
+                    // set $ccConfirmation
 
 /**** NEED TO FIX INVOICE # ABOVE ****/
+
+
+
                 }
 
                 break;
@@ -365,16 +383,181 @@ echo "<pre>".print_r($ccResult,1)."</pre>";
 
         }
 
+        /*
+         * Update the reg_request reccord: account id, billing, payment, status, etc...
+         */
 
-        if (count($messages) == 0) {
+        $reqData = array();
+        $reqFormat = array();
+        $now = date('Y-m-d H:i:s', time());
+
+        // Account ID
+        $reqData['account'] = $accountId;
+        $reqFormat[] = '%d';
+
+        // Billing data
+        $reqData = array_merge(
+            $reqData,
+            array(
+                'bill_fname'        => $billing['fname'],
+                'bill_lname'        => $billing['lname'],
+                'bill_org'          => $regAccount['fieldData']['org'],
+                'bill_title'        => $regAccount['fieldData']['title'],
+                'bill_addr1'        => $billing['addr1'],
+                'bill_addr2'        => $billing['addr2'],
+                'bill_city'         => $billing['city'],
+                'bill_state'        => $billing['state'],
+                'bill_zip'          => $billing['zip'],
+                'bill_country'      => $billing['country'],
+                'bill_phone'        => $billing['phone'],
+                'bill_phone'        => $regAccount['fieldData']['email']
+            )
+        );
+        $reqFormat = array_merge(
+            $reqFormat,
+            array(
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s',
+                '%s'
+            )
+        );
 
+        // If COMPLETE, save date, pay method, status, total
+        if ($cartStatus == $this->config['submission_status_numb']['COMPLETE']) {
+
+            // Get the HTML cart summary
+            $summary = '';
+/*** NEED TO BUILD SUMMARY ***/
+
+            $reqData = array_merge(
+                $reqData,
+                array(
+                    'date_submitted'    => $now,
+                    'pay_method'        => $payMethod,
+                    'status'            => $cartStatus,
+                    'total'             => $payment['charge'],
+                    'total_discounts'   => $this->cart['totalDiscounts'],
+                    'registrants'       => $this->cart['totalRegistrants']
+                )
+            );
+            $reqFormat = array_merge(
+                $reqFormat,
+                array(
+                    '%s',
+                    '%d',
+                    '%d',
+                    '%f',
+                    '%f',
+                    '%d'
+                )
+            );
 
         }
 
+        // Last update time
+        $reqData['last_update'] = $now;
+        $reqFormat[]            = '%s';
+
+        // User Trace data
+        $trace = array(
+            'DateTime'      => date('r'),
+            'UserAddr'      => $_SERVER['REMOTE_ADDR'],         // IP address of user's computer
+            'URI'           => $_SERVER['REQUEST_URI'],         // URI submitted to checkout
+            'UserAgent'     => $_SERVER['HTTP_USER_AGENT'],     // User's browser user agent string
+            'Referrer'      => $_SERVER['HTTP_REFERER'],        // Page user came from, should be our checkout page
+            'Method'        => $_SERVER['REQUEST_METHOD']       // Request method: GET, POST, ...
+        );
+        $reqData['user_trace_info'] = serialize($trace);
+        $reqFormat[]                = '%s';
+
+        // Credit Card information
+        $cc_numb_store = '';
+        if (is_array($payment)) {
+
+            $cc_numb_store = '....'.substr($payment['ccnumb'], -4);
+
+            $reqData = array_merge(
+                $reqData,
+                array(
+                    'cc_type'       => $payment['cctype'],
+                    'cc_name'       => $payment['ccname'],
+                    'cc_numb'       => $cc_numb_store,
+                    'cc_exp'        => $payment['ccexp'],
+                    'cc_conf'       => $ccConfirmation,
+                )
+            );
+            $reqFormat = array_merge(
+                $reqFormat,
+                array(
+                    '%s',
+                    '%s',
+                    '%s',
+                    '%s',
+                    '%s',
+                )
+            );
+
+            $reqData['cc_type'] = $payment['cctype'];
+            $reqFormat[] = '%s';
+
+        }
+
+        $reqFormat[] = '%s';
+
+        // Store the data
+        $updated = $this->wpdb->update(
+            GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+            $reqData,
+            array( 'id' => $requestId ),
+            $reqFormat
+        );
+// Check if properly stored ..... Retrieve and test. Send E-Mail if not able to store
+
+        // Get the updated information for the request and account
+        $request = $Request->getEntry($this->cart['request']['id']);
+        $account = $Account->getEntry($request['account']);
+
+        // Get misc texts
+        require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataMisc.php';
+        $Misc = new GlmDataRegistrationsMisc($this->wpdb, $this->config);
+        $misc = $Misc->getEntry(1);
+
+        // Produce HTML for storage and checkout page and add to request
+        $summaryData = array(
+            'cart'              => $this->cart,
+            'request'           => $request,
+            'account'           => $account,
+            'payMethodsNumb'    => $this->config['payment_method_numb'],
+            'status'            => $this->config['submission_status'],
+            'misc'              => $misc
+        );
+        $summary = $this->generateCheckoutConfHTML($summaryData, 'front/registrations/summaryStore.html');
+        $updated = $this->wpdb->update(
+            GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+            array(
+                'summary' => $summary
+            ),
+            array( 'id' => $requestId ),
+            array('%s')
+            );
+
+        if (count($messages) == 0) {
+
+            // Removed inventory holds
+
+            // Update inventory totals
+
+        }
 
-        /*
-         * Send out Notifications
-         */
 
         /*
          * If all is done correctly, use model redirect to go to Step 4 - Dispaly summary
@@ -400,18 +583,33 @@ echo "<pre>".print_r($ccResult,1)."</pre>";
             );
         }
 
-        // Update the cart flags and include updated billing data
-/**** NEED TO DO THIS ****/
+        /*
+         * Successful checkout
+         */
+
+        // Send acknowledgement to person submitting request
+        mail($request['email'], $misc['submission_ack_subject'], $summary);
+
+        // Send notice to all registrants that have E-Mail addresses
+        reset($this->cart);
+        /*** NEED TO DO THIS ***/
+
+
+        /*
+         * Remove cart from session
+         */
+        unset($_SESSION['glm_reg_cart_id']);
+
+        $view = 'summary';
 
-echo "<p>Checkout Done...</p>";
+        // Build check code for display of summary in iframe
+        $summaryCheck = md5($this->cart['request']['id'].GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET.$this->cart['request']['account']);
 
         // Compile template data
         $templateData = array(
-            'page'          => $page,
-            'haveMessages'  => count($messages),
-            'messages'      => $messages,
-            'payMethod'     => $payMethod,
-            'payMethodName' => $payMethodName
+            'requestId'     => $requestId,
+            'summaryCheck'  => $summaryCheck,
+            'misc'          => $misc
         );
 
         // Return status, any suggested view, and any data to controller
@@ -426,4 +624,80 @@ echo "<p>Checkout Done...</p>";
 
 
 
+
+
+
+    /**
+     * Merge template and data to produce HTML
+     *
+     * Checks the theme's view directories and the view directories for
+     * this plugin for a matching view file.
+     *
+     * Note that $viewFile needs to have the proper view directory path
+     * includes. (i.e. "/views/front/registrations/summary.html")
+     *
+     * @param $data array Array of data to merge with the template
+     * @param $view string Path added to
+     *
+     * @access public
+     * @return void
+     */
+    function generateCheckoutConfHTML($data, $viewFile)
+    {
+
+        // If a view file is specified
+        if ($viewFile) {
+
+            // Get the specified view file - check theme first
+            $viewPath = GLM_MEMBERS_PLUGIN_CURRENT_THEME_DIR."/views";
+            $viewPath2 = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "views";       // Save default
+
+            // If the view is not found in the theme, fall back to views in the plugin
+            if (!is_file($viewPath.'/'.$viewFile)) {
+
+                // Next try the plugin/add-on
+                $viewPath = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . "/views";
+
+                if (!is_file($viewPath.'/'.$viewFile)) {
+
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                        trigger_error("Bad or missing view file when generating checkout HTML: $viewPath/$viewFile", E_USER_NOTICE);
+                    }
+
+                }
+
+            }
+
+        }
+
+        // Load Smarty Template support
+        $smarty = new smartyTemplateSupport();
+
+        // Add standard parameters
+        require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php';
+
+        // Add data from model to Smarty template
+        if (is_array($data) && count($data) > 0) {
+            foreach ($data as $k => $d) {
+                $smarty->templateAssign($k, $d);
+            }
+        }
+
+        // Update the Smarty view path
+        $smarty->template->setTemplateDir($viewPath);
+
+        // If the view path doesn't match the default, add the default (using theme view)
+        if ($viewPath2 != $viewPath) {
+            $smarty->template->addTemplateDir($viewPath2);
+        }
+
+        // Generate output from model data and view
+        $out = $smarty->template->fetch($viewFile);
+
+        return $out;
+
+    }
+
+
+
  }
index 9e53638..b43c9c2 100644 (file)
         // Check for $option
         $option = ( isset( $_REQUEST['option'] ) ) ? filter_var( $_REQUEST['option'], FILTER_SANITIZE_STRING) : null;
         switch ( $option ) {
-        case 'logout':
-            unset(
-                $_SESSION['LoginAccount'],
-                $_SESSION['glm_reg_cart_id']
-            );
-            $modelRedirect = 'index';
-            $_REQUEST['page'] = 'list';
-            break;
-        case 'submit':
-            // check for password and email match
-            $username = filter_var( $_REQUEST['username'], FILTER_SANITIZE_STRING );
-            $password = filter_var( $_REQUEST['password'], FILTER_SANITIZE_STRING );
-            // Check accounts for ones that match
-            $returnData = $this->wpdb->get_row(
-                $this->wpdb->prepare(
-                    "SELECT id,password,fname,lname
-                       FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX .  "account
-                      WHERE email = %s
-                        AND active = true",
-                    $username
-                ),
-                ARRAY_A
-            );
-            $returnPassword = $returnData['password'];
-            $returnId       = $returnData['id'];
-            if ( $returnPassword == crypt( $password, $returnPassword ) ) {
-                // Add the user to the php session
-                $_SESSION['LoginAccount'] = array(
-                    'id'    => $returnId,
-                    'email' => $username,
-                    'fname' => $returnData['fname'],
-                    'lname' => $returnData['lname'],
+
+            case 'logout':
+
+                unset(
+                    $_SESSION['LoginAccount'],
+                    $_SESSION['glm_reg_cart_id']
                 );
                 $modelRedirect = 'index';
                 $_REQUEST['page'] = 'list';
-            } else {
-                $message = 'Login Fail!';
-            }
-            break;
-        default:
-            break;
+                break;
+
+            case 'submit':
+
+                // Get clean username (E-Mail address) and password
+                $username = filter_var( $_REQUEST['username'], FILTER_SANITIZE_STRING );
+                $password = filter_var( $_REQUEST['password'], FILTER_SANITIZE_STRING );
+
+                // Get the password from the matching user account (same E-Mail address)
+                $returnData = $this->wpdb->get_row(
+                    $this->wpdb->prepare(
+                        "SELECT id,password,fname,lname
+                           FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX .  "account
+                          WHERE email = %s
+                            AND active = true",
+                        $username
+                    ),
+                    ARRAY_A
+                );
+
+                if ($this->wpdb->last_error || $returnData == NULL) {
+                    $message = 'Login Fail';
+                } else {
+
+                    // Get the hashed password and ID from the user account
+                    $returnPassword = $returnData['password'];
+                    $returnId       = $returnData['id'];
+
+                    // Check to see if the sumbitted password matches the hashed password
+                    if ( password_verify($password, $returnPassword) ) {
+
+                        // Add the user to the php session
+                        $_SESSION['LoginAccount'] = array(
+                            'id'    => $returnId,
+                            'email' => $username,
+                            'fname' => $returnData['fname'],
+                            'lname' => $returnData['lname'],
+                        );
+                        $modelRedirect = 'index';
+                        $_REQUEST['page'] = 'list';
+
+                    } else {
+                        $message = 'Login Fail!';
+                    }
+                }
+
+                break;
+
+            default:
+                break;
         }
 
         // Compile template data
index 479af59..be7e494 100644 (file)
                         'date_created' => date('Y-m-d'),
                         'active'       => 1,
                         'email'        => $email,
-                        'password'     => crypt( $password ),
+                        'password'     => password_hash($password, PASSWORD_DEFAULT),
                         'fname'        => $fname,
                         'lname'        => $lname,
                         'addr1'        => $addr1,
index aea9982..a6ec4b6 100644 (file)
@@ -1,5 +1,20 @@
 <?php
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegEvent.php';
+/**
+ * Gaslight Media Members Database
+ * Front-End Registraitons Summary Page
+ * For re-display only of a checked-out cart
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  summary.php,v 1.0 2017/11/10 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
 
  class GlmMembersFront_registrations_summary extends GlmDataRegistrationsRegEvent {
     /**
@@ -44,7 +59,7 @@
 
     public function modelAction($actionData = false)
     {
-
+/*** THIS NEEDS TO BE RE-DONE ***/
         // Get any provided option
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
@@ -72,7 +87,8 @@
             'page' => 'summary'
 
         );
-             // Return status, any suggested view, and any data to controller
+
+        // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
             'modelRedirect' => false,
diff --git a/setup/databaseScripts/create_database_V0.0.17.sql b/setup/databaseScripts/create_database_V0.0.17.sql
deleted file mode 100644 (file)
index 3c203e1..0000000
+++ /dev/null
@@ -1,718 +0,0 @@
--- Gaslight Media Registration Database
--- File Created: 01/18/2017 14:40:00
--- Database Version: 0.0.16
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
-/*
- * General Database Organization
- * -----------------------------
- *
- * management - General options and configuration - Site manager access only
- *
- * misc - Misc settings and text - Site owner may update
- *
- * payment codes - Promotional payment codes - Used with various things
- *      --> Event, Submission, Event Registration, Event Registrant, Account or global
- *
- * reg_event - Describes registration for that event
- *      reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals
- *      reg_class - Type of registration for this event (one or more)
- *          reg_rates - Date range / rate for a reg class (one or more)
- *
- * reg_account - Describes someone who submits / pays for a registration
- * Make these two things the same table....
- * registrant - A person who is registered for an event
- *
- * reg_request - Information on a specific request for registrations
- *      reg_request_event - Event selected (one or more)
- *          reg_request_class - Class of registration (one or more)
- *              reg_request_rate - Specific registration date/rate (one or more)
- *                  reg_request_registrant - Registrant (one or more)
- *
- * NOTE: additional fields and added fields data will be coming from the Custom Fields add-on
- *
- * Overall Flow
- * ------------
- *
- * User selects an event
- * If the event has available registrations
- *  User selects a date for the registration (or if only one that's selected automatically)
- *    User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ???
- *      User selects an available rate type and adds one or more registrants for that rate type
- *      User may loop back to select additional rate type(s) and registrants
- *    User may go back to date selection and request additional rate types and registrants for the addional dates
- *  User may go back to select additional dates and do registrations for those dates as above
- * User may go back to select other events and do registrations for them as above
- * User may select the "Cart" and deselect something added to it
- * User may checkout
- *
- */
-
-/*
- * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this
- * Lines commented out are selected for possible deletion.
- * The INSERT statements are not up-to-date with the tables.
- * The "config/plugin.ini" file in this plugin is also a work in progress.
- */
-
--- Management Options
--- General configurationm parameters for the Registrations application
--- Only one entry in this table!
-CREATE TABLE {prefix}management (
-    id INT NOT NULL AUTO_INCREMENT,
-    canonical_reg_page TINYTEXT NULL,                              -- Canonical page slug for registrations
-    -- System Owner Information
-    reg_org_name TINYTEXT NULL,                                     -- Customer Information - Name of Organization
-    reg_org_short TINYTEXT NULL,
-    reg_org_address TINYTEXT NULL,
-    reg_org_city TINYTEXT NULL,
-    reg_org_state TINYTEXT NULL,
-    reg_org_zip TINYTEXT NULL,
-    reg_org_phone TINYTEXT NULL,
-    reg_org_toll_free TINYTEXT NULL,
-    reg_org_internal_email TINYTEXT NULL,
-    reg_org_from_email TINYTEXT NULL,
-    reg_payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    reg_proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
-    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
-    -- Authorize.net Credentials
-    reg_authorize_net_login TINYTEXT NULL,
-    reg_authorize_net_key TINYTEXT NULL,
-    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
-    -- Merchant Solutions Credentials
-    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    reg_merchant_solutions_merchantpin TINYTEXT NULL,
-    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    reg_merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
-    reg_merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
-    -- Billing settings
-    reg_full_billing_info BOOLEAN NULL,                             -- Always request full billing information in checkout page regardless of the following settings
-    reg_bill_info_req_no_charge SMALLINT NULL,                      -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf
-    reg_bill_info_req_comp_code SMALLINT NULL,
-    reg_bill_info_req_cash SMALLINT NULL,
-    reg_bill_info_req_check SMALLINT NULL,
-    reg_bill_info_req_credit_card SMALLINT NULL,
-    reg_bill_info_req_merchant_call SMALLINT NULL,
-    -- Misc Options
-    reg_medical_info BOOLEAN NULL,                                  -- This site can ask for "Medical Info" - set in main category of an event
-    PRIMARY KEY (id)
-);
-
-----
-
--- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
--- Terms in this table should be all self-explanatory
-CREATE TABLE {prefix}settings_terms (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_term_registrations_name TINYTEXT NULL,                      -- Term "Event Registration"
-    reg_term_registration TINYTEXT NULL,
-    reg_term_registration_cap TINYTEXT NULL,
-    reg_term_registration_plur TINYTEXT NULL,
-    reg_term_registration_plur_cap TINYTEXT NULL,
-    reg_term_register TINYTEXT NULL,
-    reg_term_register_cap TINYTEXT NULL,
-    reg_term_registers TINYTEXT NULL,                               -- Intransitive verb of register
-    reg_term_registering TINYTEXT NULL,
-    reg_term_registering_cap TINYTEXT NULL,
-    reg_term_registered TINYTEXT NULL,
-    reg_term_registered_cap TINYTEXT NULL,
-    reg_term_attendee TINYTEXT NULL,
-    reg_term_attendee_cap TINYTEXT NULL,
-    reg_term_attendee_plur TINYTEXT NULL,
-    reg_term_attendee_plur_cap TINYTEXT NULL,
-    reg_term_attending TINYTEXT NULL,
-    reg_term_attended TINYTEXT NULL,
-    reg_term_registered_user TINYTEXT NULL,
-    reg_term_registered_user_cap TINYTEXT NULL,
-    reg_term_registered_user_plur TINYTEXT NULL,
-    reg_term_registered_user_plur_cap TINYTEXT NULL,
-    reg_term_id TINYTEXT NULL,
-    reg_term_id_cap TINYTEXT NULL,
-    reg_term_id_plur TINYTEXT NULL,
-    reg_term_id_plur_cap TINYTEXT NULL,
-    reg_term_password TINYTEXT NULL,
-    reg_term_password_cap TINYTEXT NULL,
-    reg_term_password_plur TINYTEXT NULL,
-    reg_term_password_plur_cap TINYTEXT NULL,
-    reg_term_instructor TINYTEXT NULL,
-    reg_term_instructor_cap TINYTEXT NULL,
-    reg_term_instructor_plur TINYTEXT NULL,
-    reg_term_instructor_plur_cap TINYTEXT NULL,
-    reg_term_payment_code TINYTEXT NULL,
-    reg_term_payment_code_cap TINYTEXT NULL,
-    reg_term_payment_code_plur TINYTEXT NULL,
-    reg_term_payment_code_plur_cap TINYTEXT NULL,
-    reg_term_registration_button TINYTEXT NULL,
-    reg_term_contact_information TINYTEXT NULL,
-    PRIMARY KEY (id)
-);
-
-----
-
--- Misc system-wide customer configurable configuration
--- Various text and flags to be configured by customer
--- Only one entry in this table!
-CREATE TABLE {prefix}misc (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_bulletin TEXT NULL,                                     -- Text to display at top of first registration page
-    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
-    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
-    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
-    reg_terms TEXT NULL,                                        -- Registration terms and conditions
-    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
-    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
-    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
-    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
-    submission_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to person submitting the registrations
-    submission_notify_text TEXT NULL,                           -- Notification E-Mail text to person submitting the registrations
-    registrant_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to registrant
-    registrant_notify_text TEXT NULL,                           -- Text of notification E-Mail to registrant
-    submission_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to person submitting the registrations
-    submission_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail text to person submitting the registrations
-    registrant_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to registrant
-    registrant_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail to registrant
-    PRIMARY KEY (id)
-);
-
-----
-
--- Payment Codes
--- Promotional payment codes for free/discounted payment
-CREATE TABLE {prefix}payment_code (
-    id INT NOT NULL AUTO_INCREMENT,
-    code_type TINYINT NULL,                                     -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini
-    ref_type TINYINT NULL,                                      -- See payment_ref_type in plugin.ini
-    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
-    code TINYTEXT NULL,                                         -- Text code user must enter to use
-    amount FLOAT,                                               -- Amount of discount if not type "Free" - Either $ amount or percent
-    descr TEXT NULL,
-    PRIMARY KEY (id),
-    INDEX (ref_dest),
-    INDEX (code(10))
-);
-
-----
-
--- Registration event specific information
--- One record for each event in Events add-on
--- Only created when an event is selected to offer registrations
-CREATE TABLE {prefix}reg_event (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INT NULL,                                             -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists
-    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
-    event_code TINYTEXT NULL,                                   -- A short code used to reference this event - can be used to directly select an event to register for
-    notify_email TINYTEXT NULL,                                 -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated
-    admin_active BOOLEAN NULL,                                  -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off.
-    active BOOLEAN NULL,                                        -- Active flag to indicate that this event is available for registrations
-    time_specific BOOLEAN NULL,                                 -- Registration for this event is not date/time specific. Can attend any date/time of event.
-    attendees BOOLEAN NULL,                                     -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
-    attendee_max MEDIUMINT NULL,                                -- Attendee limit - 0 = unlimited
-    attendee_max_per_reg TINYINT NULL,                          -- Maximum attendees per registration submission - 0 = unlimited
-    reg_hold_minutes MEDIUMINT NULL,                            -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access)
-    cart_hold_days MEDIUMINT NULL,                              -- Number of days hold time for inactive cart before cart is purged
-    reg_hours_before MEDIUMINT NULL,                            -- Number of hours before an event that is the latest a registration may be submitted.     
-    registration_account_options SMALLINT NULL,                 -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini
-    payment_methods SMALLINT NULL,                              -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini
-    restricted_payment_methods SMALLINT NULL,                   -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method
-    descr TEXT NULL,                                            -- Registrations specific description field for this event
-    terms TEXT NULL,                                            -- Terms and Conditions for registration
-    first_datetime DATETIME NULL,                               -- Start of first listed date/time for this event
-    last_datetime DATETIME NULL,                                -- Start of last listed date/time for this event
-    reg_file TINYTEXT NULL,                                     -- Name of a downloadable file
-    reg_file_title TINYTEXT NULL,                               -- Title for downloadable file
-    form_revision SMALLINT NULL,                                -- Current MagicForm form revision
-    notes TEXT NULL,                                            -- System operator's notes for this event - Not visible to users
-    PRIMARY KEY (id),
-    INDEX (event),
-    INDEX (event_code(10))
-);
-
-----
-
--- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events)
--- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time.
--- These are created the first time a person tries to register for an event instance (time)
--- One or more for each event
-CREATE TABLE {prefix}reg_time (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    event_time INT NULL,                                        -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific)
-    start_datetime DATETIME NULL,                               -- Date and time when event instance starts
-    end_datetime DATETIME NULL,                                 -- Date and time when event instance ends
-    all_day BOOLEAN NULL,                                       -- All Day flag - Informational
-    attendees BOOLEAN NULL,                                     -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event
-    attendee_max MEDIUMINT NULL,                                -- Attendee count limit - 0 = unlimited - get from reg_event record
-    attendee_count MEDIUMINT NULL,                              -- Current attendee count - calculated on the fly and stored here for reference
-    attendees_pending MEDIUMINT NULL,                           -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held)
-    attendees_available MEDIUMINT NULL,                         -- Currently available attendee count (limit - current - pending)
-    total_base_charge DOUBLE NULL,                              -- Total base charges
-    total_per_attendee DOUBLE NULL,                             -- Total per-attendee charges
-    total_other DOUBLE NULL,                                    -- Total other charges (meals, extras, fees, ...)
-    total_taxes DOUBLE NULL,                                    -- Total taxes charged
-    total_charges DOUBLE NULL,                                  -- Total charges (sum of all above)
-    total_discounts DOUBLE NULL,                                -- Total discounts of all types (applied payment codes, etc...)
-    total_payments DOUBLE NULL,                                 -- Total net payments (total charges - total discounts)
-    descr TEXT NULL,                                            -- Optional description field for this time entry
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (event_time),
-    INDEX (start_datetime)
-);
-
-----
-
--- Pending Attendees - In carts but not checked out
--- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out
--- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table
--- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired
-CREATE TABLE {prefix}reg_time_pending (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    reg_time INT NULL,                                          -- ID of time record
-    registrant INT NULL,                                        -- ID of reg_request_registrant record                                                  -- 
-    expire_time DATETIME NULL,                                  -- Time at which this hold expires
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time)
-);
-
-----
-
--- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
--- One or more for each event
-CREATE TABLE {prefix}reg_class (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    name TINYTEXT NULL,                                         -- Name of this registration type
-    descr TEXT NULL,                                            -- Description
-    PRIMARY KEY (id),
-    INDEX (reg_event)
-);
-
-----
-
--- Rates and dates for a particular reg_class
--- One or more per reg_class - **** Days should not overlap for a particular reg_class
-CREATE TABLE {prefix}reg_rate (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event table
-    reg_class INT NULL,                                         -- Pointer to reg_class table
-    name TINYTEXT NULL,                                         -- Namme of this rate
-    start_days INT NULL,                                        -- # of days before event time rate becomes available - may be selected as a date then coverted for storage
-    end_days INT NULL,                                          -- # of days before event time rate becomes unavailable
-    base_rate FLOAT,                                            -- Base rate to register
-    per_registrant FLOAT,                                       -- Rate per registrant
-    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_class)
-);
-
-----
-
--- An account for a person submitting a registration or a registrant for an event
--- Depending on the use of these entries may not have all data included
--- A single account may be referenced as a person submitting registrations and/or a person registered for an event
-CREATE TABLE {prefix}account (
-    id INT NOT NULL AUTO_INCREMENT,
-    active BOOLEAN NULL,                                        -- Is active flag (may be accessed or used) - default is true
-    validated BOOLEAN NULL,                                     -- Flag indicating that the account has been validated - Set to false when recovering password
-    validation_code TINYTEXT NULL,                              -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation
-    registered_by INT NULL,                                     -- Account
-    member_id TINYTEXT NULL,                                    -- Free-form field for a member ID (not a GLM Associate member ID)
-    fname TINYTEXT NULL,                                        -- Account primary address
-    lname TINYTEXT NULL,
-    org TINYTEXT NULL,
-    title TINYTEXT NULL,
-    addr1 TINYTEXT NULL,
-    addr2 TINYTEXT NULL,
-    city TINYTEXT NULL,
-    state TINYTEXT NULL,
-    zip TINYTEXT NULL,
-    country TINYTEXT NULL,
-    phone TINYTEXT NULL,
-    fax TINYTEXT NULL,
-    bill_fname TINYTEXT NULL,                                   -- Last used billing information - Also stored in each registration request
-    bill_lname TINYTEXT NULL,
-    bill_org TINYTEXT NULL,
-    bill_title TINYTEXT NULL,
-    bill_addr1 TINYTEXT NULL,
-    bill_addr2 TINYTEXT NULL,
-    bill_city TINYTEXT NULL,
-    bill_state TINYTEXT NULL,
-    bill_zip TINYTEXT NULL,
-    bill_country TINYTEXT NULL,
-    bill_phone TINYTEXT NULL,
-    bill_fax TINYTEXT NULL,
-    email TINYTEXT NULL,
-    password TINYTEXT NULL,                                     -- Crypted password for login back into this account
-    email_ok BOOLEAN NULL,
-    is_member BOOLEAN NULL,                                     -- Is a member of the entity that owns the site
-    contact_id INT NULL,                                        -- Pointer to GLM Associate member contact record if account is for a member contact
-    contact_fname TINYTEXT NULL,
-    contact_lname TINYTEXT NULL,
-    contact_org TINYTEXT NULL,
-    contact_title TINYTEXT NULL,
-    contact_addr1 TINYTEXT NULL,
-    contact_addr2 TINYTEXT NULL,
-    contact_city TINYTEXT NULL,
-    contact_state TINYTEXT NULL,
-    contact_zip TINYTEXT NULL,
-    contact_country TINYTEXT NULL,
-    contact_phone TINYTEXT NULL,
-    contact_fax TINYTEXT NULL,
-    contact_email TINYTEXT NULL,
-    contact_email_ok BOOLEAN NULL,
-    guardian TINYTEXT NULL,
-    emer_contact TINYTEXT NULL,
-    emer_phone TINYTEXT NULL,
-    med_history TINYTEXT NULL,
-    allergy_med TINYTEXT NULL,
-    date_created DATE NULL,
-    notes TEXT NULL,                                            -- System operator's notes for this account - not visible to account owner
-    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp of last update
-    PRIMARY KEY (id),
-    INDEX (registered_by),
-    INDEX (member_id(10)),
-    INDEX (fname(10)),
-    INDEX (lname(10)),
-    INDEX (org(10)),
-    INDEX (city(10)),
-    INDEX (state(5)),
-    INDEX (zip(5)),
-    INDEX (email(10)),
-    INDEX (contact_id)
-);
-
-----
-
--- A request for registration
--- Has one or more reg_detail records associated with it
-CREATE TABLE {prefix}reg_request (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NULL,                                           -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout)
-    validated BOOLEAN NULL,                                     -- Flag that indicates if request passed last validation with checkRegistrationRequest()
-    validation_message TEXT NULL,                               -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array
-    bill_fname TINYTEXT NULL,                                   -- Billing information used for this registration submission - Updates account billing address - Kept here for each request
-    bill_lname TINYTEXT NULL,
-    bill_org TINYTEXT NULL,
-    bill_title TINYTEXT NULL,
-    bill_addr1 TINYTEXT NULL,
-    bill_addr2 TINYTEXT NULL,
-    bill_city TINYTEXT NULL,
-    bill_state TINYTEXT NULL,
-    bill_zip TINYTEXT NULL,
-    bill_country TINYTEXT NULL,
-    date_submitted DATE NULL,
-    pay_method INT NULL,                                        -- See payment_method in plugin.ini
-    payment_code TINYTEXT NULL,                                 -- Payment_code (code text) - if submitted and validated
-    status SMALLINT NULL,                                       -- See submission_status in plugin.ini
-    total DOUBLE PRECISION NULL,                                -- Total charge including all fees and taxes
-    cc_type TINYINT NULL,                                       -- Credit Card type (if used) - See credit_card in plugin.ini
-    cc_name TINYTEXT NULL,
-    cc_numb TINYTEXT NULL,
-    cc_exp TINYTEXT NULL,
-    cc_cvv TINYTEXT NULL,
-    cc_conf TINYTEXT NULL,                                      -- Confirmation code back from card processor
-    summary TEXT NULL,                                          -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user
-    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp
-    date_created DATETIME NULL,                                 -- Date request was first created
-    last_update DATETIME NULL,                                  -- Last update date/time - Used for timing out pending carts and attendee counts
-    PRIMARY KEY (id),
-    INDEX (account),
-    INDEX (date_submitted)
-);
-
-----
-
--- Registration for a specific event
--- Has one or more reg_selected_rate records associated with it 
-CREATE TABLE {prefix}reg_request_event (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_request INT NULL,                                       -- Pointer to reg_request table
-    reg_event INT NULL,                                         -- Pointer to reg_event
-    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_request),
-    INDEX (reg_event),
-    INDEX (reg_time)
-);
-
-----
-
---  A particular reg_class selected
---  Has one or more reg_request_rate records associated with it 
-CREATE TABLE {prefix}reg_request_class (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    class INT NULL,                                             -- Pointer to event reg_class table - False (0) if registration class no longer exits
-    class_name TINYTEXT NULL,                                   -- Name of event class at the time selected
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request_event)
-);
-
-----
-
---  A particular reg_rate selected
---  Has one or more reg_request_registrant records associated with it
-CREATE TABLE {prefix}reg_request_rate (
-    id INT NOT NULL AUTO_INCREMENT,
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
-    rate INT NULL,                                              -- Pointer to event reg_rate table - False (0) if registration rate no longer exists
-    rate_name TINYTEXT NULL,                                    -- Name of event class rate at the time selected
-    base_rate FLOAT,                                            -- Base rate at time of registration
-    per_registrant FLOAT,                                       -- Per Registrant Rate at time of registration
-    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate at time of registration
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request_event),
-    INDEX (reg_request_class)
-);
-
-----
-
---  A specific registrant for a selected registration rate
-CREATE TABLE {prefix}reg_request_registrant (
-    id INT NOT NULL AUTO_INCREMENT,
-    account INT NULL,                                           -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed
-    reg_event INT NULL,                                         -- Pointer to reg_event entry
-    reg_time INT NULL,                                          -- Pointer reg_time entry
-    event_datetime DATETIME NULL,                               -- Date and time of event time selected so it will always be in the cart
-    reg_request INT NULL,                                       -- Pointer to the registration request record
-    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
-    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
-    reg_request_rate INT NULL,                                  -- Pointer to reg_request_rate table entry
-    fname TINYTEXT NULL,                                        -- First name of registrant at the time of selection
-    lname TINYTEXT NULL,                                        -- Last name of registrant at the time of selection
-    notes TEXT NULL,                                            -- System operator's notes for this registration request
-    PRIMARY KEY (id),
-    INDEX (account),
-    INDEX (reg_event),
-    INDEX (reg_time),
-    INDEX (reg_request),
-    INDEX (reg_request_event),
-    INDEX (reg_request_class),
-    INDEX (reg_request_rate)
-);
-
-----
-
--- Insert into management table
-INSERT INTO {prefix}management
-    (
-    canonical_reg_page,
-    reg_org_name,
-    reg_org_short,
-    reg_org_address,
-    reg_org_city,
-    reg_org_state,
-    reg_org_zip,
-    reg_org_phone,
-    reg_org_toll_free,
-    reg_org_internal_email,
-    reg_org_from_email,
-    reg_payment_methods,
-    reg_proc_methods,
-    reg_cc_accepts,
-    reg_authorize_net_login,
-    reg_authorize_net_key,
-    reg_authorize_net_test,
-    reg_authorize_net_conf,
-    reg_authorize_net_merchant_email,
-    reg_merchant_solutions_acctid,
-    reg_merchant_solutions_merchantpin,
-    reg_merchant_solutions_test,
-    reg_full_billing_info,
-    reg_bill_info_req_no_charge,
-    reg_bill_info_req_comp_code,
-    reg_bill_info_req_cash,
-    reg_bill_info_req_check,
-    reg_bill_info_req_credit_card,
-    reg_bill_info_req_merchant_call,
-    reg_medical_info
-    )
-    VALUES
-    (
-    'registrations',                                            -- reg_canonical_reg_page,
-    'Gaslight Media',                                           -- reg_org_name,
-    'GLM',                                                      -- reg_org_short,
-    '120 E. Lake St.',                                          -- reg_org_address,
-    'Petoskey',                                                 -- reg_org_city,
-    'MI',                                                       -- reg_org_state,
-    '49770',                                                    -- reg_org_zip,
-    '231-487-0692',                                             -- reg_org_phone,
-    '800-123-1234',                                             -- reg_org_toll_free,
-    'internal@gaslightmedia.com',                               -- reg_org_internal_email,
-    'info@gaslightmedia.com',                                   -- reg_org_from_email,
-    0,                                                          -- reg_payment_methods,
-    0,                                                          -- reg_proc_methods,
-    0,                                                          -- reg_cc_accepts,
-    '',                                                         -- reg_authorize_net_login,
-    '',                                                         -- reg_authorize_net_key,
-    1,                                                          -- reg_authorize_net_test,
-    true,                                                       -- reg_authorize_net_conf
-    '',                                                         -- reg_authorize_net_merchant_email,
-    '',                                                         -- reg_merchant_solutions_acctid,
-    '',                                                         -- reg_merchant_solutions_merchantpin,
-    1,                                                          -- reg_merchant_solutions_test,
-    true,                                                       -- reg_full_billing_info,
-    0,                                                          -- reg_bill_info_req_no_charge,
-    0,                                                          -- reg_bill_info_req_comp_code,
-    0,                                                          -- reg_bill_info_req_cash,
-    0,                                                          -- reg_bill_info_req_check,
-    0,                                                          -- reg_bill_info_req_credit_card,
-    0,                                                          -- reg_bill_info_req_merchant_call,
-    true                                                        -- reg_medical_info,
-    );
-
-----
-
--- Insert into settings_terms table
-INSERT INTO {prefix}settings_terms
-    (
-    reg_term_registrations_name,
-    reg_term_registration,
-    reg_term_registration_cap,
-    reg_term_registration_plur,
-    reg_term_registration_plur_cap,
-    reg_term_register,
-    reg_term_register_cap,
-    reg_term_registers,
-    reg_term_registering,
-    reg_term_registering_cap,
-    reg_term_registered,
-    reg_term_registered_cap,
-    reg_term_attendee,
-    reg_term_attendee_cap,
-    reg_term_attendee_plur,
-    reg_term_attendee_plur_cap,
-    reg_term_attending,
-    reg_term_attended,
-    reg_term_registered_user,
-    reg_term_registered_user_cap,
-    reg_term_registered_user_plur,
-    reg_term_registered_user_plur_cap,
-    reg_term_id,
-    reg_term_id_cap,
-    reg_term_id_plur,
-    reg_term_id_plur_cap,
-    reg_term_password,
-    reg_term_password_cap,
-    reg_term_password_plur,
-    reg_term_password_plur_cap,
-    reg_term_instructor,
-    reg_term_instructor_cap,
-    reg_term_instructor_plur,
-    reg_term_instructor_plur_cap,
-    reg_term_payment_code,
-    reg_term_payment_code_cap,
-    reg_term_payment_code_plur,
-    reg_term_payment_code_plur_cap,
-    reg_term_registration_button,
-    reg_term_contact_information
-    )
-    VALUES
-    (
-    'Event Registrations',                                      -- reg_term_registrations_name
-    'registration',                                             -- reg_term_registration
-    'Registration',                                             -- reg_term_registration_cap
-    'registrations',                                            -- reg_term_registration_plur
-    'Registrations',                                            -- reg_term_registration_plur_cap
-    'register',                                                 -- reg_term_registe
-    'Register',                                                 -- reg_term_register_cap
-    'registers',                                                -- reg_term_registers
-    'registering',                                              -- reg_term_registering
-    'Registering',                                              -- reg_term_registering_cap
-    'registered',                                               -- reg_term_registered
-    'Registered',                                               -- reg_term_registered_cap
-    'attendee',                                                 -- reg_term_attendee
-    'Attendee',                                                 -- reg_term_attendee_cap
-    'attendees',                                                -- reg_term_attendee_plur
-    'Attendees',                                                -- reg_term_attendee_plur_cap
-    'attending',                                                -- reg_term_attending
-    'attended',                                                 -- reg_term_attended
-    'user',                                                     -- reg_term_registered_user
-    'User',                                                     -- reg_term_registered_user_cap
-    'users',                                                    -- reg_term_registered_user_plur
-    'Users',                                                    -- reg_term_registered_user_plur_cap
-    'ID',                                                       -- reg_term_id
-    'ID',                                                       -- reg_term_id_cap
-    'IDs',                                                      -- reg_term_id_plur
-    'IDs',                                                      -- reg_term_id_plur_cap
-    'password',                                                 -- reg_term_password
-    'passwords',                                                -- reg_term_password_cap
-    'Password',                                                 -- reg_term_password_plur
-    'Passwords',                                                -- reg_term_password_plur_cap
-    'instructor',                                               -- reg_term_instructor
-    'Instructor',                                               -- reg_term_instructor_cap
-    'instructors',                                              -- reg_term_instructor_plur
-    'Instructors',                                              -- reg_term_instructor_plur_cap
-    'payment code',                                             -- reg_term_payment_code
-    'Payment code',                                             -- reg_term_payment_code_cap
-    'payment codes',                                            -- reg_term_payment_code_plur
-    'Payment codes',                                            -- reg_term_payment_code_plur_cap
-    'Register for Event',                                       -- reg_term_registration_button
-    'Contact Information'                                       -- reg_term_contact_information
-    );
-
-----
-
--- Insert into misc table
-INSERT INTO {prefix}misc
-    (
-    reg_bulletin,
-    cart_page_text,
-    checkout_page_text,
-    summary_page_text,
-    reg_terms,
-    notify_subject,
-    notify_text,
-    instr_notify_subject,
-    instr_notify_text,
-    submission_notify_subject,
-    submission_notify_text,
-    registrant_notify_subject,
-    registrant_notify_text,
-    submission_ack_subject,
-    submission_ack_text,
-    registrant_ack_subject,
-    registrant_ack_text
-    )
-    VALUES
-    (
-    'Registration Bulletin Text',
-    'Text for top of Cart Page',
-    'Text for top of Checkout Page',
-    'Text for top of Summary Page',
-    'Terms and Conditions',
-    'Subject of notification to site owner of a registration',
-    'Text of notification to site owner of a registration',
-    'Subject of notification to instructor of registration',
-    'Text for notification to instructor of registration',
-    'Subject of notification to person submitting registration',
-    'Text of notification to person submitting registration',
-    'Subject for notification to registrant',
-    'Text for notification to registrant',
-    'Subject of acknowledgement to person submitting registration',
-    'Text of acknowledgement to person submitting registration',
-    'Subject of acknowledgement to registrant',
-    'Text of acknowledgement to registrant'
-    );
diff --git a/setup/databaseScripts/create_database_V0.0.18.sql b/setup/databaseScripts/create_database_V0.0.18.sql
new file mode 100644 (file)
index 0000000..3e804d1
--- /dev/null
@@ -0,0 +1,723 @@
+-- Gaslight Media Registration Database
+-- File Created: 01/18/2017 14:40:00
+-- Database Version: 0.0.16
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+/*
+ * General Database Organization
+ * -----------------------------
+ *
+ * management - General options and configuration - Site manager access only
+ *
+ * misc - Misc settings and text - Site owner may update
+ *
+ * payment codes - Promotional payment codes - Used with various things
+ *      --> Event, Submission, Event Registration, Event Registrant, Account or global
+ *
+ * reg_event - Describes registration for that event
+ *      reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals
+ *      reg_class - Type of registration for this event (one or more)
+ *          reg_rates - Date range / rate for a reg class (one or more)
+ *
+ * reg_account - Describes someone who submits / pays for a registration
+ * Make these two things the same table....
+ * registrant - A person who is registered for an event
+ *
+ * reg_request - Information on a specific request for registrations
+ *      reg_request_event - Event selected (one or more)
+ *          reg_request_class - Class of registration (one or more)
+ *              reg_request_rate - Specific registration date/rate (one or more)
+ *                  reg_request_registrant - Registrant (one or more)
+ *
+ * NOTE: additional fields and added fields data will be coming from the Custom Fields add-on
+ *
+ * Overall Flow
+ * ------------
+ *
+ * User selects an event
+ * If the event has available registrations
+ *  User selects a date for the registration (or if only one that's selected automatically)
+ *    User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ???
+ *      User selects an available rate type and adds one or more registrants for that rate type
+ *      User may loop back to select additional rate type(s) and registrants
+ *    User may go back to date selection and request additional rate types and registrants for the addional dates
+ *  User may go back to select additional dates and do registrations for those dates as above
+ * User may go back to select other events and do registrations for them as above
+ * User may select the "Cart" and deselect something added to it
+ * User may checkout
+ *
+ */
+
+/*
+ * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this
+ * Lines commented out are selected for possible deletion.
+ * The INSERT statements are not up-to-date with the tables.
+ * The "config/plugin.ini" file in this plugin is also a work in progress.
+ */
+
+-- Management Options
+-- General configurationm parameters for the Registrations application
+-- Only one entry in this table!
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    canonical_reg_page TINYTEXT NULL,                              -- Canonical page slug for registrations
+    -- System Owner Information
+    reg_org_name TINYTEXT NULL,                                     -- Customer Information - Name of Organization
+    reg_org_short TINYTEXT NULL,
+    reg_org_address TINYTEXT NULL,
+    reg_org_city TINYTEXT NULL,
+    reg_org_state TINYTEXT NULL,
+    reg_org_zip TINYTEXT NULL,
+    reg_org_phone TINYTEXT NULL,
+    reg_org_toll_free TINYTEXT NULL,
+    reg_org_internal_email TINYTEXT NULL,
+    reg_org_from_email TINYTEXT NULL,
+    reg_payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    reg_proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    -- Authorize.net Credentials
+    reg_authorize_net_login TINYTEXT NULL,
+    reg_authorize_net_key TINYTEXT NULL,
+    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    -- Merchant Solutions Credentials
+    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    reg_merchant_solutions_merchantpin TINYTEXT NULL,
+    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    reg_merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
+    reg_merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
+    -- Billing settings
+    reg_full_billing_info BOOLEAN NULL,                             -- Always request full billing information in checkout page regardless of the following settings
+    reg_bill_info_req_no_charge SMALLINT NULL,                      -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf
+    reg_bill_info_req_comp_code SMALLINT NULL,
+    reg_bill_info_req_cash SMALLINT NULL,
+    reg_bill_info_req_check SMALLINT NULL,
+    reg_bill_info_req_credit_card SMALLINT NULL,
+    reg_bill_info_req_merchant_call SMALLINT NULL,
+    -- Misc Options
+    reg_medical_info BOOLEAN NULL,                                  -- This site can ask for "Medical Info" - set in main category of an event
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table
+-- Terms in this table should be all self-explanatory
+CREATE TABLE {prefix}settings_terms (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_term_registrations_name TINYTEXT NULL,                      -- Term "Event Registration"
+    reg_term_registration TINYTEXT NULL,
+    reg_term_registration_cap TINYTEXT NULL,
+    reg_term_registration_plur TINYTEXT NULL,
+    reg_term_registration_plur_cap TINYTEXT NULL,
+    reg_term_register TINYTEXT NULL,
+    reg_term_register_cap TINYTEXT NULL,
+    reg_term_registers TINYTEXT NULL,                               -- Intransitive verb of register
+    reg_term_registering TINYTEXT NULL,
+    reg_term_registering_cap TINYTEXT NULL,
+    reg_term_registered TINYTEXT NULL,
+    reg_term_registered_cap TINYTEXT NULL,
+    reg_term_attendee TINYTEXT NULL,
+    reg_term_attendee_cap TINYTEXT NULL,
+    reg_term_attendee_plur TINYTEXT NULL,
+    reg_term_attendee_plur_cap TINYTEXT NULL,
+    reg_term_attending TINYTEXT NULL,
+    reg_term_attended TINYTEXT NULL,
+    reg_term_registered_user TINYTEXT NULL,
+    reg_term_registered_user_cap TINYTEXT NULL,
+    reg_term_registered_user_plur TINYTEXT NULL,
+    reg_term_registered_user_plur_cap TINYTEXT NULL,
+    reg_term_id TINYTEXT NULL,
+    reg_term_id_cap TINYTEXT NULL,
+    reg_term_id_plur TINYTEXT NULL,
+    reg_term_id_plur_cap TINYTEXT NULL,
+    reg_term_password TINYTEXT NULL,
+    reg_term_password_cap TINYTEXT NULL,
+    reg_term_password_plur TINYTEXT NULL,
+    reg_term_password_plur_cap TINYTEXT NULL,
+    reg_term_instructor TINYTEXT NULL,
+    reg_term_instructor_cap TINYTEXT NULL,
+    reg_term_instructor_plur TINYTEXT NULL,
+    reg_term_instructor_plur_cap TINYTEXT NULL,
+    reg_term_payment_code TINYTEXT NULL,
+    reg_term_payment_code_cap TINYTEXT NULL,
+    reg_term_payment_code_plur TINYTEXT NULL,
+    reg_term_payment_code_plur_cap TINYTEXT NULL,
+    reg_term_registration_button TINYTEXT NULL,
+    reg_term_contact_information TINYTEXT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Misc system-wide customer configurable configuration
+-- Various text and flags to be configured by customer
+-- Only one entry in this table!
+CREATE TABLE {prefix}misc (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_bulletin TEXT NULL,                                     -- Text to display at top of first registration page
+    cart_page_text TEXT NULL,                                   -- Text to display at top of cart page
+    checkout_page_text TEXT NULL,                               -- Text to display at top of checkout page
+    summary_page_text TEXT NULL,                                -- Text to display at top of summary page (after checkout)
+    reg_terms TEXT NULL,                                        -- Registration terms and conditions
+    notify_subject TEXT NULL,                                   -- Subject of notification E-Mail to site owner
+    notify_text TEXT NULL,                                      -- Notification E-Mail text for site owner
+    instr_notify_subject TEXT NULL,                             -- Subject of notification E-Mail to instructor
+    instr_notify_text TEXT NULL,                                -- Notification E-Mail text for instructor
+    submission_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to person submitting the registrations
+    submission_notify_text TEXT NULL,                           -- Notification E-Mail text to person submitting the registrations
+    registrant_notify_subject TEXT NULL,                        -- Subject of notification E-Mail to registrant
+    registrant_notify_text TEXT NULL,                           -- Text of notification E-Mail to registrant
+    submission_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to person submitting the registrations
+    submission_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail text to person submitting the registrations
+    registrant_ack_subject TEXT NULL,                           -- Subject of acknowledgement E-Mail to registrant
+    registrant_ack_text TEXT NULL,                              -- Text of acknowledgement E-Mail to registrant
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Payment Codes
+-- Promotional payment codes for free/discounted payment
+CREATE TABLE {prefix}payment_code (
+    id INT NOT NULL AUTO_INCREMENT,
+    code_type TINYINT NULL,                                     -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini
+    ref_type TINYINT NULL,                                      -- See payment_ref_type in plugin.ini
+    ref_dest INT NULL,                                          -- Pointer to the specific entity of ref_type
+    code TINYTEXT NULL,                                         -- Text code user must enter to use
+    amount FLOAT,                                               -- Amount of discount if not type "Free" - Either $ amount or percent
+    descr TEXT NULL,
+    PRIMARY KEY (id),
+    INDEX (ref_dest),
+    INDEX (code(10))
+);
+
+----
+
+-- Registration event specific information
+-- One record for each event in Events add-on
+-- Only created when an event is selected to offer registrations
+CREATE TABLE {prefix}reg_event (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INT NULL,                                             -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists
+    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
+    event_code TINYTEXT NULL,                                   -- A short code used to reference this event - can be used to directly select an event to register for
+    notify_email TINYTEXT NULL,                                 -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated
+    admin_active BOOLEAN NULL,                                  -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off.
+    active BOOLEAN NULL,                                        -- Active flag to indicate that this event is available for registrations
+    time_specific BOOLEAN NULL,                                 -- Registration for this event is not date/time specific. Can attend any date/time of event.
+    attendees BOOLEAN NULL,                                     -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
+    attendee_max MEDIUMINT NULL,                                -- Attendee limit - 0 = unlimited
+    attendee_max_per_reg TINYINT NULL,                          -- Maximum attendees per registration submission - 0 = unlimited
+    reg_hold_minutes MEDIUMINT NULL,                            -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access)
+    cart_hold_days MEDIUMINT NULL,                              -- Number of days hold time for inactive cart before cart is purged
+    reg_hours_before MEDIUMINT NULL,                            -- Number of hours before an event that is the latest a registration may be submitted.     
+    registration_account_options SMALLINT NULL,                 -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini
+    payment_methods SMALLINT NULL,                              -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini
+    restricted_payment_methods SMALLINT NULL,                   -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method
+    descr TEXT NULL,                                            -- Registrations specific description field for this event
+    terms TEXT NULL,                                            -- Terms and Conditions for registration
+    first_datetime DATETIME NULL,                               -- Start of first listed date/time for this event
+    last_datetime DATETIME NULL,                                -- Start of last listed date/time for this event
+    reg_file TINYTEXT NULL,                                     -- Name of a downloadable file
+    reg_file_title TINYTEXT NULL,                               -- Title for downloadable file
+    form_revision SMALLINT NULL,                                -- Current MagicForm form revision
+    notes TEXT NULL,                                            -- System operator's notes for this event - Not visible to users
+    PRIMARY KEY (id),
+    INDEX (event),
+    INDEX (event_code(10))
+);
+
+----
+
+-- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events)
+-- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time.
+-- These are created the first time a person tries to register for an event instance (time)
+-- One or more for each event
+CREATE TABLE {prefix}reg_time (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    event_time INT NULL,                                        -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific)
+    start_datetime DATETIME NULL,                               -- Date and time when event instance starts
+    end_datetime DATETIME NULL,                                 -- Date and time when event instance ends
+    all_day BOOLEAN NULL,                                       -- All Day flag - Informational
+    attendees BOOLEAN NULL,                                     -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event
+    attendee_max MEDIUMINT NULL,                                -- Attendee count limit - 0 = unlimited - get from reg_event record
+    attendee_count MEDIUMINT NULL,                              -- Current attendee count - calculated on the fly and stored here for reference
+    attendees_pending MEDIUMINT NULL,                           -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held)
+    attendees_available MEDIUMINT NULL,                         -- Currently available attendee count (limit - current - pending)
+    total_base_charge DOUBLE NULL,                              -- Total base charges
+    total_per_attendee DOUBLE NULL,                             -- Total per-attendee charges
+    total_other DOUBLE NULL,                                    -- Total other charges (meals, extras, fees, ...)
+    total_taxes DOUBLE NULL,                                    -- Total taxes charged
+    total_charges DOUBLE NULL,                                  -- Total charges (sum of all above)
+    total_discounts DOUBLE NULL,                                -- Total discounts of all types (applied payment codes, etc...)
+    total_payments DOUBLE NULL,                                 -- Total net payments (total charges - total discounts)
+    descr TEXT NULL,                                            -- Optional description field for this time entry
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (event_time),
+    INDEX (start_datetime)
+);
+
+----
+
+-- Pending Attendees - In carts but not checked out
+-- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out
+-- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table
+-- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired
+CREATE TABLE {prefix}reg_time_pending (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    reg_time INT NULL,                                          -- ID of time record
+    registrant INT NULL,                                        -- ID of reg_request_registrant record                                                  -- 
+    expire_time DATETIME NULL,                                  -- Time at which this hold expires
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time)
+);
+
+----
+
+-- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system
+-- One or more for each event
+CREATE TABLE {prefix}reg_class (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    name TINYTEXT NULL,                                         -- Name of this registration type
+    descr TEXT NULL,                                            -- Description
+    PRIMARY KEY (id),
+    INDEX (reg_event)
+);
+
+----
+
+-- Rates and dates for a particular reg_class
+-- One or more per reg_class - **** Days should not overlap for a particular reg_class
+CREATE TABLE {prefix}reg_rate (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event table
+    reg_class INT NULL,                                         -- Pointer to reg_class table
+    name TINYTEXT NULL,                                         -- Namme of this rate
+    start_days INT NULL,                                        -- # of days before event time rate becomes available - may be selected as a date then coverted for storage
+    end_days INT NULL,                                          -- # of days before event time rate becomes unavailable
+    base_rate FLOAT,                                            -- Base rate to register
+    per_registrant FLOAT,                                       -- Rate per registrant
+    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_class)
+);
+
+----
+
+-- An account for a person submitting a registration or a registrant for an event
+-- Depending on the use of these entries may not have all data included
+-- A single account may be referenced as a person submitting registrations and/or a person registered for an event
+CREATE TABLE {prefix}account (
+    id INT NOT NULL AUTO_INCREMENT,
+    active BOOLEAN NULL,                                        -- Is active flag (may be accessed or used) - default is true
+    validated BOOLEAN NULL,                                     -- Flag indicating that the account has been validated - Set to false when recovering password
+    validation_code TINYTEXT NULL,                              -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation
+    registered_by INT NULL,                                     -- Account
+    member_id TINYTEXT NULL,                                    -- Free-form field for a member ID (not a GLM Associate member ID)
+    fname TINYTEXT NULL,                                        -- Account primary address
+    lname TINYTEXT NULL,
+    org TINYTEXT NULL,
+    title TINYTEXT NULL,
+    addr1 TINYTEXT NULL,
+    addr2 TINYTEXT NULL,
+    city TINYTEXT NULL,
+    state TINYTEXT NULL,
+    zip TINYTEXT NULL,
+    country TINYTEXT NULL,
+    phone TINYTEXT NULL,
+    fax TINYTEXT NULL,
+    bill_fname TINYTEXT NULL,                                   -- Last used billing information - Also stored in each registration request
+    bill_lname TINYTEXT NULL,
+    bill_org TINYTEXT NULL,
+    bill_title TINYTEXT NULL,
+    bill_addr1 TINYTEXT NULL,
+    bill_addr2 TINYTEXT NULL,
+    bill_city TINYTEXT NULL,
+    bill_state TINYTEXT NULL,
+    bill_zip TINYTEXT NULL,
+    bill_country TINYTEXT NULL,
+    bill_phone TINYTEXT NULL,
+    bill_fax TINYTEXT NULL,
+    email TINYTEXT NULL,
+    password TINYTEXT NULL,                                     -- Crypted password for login back into this account
+    email_ok BOOLEAN NULL,
+    is_member BOOLEAN NULL,                                     -- Is a member of the entity that owns the site
+    contact_id INT NULL,                                        -- Pointer to GLM Associate member contact record if account is for a member contact
+    contact_fname TINYTEXT NULL,
+    contact_lname TINYTEXT NULL,
+    contact_org TINYTEXT NULL,
+    contact_title TINYTEXT NULL,
+    contact_addr1 TINYTEXT NULL,
+    contact_addr2 TINYTEXT NULL,
+    contact_city TINYTEXT NULL,
+    contact_state TINYTEXT NULL,
+    contact_zip TINYTEXT NULL,
+    contact_country TINYTEXT NULL,
+    contact_phone TINYTEXT NULL,
+    contact_fax TINYTEXT NULL,
+    contact_email TINYTEXT NULL,
+    contact_email_ok BOOLEAN NULL,
+    guardian TINYTEXT NULL,
+    emer_contact TINYTEXT NULL,
+    emer_phone TINYTEXT NULL,
+    med_history TINYTEXT NULL,
+    allergy_med TINYTEXT NULL,
+    date_created DATE NULL,
+    notes TEXT NULL,                                            -- System operator's notes for this account - not visible to account owner
+    user_trace_info TINYTEXT NULL,                              -- IP Address of user computer and timestamp of last update
+    PRIMARY KEY (id),
+    INDEX (registered_by),
+    INDEX (member_id(10)),
+    INDEX (fname(10)),
+    INDEX (lname(10)),
+    INDEX (org(10)),
+    INDEX (city(10)),
+    INDEX (state(5)),
+    INDEX (zip(5)),
+    INDEX (email(10)),
+    INDEX (contact_id)
+);
+
+----
+
+-- A request for registration
+-- Has one or more reg_detail records associated with it
+CREATE TABLE {prefix}reg_request (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout)
+    validated BOOLEAN NULL,                                     -- Flag that indicates if request passed last validation with checkRegistrationRequest()
+    validation_message TEXT NULL,                               -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array
+    bill_fname TINYTEXT NULL,                                   -- Billing information used for this registration submission - Updates account billing address - Kept here for each request
+    bill_lname TINYTEXT NULL,
+    bill_org TINYTEXT NULL,
+    bill_title TINYTEXT NULL,
+    bill_addr1 TINYTEXT NULL,
+    bill_addr2 TINYTEXT NULL,
+    bill_city TINYTEXT NULL,
+    bill_state TINYTEXT NULL,
+    bill_zip TINYTEXT NULL,
+    bill_country TINYTEXT NULL,
+    bill_phone TINYTEXT NULL,
+    bill_email TINYTEXT NULL,
+    date_submitted DATE NULL,                                   -- Date of final submission (checkout complete)
+    pay_method INT NULL,                                        -- See payment_method in plugin.ini
+    payment_code TINYTEXT NULL,                                 -- Payment_code text (comp code) - if submitted and validated
+    status SMALLINT NULL,                                       -- See submission_status in plugin.ini
+    total DOUBLE PRECISION NULL,                                -- Total charge including all fees and taxes
+    total_discounts DOUBLE PRECISION NULL,                      -- Total of all comps and discounts
+    registrants SMALLINT NULL,                                  -- Total number of registrants in this cart
+    cc_type TINYINT NULL,                                       -- Credit Card type (if used) - See credit_card in plugin.ini
+    cc_name TINYTEXT NULL,
+    cc_numb TINYTEXT NULL,
+    cc_exp TINYTEXT NULL,
+    cc_cvv TINYTEXT NULL,
+    cc_conf TINYTEXT NULL,                                      -- Confirmation code back from card processor
+    cc_proc_mesg TINYTEXT NULL,                                 -- Message received from payment processor 
+    summary TEXT NULL,                                          -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user
+    mf_data TEXT NULL,                                          -- Any MagicForm data associated with registrant
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    user_trace_info TEXT NULL,                                  -- IP Address of user computer and timestamp
+    date_created DATETIME NULL,                                 -- Date request was first created
+    last_update DATETIME NULL,                                  -- Last update date/time - Used for timing out pending carts and attendee counts
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (date_submitted)
+);
+
+----
+
+-- Registration for a specific event
+-- Has one or more reg_selected_rate records associated with it 
+CREATE TABLE {prefix}reg_request_event (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_request INT NULL,                                       -- Pointer to reg_request table
+    reg_event INT NULL,                                         -- Pointer to reg_event
+    event_name TINYTEXT NULL,                                   -- Name of Event so it will always be in the cart data
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_request),
+    INDEX (reg_event),
+    INDEX (reg_time)
+);
+
+----
+
+--  A particular reg_class selected
+--  Has one or more reg_request_rate records associated with it 
+CREATE TABLE {prefix}reg_request_class (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    class INT NULL,                                             -- Pointer to event reg_class table - False (0) if registration class no longer exits
+    class_name TINYTEXT NULL,                                   -- Name of event class at the time selected
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request_event)
+);
+
+----
+
+--  A particular reg_rate selected
+--  Has one or more reg_request_registrant records associated with it
+CREATE TABLE {prefix}reg_request_rate (
+    id INT NOT NULL AUTO_INCREMENT,
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
+    rate INT NULL,                                              -- Pointer to event reg_rate table - False (0) if registration rate no longer exists
+    rate_name TINYTEXT NULL,                                    -- Name of event class rate at the time selected
+    base_rate FLOAT,                                            -- Base rate at time of registration
+    per_registrant FLOAT,                                       -- Per Registrant Rate at time of registration
+    registrant_credits TINYINT NULL,                            -- Number of registrants included in base rate at time of registration
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class)
+);
+
+----
+
+--  A specific registrant for a selected registration rate
+CREATE TABLE {prefix}reg_request_registrant (
+    id INT NOT NULL AUTO_INCREMENT,
+    account INT NULL,                                           -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed
+    reg_event INT NULL,                                         -- Pointer to reg_event entry
+    reg_time INT NULL,                                          -- Pointer reg_time entry
+    event_datetime DATETIME NULL,                               -- Date and time of event time selected so it will always be in the cart
+    reg_request INT NULL,                                       -- Pointer to the registration request record
+    reg_request_event INT NULL,                                 -- Pointer to reg_request_event table entry
+    reg_request_class INT NULL,                                 -- Pointer to reg_request_class table entry
+    reg_request_rate INT NULL,                                  -- Pointer to reg_request_rate table entry
+    fname TINYTEXT NULL,                                        -- First name of registrant at the time of selection
+    lname TINYTEXT NULL,                                        -- Last name of registrant at the time of selection
+    notes TEXT NULL,                                            -- System operator's notes for this registration request
+    PRIMARY KEY (id),
+    INDEX (account),
+    INDEX (reg_event),
+    INDEX (reg_time),
+    INDEX (reg_request),
+    INDEX (reg_request_event),
+    INDEX (reg_request_class),
+    INDEX (reg_request_rate)
+);
+
+----
+
+-- Insert into management table
+INSERT INTO {prefix}management
+    (
+    canonical_reg_page,
+    reg_org_name,
+    reg_org_short,
+    reg_org_address,
+    reg_org_city,
+    reg_org_state,
+    reg_org_zip,
+    reg_org_phone,
+    reg_org_toll_free,
+    reg_org_internal_email,
+    reg_org_from_email,
+    reg_payment_methods,
+    reg_proc_methods,
+    reg_cc_accepts,
+    reg_authorize_net_login,
+    reg_authorize_net_key,
+    reg_authorize_net_test,
+    reg_authorize_net_conf,
+    reg_authorize_net_merchant_email,
+    reg_merchant_solutions_acctid,
+    reg_merchant_solutions_merchantpin,
+    reg_merchant_solutions_test,
+    reg_full_billing_info,
+    reg_bill_info_req_no_charge,
+    reg_bill_info_req_comp_code,
+    reg_bill_info_req_cash,
+    reg_bill_info_req_check,
+    reg_bill_info_req_credit_card,
+    reg_bill_info_req_merchant_call,
+    reg_medical_info
+    )
+    VALUES
+    (
+    'registrations',                                            -- reg_canonical_reg_page,
+    'Gaslight Media',                                           -- reg_org_name,
+    'GLM',                                                      -- reg_org_short,
+    '120 E. Lake St.',                                          -- reg_org_address,
+    'Petoskey',                                                 -- reg_org_city,
+    'MI',                                                       -- reg_org_state,
+    '49770',                                                    -- reg_org_zip,
+    '231-487-0692',                                             -- reg_org_phone,
+    '800-123-1234',                                             -- reg_org_toll_free,
+    'internal@gaslightmedia.com',                               -- reg_org_internal_email,
+    'info@gaslightmedia.com',                                   -- reg_org_from_email,
+    0,                                                          -- reg_payment_methods,
+    0,                                                          -- reg_proc_methods,
+    0,                                                          -- reg_cc_accepts,
+    '',                                                         -- reg_authorize_net_login,
+    '',                                                         -- reg_authorize_net_key,
+    1,                                                          -- reg_authorize_net_test,
+    true,                                                       -- reg_authorize_net_conf
+    '',                                                         -- reg_authorize_net_merchant_email,
+    '',                                                         -- reg_merchant_solutions_acctid,
+    '',                                                         -- reg_merchant_solutions_merchantpin,
+    1,                                                          -- reg_merchant_solutions_test,
+    true,                                                       -- reg_full_billing_info,
+    0,                                                          -- reg_bill_info_req_no_charge,
+    0,                                                          -- reg_bill_info_req_comp_code,
+    0,                                                          -- reg_bill_info_req_cash,
+    0,                                                          -- reg_bill_info_req_check,
+    0,                                                          -- reg_bill_info_req_credit_card,
+    0,                                                          -- reg_bill_info_req_merchant_call,
+    true                                                        -- reg_medical_info,
+    );
+
+----
+
+-- Insert into settings_terms table
+INSERT INTO {prefix}settings_terms
+    (
+    reg_term_registrations_name,
+    reg_term_registration,
+    reg_term_registration_cap,
+    reg_term_registration_plur,
+    reg_term_registration_plur_cap,
+    reg_term_register,
+    reg_term_register_cap,
+    reg_term_registers,
+    reg_term_registering,
+    reg_term_registering_cap,
+    reg_term_registered,
+    reg_term_registered_cap,
+    reg_term_attendee,
+    reg_term_attendee_cap,
+    reg_term_attendee_plur,
+    reg_term_attendee_plur_cap,
+    reg_term_attending,
+    reg_term_attended,
+    reg_term_registered_user,
+    reg_term_registered_user_cap,
+    reg_term_registered_user_plur,
+    reg_term_registered_user_plur_cap,
+    reg_term_id,
+    reg_term_id_cap,
+    reg_term_id_plur,
+    reg_term_id_plur_cap,
+    reg_term_password,
+    reg_term_password_cap,
+    reg_term_password_plur,
+    reg_term_password_plur_cap,
+    reg_term_instructor,
+    reg_term_instructor_cap,
+    reg_term_instructor_plur,
+    reg_term_instructor_plur_cap,
+    reg_term_payment_code,
+    reg_term_payment_code_cap,
+    reg_term_payment_code_plur,
+    reg_term_payment_code_plur_cap,
+    reg_term_registration_button,
+    reg_term_contact_information
+    )
+    VALUES
+    (
+    'Event Registrations',                                      -- reg_term_registrations_name
+    'registration',                                             -- reg_term_registration
+    'Registration',                                             -- reg_term_registration_cap
+    'registrations',                                            -- reg_term_registration_plur
+    'Registrations',                                            -- reg_term_registration_plur_cap
+    'register',                                                 -- reg_term_registe
+    'Register',                                                 -- reg_term_register_cap
+    'registers',                                                -- reg_term_registers
+    'registering',                                              -- reg_term_registering
+    'Registering',                                              -- reg_term_registering_cap
+    'registered',                                               -- reg_term_registered
+    'Registered',                                               -- reg_term_registered_cap
+    'attendee',                                                 -- reg_term_attendee
+    'Attendee',                                                 -- reg_term_attendee_cap
+    'attendees',                                                -- reg_term_attendee_plur
+    'Attendees',                                                -- reg_term_attendee_plur_cap
+    'attending',                                                -- reg_term_attending
+    'attended',                                                 -- reg_term_attended
+    'user',                                                     -- reg_term_registered_user
+    'User',                                                     -- reg_term_registered_user_cap
+    'users',                                                    -- reg_term_registered_user_plur
+    'Users',                                                    -- reg_term_registered_user_plur_cap
+    'ID',                                                       -- reg_term_id
+    'ID',                                                       -- reg_term_id_cap
+    'IDs',                                                      -- reg_term_id_plur
+    'IDs',                                                      -- reg_term_id_plur_cap
+    'password',                                                 -- reg_term_password
+    'passwords',                                                -- reg_term_password_cap
+    'Password',                                                 -- reg_term_password_plur
+    'Passwords',                                                -- reg_term_password_plur_cap
+    'instructor',                                               -- reg_term_instructor
+    'Instructor',                                               -- reg_term_instructor_cap
+    'instructors',                                              -- reg_term_instructor_plur
+    'Instructors',                                              -- reg_term_instructor_plur_cap
+    'payment code',                                             -- reg_term_payment_code
+    'Payment code',                                             -- reg_term_payment_code_cap
+    'payment codes',                                            -- reg_term_payment_code_plur
+    'Payment codes',                                            -- reg_term_payment_code_plur_cap
+    'Register for Event',                                       -- reg_term_registration_button
+    'Contact Information'                                       -- reg_term_contact_information
+    );
+
+----
+
+-- Insert into misc table
+INSERT INTO {prefix}misc
+    (
+    reg_bulletin,
+    cart_page_text,
+    checkout_page_text,
+    summary_page_text,
+    reg_terms,
+    notify_subject,
+    notify_text,
+    instr_notify_subject,
+    instr_notify_text,
+    submission_notify_subject,
+    submission_notify_text,
+    registrant_notify_subject,
+    registrant_notify_text,
+    submission_ack_subject,
+    submission_ack_text,
+    registrant_ack_subject,
+    registrant_ack_text
+    )
+    VALUES
+    (
+    'Registration Bulletin Text',
+    'Text for top of Cart Page',
+    'Text for top of Checkout Page',
+    'Text for top of Summary Page',
+    'Terms and Conditions',
+    'Subject of notification to site owner of a registration',
+    'Text of notification to site owner of a registration',
+    'Subject of notification to instructor of registration',
+    'Text for notification to instructor of registration',
+    'Subject of notification to person submitting registration',
+    'Text of notification to person submitting registration',
+    'Subject for notification to registrant',
+    'Text for notification to registrant',
+    'Subject of acknowledgement to person submitting registration',
+    'Text of acknowledgement to person submitting registration',
+    'Subject of acknowledgement to registrant',
+    'Text of acknowledgement to registrant'
+    );
index 5af2dd2..e1b0d38 100644 (file)
@@ -30,7 +30,8 @@ $glmMembersRegistrationsDbVersions = array(
     '0.0.14' => array('version' => '0.0.14', 'tables' => 20, 'date' => '10/13/2017'),
     '0.0.15' => array('version' => '0.0.15', 'tables' => 15, 'date' => '10/18/2017'),
     '0.0.16' => array('version' => '0.0.16', 'tables' => 15, 'date' => '10/24/2017'),
-    '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/3/2017')
+    '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/3/2017'),
+    '0.0.18' => array('version' => '0.0.18', 'tables' => 15, 'date' => '11/7/2017')
 );
 
 
diff --git a/setup/databaseScripts/drop_database_V0.0.17.sql b/setup/databaseScripts/drop_database_V0.0.17.sql
deleted file mode 100644 (file)
index 1451bb2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.1.23
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE IF EXISTS
-    {prefix}management,
-    {prefix}settings_terms,
-    {prefix}misc,
-    {prefix}payment_code,
-    {prefix}reg_event,
-    {prefix}reg_time,
-    {prefix}reg_time_pending,
-    {prefix}reg_class,
-    {prefix}reg_rate,
-    {prefix}account,
-    {prefix}reg_request,
-    {prefix}reg_request_event,
-    {prefix}reg_request_class,
-    {prefix}reg_request_rate,
-    {prefix}reg_request_registrant
-;
-
diff --git a/setup/databaseScripts/drop_database_V0.0.18.sql b/setup/databaseScripts/drop_database_V0.0.18.sql
new file mode 100644 (file)
index 0000000..1451bb2
--- /dev/null
@@ -0,0 +1,24 @@
+-- Gaslight Media Members Database
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.1.23
+-- Database Deletion Script
+-- Note: Tables with DELETE CASCADE must appear before referenced table
+
+DROP TABLE IF EXISTS
+    {prefix}management,
+    {prefix}settings_terms,
+    {prefix}misc,
+    {prefix}payment_code,
+    {prefix}reg_event,
+    {prefix}reg_time,
+    {prefix}reg_time_pending,
+    {prefix}reg_class,
+    {prefix}reg_rate,
+    {prefix}account,
+    {prefix}reg_request,
+    {prefix}reg_request_event,
+    {prefix}reg_request_class,
+    {prefix}reg_request_rate,
+    {prefix}reg_request_registrant
+;
+
diff --git a/setup/databaseScripts/update_database_V0.0.18.sql b/setup/databaseScripts/update_database_V0.0.18.sql
new file mode 100644 (file)
index 0000000..42fc5fa
--- /dev/null
@@ -0,0 +1,37 @@
+-- Gaslight Media Members Database  - Registratiuons Add-On
+-- File Created: 10/03/17 11:00:00
+-- Database Version: 0.0.16
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+ALTER TABLE {prefix}reg_request ADD COLUMN bill_phone TINYTEXT;
+
+----
+
+ALTER TABLE {prefix}reg_request ADD COLUMN bill_email TINYTEXT;
+
+----
+
+ALTER TABLE {prefix}reg_request ADD COLUMN total_discounts DOUBLE PRECISION;
+
+----
+
+ALTER TABLE {prefix}reg_request ADD COLUMN registrants SMALLINT;
+
+----
+
+ALTER TABLE {prefix}reg_request ADD COLUMN cc_proc_mesg TINYTEXT;
+
+----
+
+ALTER TABLE {prefix}reg_request DROP COLUMN payment_code;
+
+----
+
+ALTER TABLE {prefix}reg_request DROP COLUMN mf_data;
+
+----
+
+ALTER TABLE {prefix}reg_request CHANGE user_trace_info user_trace_info TEXT;
\ No newline at end of file
index 063f008..8cb4ce9 100644 (file)
@@ -63,7 +63,8 @@ $glmMembersRegistrationsAddOnValidActions = array(
             'account'                   => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
             'regAdmin'                  => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
             'regFront'                  => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
-            'cartLinkWidget'                  => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
+            'cartLinkWidget'            => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
+            'summaryContent'            => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG
         ),
         'registrations' => array(
             'index'                     => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG,
index 2772ed1..df969ad 100644 (file)
@@ -14,6 +14,7 @@
 {if $haveCart}              
     <form id="checkoutForm" href="{$regUrl}" method="post">
         <input type="hidden" name="page" value="checkoutProcess">
+        <input type="hidden" name="active" value="{$regAccount.fieldData.active.value}">
 
         <a href="#cart-summary">See summary of registration request and charges below</a>
 
   {else}
                     <div class="glm-reg-row">
                         <div class="glm-large-3 glm-columns glm-reg-nowrap">E-Mail Address:</div>
-                        <div class="glm-large-9 glm-columns">{$regAccount.fieldData.email}</div>
+                        <div class="glm-large-9 glm-columns">
+                            {$regAccount.fieldData.email}
+                            <input type="hidden" name="email" value="{$regAccount.fieldData.email}"> {* Required to keep E-Mail address from being cleared *}
+                        </div>
                     </div>
   {/if}
                     <div class="glm-reg-row">
                         <div class="glm-reg-row">
                             <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_numb} glm-reg-required{/if}">Card Number:</div>
                             <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_numb} glm-reg-fail{/if}">
-                                <input type="text" placeholder="Numbers Only" name="cc_numb" value="{$regAccount.fieldData.cc_numb}"{if $regAccount.fieldRequired.cc_numb} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                                <input type="text" placeholder="Numbers Only" name="cc_numb" value="{$regAccount.fieldData.cc_numb}"{if $regAccount.fieldRequired.cc_numb} required{/if} class="payMethodInput payMethodInput_{$pm} cc-input">
                            </div>
                         </div>
                         <div class="glm-reg-row">
                             <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_exp} glm-reg-required{/if}">Card Expiration:</div>
                             <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_exp} glm-reg-fail{/if}">
-                                <input type="text" placeholder="MM/YY" name="cc_exp" value="{$regAccount.fieldData.cc_exp}"{if $regAccount.fieldRequired.cc_exp} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                                <input type="text" placeholder="MM/YY" name="cc_exp" value="{$regAccount.fieldData.cc_exp}"{if $regAccount.fieldRequired.cc_exp} required{/if} class="payMethodInput payMethodInput_{$pm} expire-input">
                             </div>
                         </div>
                         <div class="glm-reg-row">
                             <div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.cc_cvv} glm-reg-required{/if}">CVV:</div>
                             <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.cc_cvv} glm-reg-fail{/if}">
-                                <input type="text" placeholder="3 digit number on back of card" name="cc_cvv" value="{$regAccount.fieldData.cc_cvv}"{if $regAccount.fieldRequired.cc_cvv} required{/if} class="payMethodInput payMethodInput_{$pm}">
+                                <input type="text" placeholder="3 or 4 digit security code on back of card" name="cc_cvv" value="{$regAccount.fieldData.cc_cvv}"{if $regAccount.fieldRequired.cc_cvv} required{/if} class="payMethodInput payMethodInput_{$pm} cvv-input">
                             </div>
                         </div>                    
                     </div>
                         <p>*** Pay Pal ****</p>
                     </div>
     {/if}
-    
-    
-    
                 </div>
                 <div class="glm-large-6 glm-columns">
                     <h4>Global Custom Fields Go Here</h4>
                         <div class="glm-large-12 glm-columns"></div>Custom fields that are event, level, rate, or registrant specific will be collected on registration selection page.</div>
                     </dic>
                 </div>
-  {/if}
+  {/if} {* / total charges > 0 *}
             </div>
             <div class="glm-reg-row">
                 <div class="glm-large-12 glm-columns">
                             <h5>{$event.event_name}:</h5>
                             <input id="terms_{$event.id}" type="checkbox" name="terms_{$event.id}" value="accept" required><label for="terms_{$event.id}"> {$event.event_terms}</label><br>
                             *** Any added fields go here ***
-
                         </div>
                     </div>
       {/if}
                 </td>
                 <td style="text-align: right;">${$cart.totalCharges|number_format:2}</td>
             </tfoot>
-{/if}
+{/if} {* / if have cart *}
         </table>
 
 
             }
 
         });
+
+        // Various input masks for credit card input
+        $(".cc-input").mask("9999999999999?999");
+        $(".expire-input").mask("99/99");
+        $(".cvv-input").mask("999?9");
         
     });
 </script>
\ No newline at end of file
index da599af..25c5728 100644 (file)
@@ -1,4 +1,4 @@
-{include file='front/registrations/header.html'}
+{include file='front/registrations/header.html'} {$ajaxUrl}
 <div id="glm-reg-list" class="glm-row">
 {if $haveRegEvents}
     {foreach $regEvents as $event}
index e69de29..f2f7147 100644 (file)
@@ -0,0 +1,17 @@
+
+<div id="checkoutSuccess">
+    <div>
+        <h3>Summary of Submitted Registration Request</h3>
+    </div>
+    <div>
+        {$misc.summary_page_text}
+    </div>
+    <div>
+        <iframe src="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=summaryContent&request={$requestId}&check={$summaryCheck}" 
+            style="border:none; width: 100%"
+            onload="this.style.height=this.contentDocument.body.scrollHeight +'px'; this.style.width=this.contentDocument.body.scrollWidth +'px';"
+            onresize="this.style.height=this.contentDocument.body.scrollHeight +'px'; this.style.width=this.contentDocument.body.scrollWidth +'px';"
+        ></iframe>
+    </div>
+
+</div>
diff --git a/views/front/registrations/summaryStore.html b/views/front/registrations/summaryStore.html
new file mode 100644 (file)
index 0000000..4cbda05
--- /dev/null
@@ -0,0 +1,193 @@
+<html>    
+    <head>
+        <style>
+            h3 {
+                color: #729d8d;
+            }
+            .container-table {
+                background-color: white;
+                border: 1px black solid;
+                border-collapse: collapse;                
+            }
+            .container-table-td{
+                padding: 2px;
+                border: 1px solid black;
+            }
+            .info-table td {
+                padding: 2px;
+            }
+            .summary-table {
+                background-color: white;
+                border: 1px black solid;
+                border-collapse: collapse;                
+            }
+            thead {
+                background-color: #eee;
+            }
+            tfoot {
+                font-weight: bold;
+            }
+            th {
+                text-align: left;
+                padding: .3rem;
+            }
+            td {
+                text-align: left;
+                padding: .2rem;
+            }
+            .td-right {
+                text-align: right;
+            }
+            .event-line {
+                padding-top: 1rem;
+            }
+        </style>
+    </head>
+    <body>
+        <div>
+            {$misc.submission_ack_text}
+        </div>
+    
+        <h3>Checkout Summary</h3>
+        <table class="container-table" width="100%">
+            <tr>
+                <td class="container-table-td" valign="top">
+                    <table class="info-table" width="100%">
+                        <thead>
+                            <tr><th colspan="2">Submission</th></tr>
+                        </thead>
+                        <tbody>
+                            <tr>
+                                <th valign="top">Requested By:</th>
+                                <td>
+                                    {$account.fname} {$account.lname}{if $account.title}, {$account.title}{/if}<br>
+                                    {if $account.org}{$account.org}<br>{/if}
+                                    {$account.addr1}<br>
+                                    {if $account.addr2}{$account.addr2}<br>{/if}
+                                    {$account.city}, {$account.state} {$account.zip} {$account.country.value}<br>
+                                </td>
+                            </tr>
+                    {if $account.phone}
+                            <tr><th>Phone:</th><td>{$account.phone}</td></tr>
+                    {/if}
+                    {if $account.fax}
+                            <tr><th>title:</th><td>{$account.title}</td></tr>
+                    {/if}
+                            <tr><th>E-Mail Address:</th><td>{$account.email}</td></tr>                            
+                            <tr><th>Request #:</th><td>{$request.id}</td></tr>
+                            <tr><th>Submitted:</th><td>{$request.date_submitted.datetime}</td></tr>
+                            <tr><th>Status:</th><td>{$request.status.name}</td></tr>
+                        </tbody>
+                    </table>
+                </td>
+                <td valign="top">
+                    <table class="info-table" width="100%">
+                        <thead>
+                            <tr><th colspan="2">Billing</th></tr>
+                        </thead>
+                        <tbody>
+                            <tr>
+                                <th valign="top">Contact:</th>
+                                <td>
+                                    {$request.bill_fname} {$request.bill_lname}{if $request.bill_title}, {$request.bill_title}{/if}<br>
+                                    {if $request.bill_org}{$request.bill_org}<br>{/if}
+                                    {$request.bill_addr1}<br>
+                                    {if $request.bill_addr2}{$request.bill_addr2}<br>{/if}
+                                    {$request.bill_city}, {$request.bill_state} {$request.bill_zip} {$request.country.bill_value}<br>
+                                </td>
+                            </tr>
+                    {if $request.bill_phone}
+                            <tr><th>Phone:</th><td>{$request.bill_phone}</td></tr>
+                    {/if}
+                    {if $request.bill_email}
+                            <tr><th>E-Mail Address:</th><td>{$request.bill_email}</td></tr>
+                    {/if}
+                        </tbody>
+                    </table>
+                    {if $request.pay_method.value == $payMethodsNumb.CreditCard}
+                    <table class="info-table" width="100%">
+                        <thead>
+                            <tr><th colspan="2">Payment</th></tr>
+                        </thead>
+                        <tbody>
+                            <tr><th>Payment Method:</th><td>{$request.pay_method.name}</td></tr>
+                            <tr><th>Credit Card:</th><td>{$request.cc_type.name}</td></tr>
+                            <tr><th>Name on Card:</th><td>{$request.cc_name}</td></tr>
+                            <tr><th>Card Number:</th><td>{$request.cc_numb}</td></tr>
+                            <tr><th>Expiration:</th><td>{$request.cc_exp}</td></tr>
+                            <tr><th>Confirmation Code:</th><td>{$request.cc_conf}</td></tr>
+                            <tr><th>Total Charged:</th><td>{$request.total}</td></tr>
+                    {/if}
+                                  
+                        </tbody>
+                    </table>
+                </td>
+        </table>
+        <h3>Registrations</h3>
+        <table class="summary-table" width="100%">
+            <thead>
+                <tr>
+                    <th>Registering</th>
+                    <th>Registrant</th>
+                    <th>Date/Time</th>
+                    <th>Discount</th>
+                    <th>Rate</th>
+                </tr>
+            </thead>
+            <tbody>
+      {foreach $cart.events as $event}
+                <tr>
+                    <th colspan="5" class="event-line">Event: {$event.event_name}</th>
+                </tr>
+        {foreach $event.classes as $class}
+                <tr>
+                    <td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;{$class.class_name}</td>
+                </tr>
+          {foreach $class.rates as $rate}
+                <tr>
+                    <td colspan="4">
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$rate.rate_name}
+                        - Base Rate ({$rate.registrant_credits} registrants included)
+                    </td>
+                    <td class="td-right">{$rate.rateBaseCharge|number_format:2}</td>
+                </tr>
+            {foreach $rate.registrants as $registrant}
+                <tr>
+                    <td>&nbsp;</td>
+                    <td>{$registrant.fname} {$registrant.lname}</td>
+                    <td>{$registrant.event_time}</td>
+                    <td class="td-right">
+                        {if $registrant.registrantDiscounts > 0}
+                            {$registrant.registrantDiscounts|number_format:2}
+                        {else}
+                            &nbsp;
+                        {/if}
+                    </td>
+                    <td class="td-right">
+                        {if $registrant.registrantRate > 0}
+                            {$registrant.registrantRate|number_format:2}
+                        {else}
+                            (included)
+                        {/if}
+                    </td>
+                </tr>
+            {/foreach}
+          {/foreach}
+        {/foreach}
+      {/foreach}
+            </tbody>
+            <tfoot>
+                <td colspan="2">&nbsp;</td>
+                <td>Total registrants: {$cart.totalRegistrants}</td>
+                <td class="td-right">
+                    {if $cart.totalDiscounts > 0}
+                        ${$cart.totalDiscounts|number_format:2}
+                    {else}
+                        &nbsp;
+                    {/if}
+                </td>
+                <td class="td-right">${$cart.totalCharges|number_format:2}</td>
+            </tfoot>
+        </table>
+    </body>
+</html>
\ No newline at end of file