Removed addTimeToCart() from regCartSupport class. No longer needed.
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 23 Oct 2017 18:28:28 +0000 (14:28 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 23 Oct 2017 18:28:28 +0000 (14:28 -0400)
Removed replaceRequestingAccount() from regCartSupport class. No longer needed.
Fixed problem with comparison of rate date number.
Fixed loss of event ID when merging time and rate for use with registration page.

classes/data/dataRegEvent.php
classes/regCartSupport.php
js/adminRegApp.js
js/models/admin/regRate.js
js/views/admin/regRate.js
models/front/registrations/registration.php
setup/databaseScripts/create_database_V0.0.15.sql
views/admin/registrations/eventEditLevels.html

index 30c3d7a..4c5d754 100644 (file)
@@ -716,7 +716,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
 
                                     // Preserve rate ID and don't let it trash the time ID
                                     $rv['rate_id'] = $rv['id'];
-                                    unset($rv['id']);
+                                    unset($rv['id'], $rv['reg_event']);
 
                                     $this->regEventData['reg_class'][$ck]['times'][$tv['event_time']] = array_merge($tv, $rv);
                                     $this->regEventData['reg_class'][$ck]['hasTimes'] = true;
index c2b081f..70dd763 100644 (file)
@@ -232,9 +232,6 @@ class GlmRegCartSupport
                                         // Add registrant account to accounts table
                                         $this->addAccountToCart($registrant['account']);
 
-                                        // Add time data to reg_times table
-// ****                                        $this->addTimeToCart($registrant['reg_time']);
-
                                     } // Each Registrant
                                 }
 
@@ -648,22 +645,6 @@ class GlmRegCartSupport
 
     }
 
-    /*
-     * Update request to use another account
-     *
-     * @param integer $requestId
-     * @param integer $accountId
-     *
-     * @return boolean True is success otherwise false
-     * @access public
-     */
-    public function replaceRequestingAccount($requestId = false, $accountId = false)
-    {
-
-        // **** NEED TO COMPLETE THIS FUNCTION ****
-
-    }
-
     /*
      * Check if logged in user has permission to access cart
      *
@@ -847,42 +828,6 @@ class GlmRegCartSupport
 
     }
 
-    /*
-     * Add a reg_time record to the times list in the temoporary cart array if not already there
-     *
-     *
-     * @param integer $timeId
-     *
-     * @return boolean Success or fail
-     * @access public
-     */
-    public function addTimeToCart($timeId)
-    {
-
-        // Check the supplied reg_time ID
-        $timeId = ($timeId-0);
-        if ($timeId == 0) {
-            return false;
-        }
-
-        // Try to get the account record for the person who submitted (is submitting) the request
-        $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config);
-        $time = $RegTime->getEntry($timeId);
-
-        // If time was not found
-        if (!$time) {
-            return false;
-        }
-
-        // If the time doesn't exist in the times array, add it
-        if (!isset($this->cart['times'][$timeId])) {
-            $this->cart['times'][$time['id']] = $time;
-        }
-
-        return true;
-
-    }
-
     /*
      * Purge old reg_time_pending entries
      *
index ef66a77..302a213 100644 (file)
@@ -65,8 +65,8 @@ app.Models.Admin.RegRate = Backbone.Model.extend({
         name: '',
         start_days: 0,
         end_days: 0,
-        base_rate: 0.0,
-        per_registrant: 0.0,
+        base_rate: 0.00,
+        per_registrant: 0.00,
         registrant_credits: 0
     },
 
@@ -419,7 +419,7 @@ app.Views.Admin.RegRate = Backbone.View.extend({
         if (v == '')  {
             v = 0;
         }
-        v = '$' + Number(v).toFixed(2);
+        v = Number(v).toFixed(2);
         return v;
     },
 
@@ -572,8 +572,8 @@ app.Views.Admin.RegRate = Backbone.View.extend({
         var datesError = '';
         
         var cur = model.cid;                // ID of current rate
-        var start = current.start_days;
-        var end = current.end_days;
+        var start = parseInt(current.start_days);
+        var end = parseInt(current.end_days);
      
         if (start < end) {
             datesError += 'Start days must be greater than end days. ';
index 231fcff..0963609 100644 (file)
@@ -12,8 +12,8 @@ app.Models.Admin.RegRate = Backbone.Model.extend({
         name: '',
         start_days: 0,
         end_days: 0,
-        base_rate: 0.0,
-        per_registrant: 0.0,
+        base_rate: 0.00,
+        per_registrant: 0.00,
         registrant_credits: 0
     },
 
index 8311adb..a250f00 100644 (file)
@@ -40,7 +40,7 @@ app.Views.Admin.RegRate = Backbone.View.extend({
         if (v == '')  {
             v = 0;
         }
-        v = '$' + Number(v).toFixed(2);
+        v = Number(v).toFixed(2);
         return v;
     },
 
@@ -193,8 +193,8 @@ app.Views.Admin.RegRate = Backbone.View.extend({
         var datesError = '';
         
         var cur = model.cid;                // ID of current rate
-        var start = current.start_days;
-        var end = current.end_days;
+        var start = parseInt(current.start_days);
+        var end = parseInt(current.end_days);
      
         if (start < end) {
             datesError += 'Start days must be greater than end days. ';
index e43bc2a..caaf630 100644 (file)
             $this->postProcAddedEventData = true;
             $regEvent = $this->getEventForRegistration($eventRegID);
 
-            //echo '<pre>$regEvent: ' . print_r( $regEvent, true ) . '</pre>';
+            // echo '<pre>$regEvent: ' . print_r( $regEvent, true ) . '</pre>';
 
             // Create an $event array with the event data.
             $event = array(
index 414f752..5ba3b76 100644 (file)
@@ -270,6 +270,7 @@ 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 1dc0e57..a8b5ed2 100644 (file)
                                 <td>
                                     <span class="glm-nowrap">Base $<input class="rate-base-rate glm-form-text-input-veryshort" type="text" name="base_rate_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (base_rate) { %><%- base_rate %><% } %>"></span>
                                     <span class="glm-nowrap">Per-Registrant $<input class="rate-per-registrant glm-form-text-input-veryshort" type="text" name="per_registrant_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (per_registrant) { %><%- per_registrant %><% } %>"></span>
-                                    <span class="glm-nowrap">Registrant Credits <input class="rate-registrant-credits glm-form-text-input-veryshort" type="text" name="registrant_credits_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (registrant_credits) { %><%- registrant_credits %><% } %>"></span>
+                                    <span class="glm-nowrap">Registrant Credits <input class="rate-registrant-credits glm-form-text-input-veryshort" type="text" name="registrant_credits_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (registrant_credits) { %><%= registrant_credits %><% } %>"></span>
                                     <br>
                                 </td>
                             </tr>