Fixed deleting registrant when ulimited registrationsf or a non-time-specific event...
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 30 Nov 2017 20:31:51 +0000 (15:31 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 30 Nov 2017 20:31:51 +0000 (15:31 -0500)
classes/regCartSupport.php
views/admin/registrations/eventDashboard.html

index 25e247a..ff8744a 100644 (file)
@@ -935,7 +935,7 @@ class GlmRegCartSupport
      * @param integer $registrantId ID of registrant
      * @param integer $timeId ID of reg_time record
      *
-     * @return array A reg_time_pending record - FALSE if unable to get hold
+     * @return array A reg_time_pending record - FALSE if unable to get hold, TRUE if unlimited registration
      * @access public
      */
     public function addRegTimePending($registrantId, $timeId)
@@ -956,9 +956,18 @@ class GlmRegCartSupport
               AND E.id = T.reg_event
         ;", ARRAY_A);
 
-        // Check if no time record was found or there is no availability
+        // Check if no time record was found
+        if ($timeData == null) {
+            return false;
+        }
+
+        // Check if this time has unlimited availability
+        if ($timeData['attendee_max'] == 0) {
+            return true;
+        }
 
-        if ($timeData == null || !isset($timeData['attendees_available']) || $timeData['attendees_available'] <= 0) {
+        // Check if there is no availability
+        if (!isset($timeData['attendees_available']) || $timeData['attendees_available'] <= 0) {
             return false;
         }
 
index 1dc5717..f9e515c 100644 (file)
         <tr><th id="availabilityTitle" colspan="2"><!-- item date / time goes here --></th></tr>
         <tr><th style="text-align: left">Active:</th><td><input id="dialogRegActive" type="checkbox" value=""></td></tr>
         <tr id="dialogAllDayLine"><th style="text-align: left">All Day:</th><td><input id="dialogTimeAllDay" type="checkbox" value=""></td></tr>
+  {if $regEvent.time_specific.value}        
         <tr id="dialogTrackLine"><th style="text-align: left">Track Attendees:</th><td><input id="dialogAttendees" type="checkbox" value=""></td></tr>
+  {/if}
         <tr id="dialogStartTimeLine"><th style="text-align: left">Start Time:</th><td><input id="dialogStartTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
         <tr id="dialogEndTimeLine"><th style="text-align: left">End Time:</th><td><input id="dialogEndTime" class="glm-form-text-input-short time-input not-all-day" type="text" value=""></td></tr>
+  {if $regEvent.time_specific.value}        
         <tr><th style="text-align: left">Maximum Attendees:</th><td><input class="glm-form-text-input-veryshort availabilityInput" type="text" id="dialogMaxAtt" value=""> 0 = Unlimited</td></tr>
         <tr id="dialogRegLine"><th style="text-align: left">Registered Attendees:</th><td id="dialogRegAtt"></td></tr>
         <tr id="dialogPendLine"><th style="text-align: left">Pending in Carts:</th><td id="dialogPendAtt"></td></tr>
         <tr id="dialogAvailLine"><th style="text-align: left">Available for Registration:</th><td id="dialogAvailAtt"></td></tr>
+  {/if}  
         <tr><td style="text-align: right">
             <div id="dialogAvailSubmit" class="button-primary" data-timeid="">Upate</div>
         </td></tr>
        {foreach $regEvent.reg_time as $t}
           {if $t.non_time_specific.value == false}
                         {$sep}{
+            {if $regEvent.time_specific.value}
                           {if $t.attendee_max == 0}
                             title:              'unlimited',
                           {else}
                             title:              '{$t.attendee_max}-{$t.attendee_count}-{$t.attendees_pending}-{$t.attendees_available}',
                           {/if}
+            {else}
+                            title:              '',
+            {/if}
                             start:              '{$t.start_datetime.datetime}',
                             end:                '{$t.end_datetime.datetime}',
                             active:             {if $t.active.value}true{else}false{/if},
                         $('#availabilityEditDialog').dialog('open');
                         $('#dialogRegActive').prop('checked', true);
                         $('#dialogTimeAllDay').prop('checked', false);
-                        $('#dialogAttendees').prop('checked', true);
                         $('#dialogStartTime').val('');
                         $('#dialogEndTime').val('');
+                        $('#dialogAttendees').prop('checked', true);
                         $('#dialogMaxAtt').val(0);
                         $('#dialogRegLine').hide();
                         $('#dialogPendLine').hide();
 
                             // Initialize the event data object with submitted data 
                             var newEvent = {
+                    {if $regEvent.time_specific.value}
                                 title:              startTime + ' unlimited',
+                    {else}
+                                title:              '',
+                    {/if}
                                 start:              date.format() + ' ' + startTime,
                                 end:                date.format() + ' ' + $('#dialogEndTime').val(),
                                 active:             $('#dialogRegActive').is(":checked"),
                                 timeId:             false                                
                             };
 
+                    {if $regEvent.time_specific.value}
                             // If max or active is set, override the defaults
                             if (newEvent.max > 0 ) {
                                 newEvent.title = startTime + ' ' + newEvent.max + '-0-0-' + newEvent.max
                             if (newEvent.active) {
                                 newEvent.backgroundColor = 'light-blue';
                             }
-
+                    {/if}
                             // Try to send the data via AJAX
                             var newTime = $.ajax({
                                 
 
                         $('#availabilityEditDialog').dialog('open');
 
-                        $('#dialogAllDayLine').hide();
+                        $('#dialogAllDayLine').show();
                         $('#dialogTrackLine').hide();
-                        $('#dialogStartTimeLine').hide();
-                        $('#dialogEndTimeLine').hide();
+                        $('#dialogTimeAllDay').show();
+                        $('#dialogStartTimeLine').show();
+                        $('#dialogEndTimeLine').show();
                         
                         $('#availabilityTitle').html(calEvent.datetime);
                         $('#dialogRegActive').prop('checked', calEvent.active);
-                        $('#dialogTimeAllDay').prop('checked', calEvent.allDay);
                         $('#dialogStartTime').val(calEvent.start);
                         $('#dialogEndTime').val(calEvent.end);
+                        $('#dialogTimeAllDay').prop('checked', calEvent.allDay);
                         $('#dialogMaxAtt').val(calEvent.max);
                         $('#dialogRegLine').show();
                         $('#dialogRegAtt').html(calEvent.count);
                         $('#dialogAvailLine').show();
                         $('#dialogAvailAtt').html(calEvent.available);
                         $('#dialogAvailSubmit').attr('data-timeid', calEvent.timeid);
+
                         // Re-calculate total available when entering
 
                         $('#dialogMaxAtt').on('change', function() {
                             });
                             $('#availabilityEditDialog').dialog('close');           
                             $('#dialogAvailSubmit').off('click');           
-                            
+
+                {if $regEvent.time_specific.value}
                             calEvent.title = max + '-' + calEvent.count + '-' + calEvent.pending + '-' + calEvent.available;
+                {else}
+                            calEvent.title = '';
+                {/if}
                             $('#eventCalendar').fullCalendar('updateEvent', calEvent);      
                         });