Fixed issues with deletion of custom fields and problems with calculating dates for...
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 12 Dec 2017 21:09:45 +0000 (16:09 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 12 Dec 2017 21:09:45 +0000 (16:09 -0500)
classes/data/dataRegEvent.php
views/admin/registrations/eventEditCustomFields.html
views/front/registrations/registration.html

index 9d18f31..1b92734 100644 (file)
@@ -882,49 +882,51 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
                 // For each event time except non-time-specific entry
                 foreach ($this->regEventData['reg_time'] as $regTimeKey=>$regTime) {
 
-                    // Try to find a current rate for this time - within the start and end days before this time
-                    foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
+                    // If event time is for non-time-specific event - Calculate from the earlies and latest event times
+                    if ($regTime['non_time_specific']['value']) {
 
-                        // Calculate earliest and latest days for this rate calculated from the start of this event time
-                        $earliestTime   = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
-                        $latestTime     = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['end_days']-1).' days');
 
-                        // If it's time to register with this time/rate - Add it to the class data
-                        if (time() > $earliestTime && time() < $latestTime) {
+                        // Try to find a current rate for this time - within the start and end days before this time
+                        foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
 
-                            // Preserve rate ID and don't let it trash the time ID
-                            $regRate['rate_id'] = $regRate['id'];
-                            unset($regRate['id']);
+                            // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event
+                            $earliestTime   = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
+                            $latestTime     = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.($regRate['end_days']).' days');
 
-                            $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
-                            $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
-                        }
+                            // If it's time to register with this time/rate - Add it to the class data
+                            if (time() >= $earliestTime && time() <= $latestTime && false) {
 
-                    }
+                                // Preserve rate ID and don't let it trash the time ID
+                                $regRate['rate_id'] = $regRate['id'];
+                                unset($regRate['id'], $regRate['reg_event']);
 
-                }
+                                $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
+                                $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
+                            }
 
+                        }
+
+                    // If time specific event - calculate based on the time entries
+                    } else {
 
-                // If event time is for non-time-specific event
-                if ($regTime['non_time_specific']) {
+                        // Try to find a current rate for this time - within the start and end days before this time
+                        foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
 
-                    // Try to find a current rate for this time - within the start and end days before this time
-                    foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) {
+                            // Calculate earliest and latest days for this rate calculated from the start of this event time
+                            $earliestTime   = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days');
+                            $latestTime     = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['end_days']-1).' days');
 
-                        // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event
-                        // ** We may want to make it optional to use the last day of the event ???
-                        $earliestTime   = strtotime(date('m/d/Y', $this->regEventData['firstTime']['start_time']['timestamp']).' -'.$regRate['start_days'].' days');
-                        $latestTime     = strtotime(date('m/d/Y', $this->regEventData['firstTime']['start_time']['timestamp']).' -'.($regRate['end_days']-1).' days');
+                            // If it's time to register with this time/rate - Add it to the class data
+                            if (time() > $earliestTime && time() < $latestTime) {
 
-                        // If it's time to register with this time/rate - Add it to the class data
-                        if (time() > $earliestTime && time() < $latestTime) {
+                                // Preserve rate ID and don't let it trash the time ID
+                                $regRate['rate_id'] = $regRate['id'];
+                                unset($regRate['id']);
 
-                            // Preserve rate ID and don't let it trash the time ID
-                            $regRate['rate_id'] = $regRate['id'];
-                            unset($regRate['id'], $regRate['reg_event']);
+                                $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
+                                $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
+                            }
 
-                            $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate);
-                            $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true;
                         }
 
                     }
@@ -933,9 +935,6 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
 
             } // Have rates for this class
 
-            // Drop the rate supplied rate data that's now merged with time and saved with the class.
-//            unset($this->regEventData['reg_class'][$regClassKey]['reg_rate']);
-
         } // for each class
 
         // Get rid of all of the recurrence data - No longer needed
index 4794bcf..b1d7da0 100644 (file)
@@ -48,7 +48,7 @@
     <h3>Requested for each attendee for this event</h3>
     <p>These are additional fields of information that will be requested for each registrant for this event.</p>
     <p> 
-        {assign var="attendeeFid" value="glm_reg_customfields_reg_attendee_`$regEventID`"}
+        {assign var="attendeeFid" value="glm_reg_customfields_reg_event_attendee_`$regEventID`"}
         {apply_filters('glm-members-customfields-edit', '', $attendeeFid)}
     </p>
 
index ad31153..b1f29c6 100644 (file)
                     <!-- Selected Time: <span id="add_reg-select-time-display"></span> -->
                     <input type="hidden" id="add_reg-select-time">
                 {/if}{literal}
+
+
+
+{/literal}
+    {if apply_filters('glm-members-customfields-active', false)}
+ID = {$regEvent.id}
+        {assign var="fid" value="glm_reg_customfields_reg_attendee_`$event.id`"} {* assemble the uid with the current event ID *}
+<br>FID = {$fid}
+        {if apply_filters('glm-members-customfields-have-fields', false, $fid)}
+
+            {apply_filters('glm-members-customfields-form-display', '', $fid, $cartId, 'checkoutForm', false)}
+
+        {/if}
+    {/if}
+{literal}
+
+
+
             </div>
         </div>
     <div class="glm-row">
@@ -245,7 +263,6 @@ var app = {
     Models: { Front: {}, Admin: {} },
     Collections: { Front: {}, Admin: {} },
     Views: { Front: {}, Admin: {} },
-    //Times: {$regTimesJSON},
     isValidEmail: function( email ){
         var regex = {literal}/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;{/literal}
         return regex.test(email);