Added email address to editing attnedee in admin and fixed event date/time in registr...
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 27 Sep 2018 14:01:48 +0000 (10:01 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 27 Sep 2018 14:03:01 +0000 (10:03 -0400)
classes/data/dataRegRequestRegistrant.php [changed mode: 0644->0755]
models/admin/ajax/regAdmin/attendee.php [changed mode: 0644->0755]
views/admin/registrations/eventRegistrants.html
views/front/registrations/list.html

old mode 100644 (file)
new mode 100755 (executable)
index 36c0d85..7f0c1f0
@@ -124,6 +124,17 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract
                 'use'       => 'lgneud'
             ),
 
+            // Account E-Mail
+            'email' => array (
+                'field'     => 'account',
+                'as'        => 'email',
+                'type'      => 'pointer',
+                    'p_table'   => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account',
+                    'p_field'   => 'email',
+                    'p_static'  => true,
+                'use'       => 'lg'
+            ),
+
             // Pointer to reg_event entry
             'reg_event' => array (
                 'field'     => 'reg_event',
@@ -321,14 +332,21 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract
         // If doing the following actions
         if (in_array($action, array('l','g'))) {
 
-            // Get the registration request status name
-            $r['request_status_name'] = $this->config['submission_status'][$r['request_status']];
+            if (isset($this->fields['request_status'])) {
 
-            // Add a reformatted date/time
-            $r['event_time_reformatted'] = '';
-            $t = strtotime($r['event_time']);
-            if ($t > 0) {
-                $r['event_time_reformatted'] = date('m/d/Y h:i A', strtotime($r['event_time']));
+                // Get the registration request status name
+                $r['request_status_name'] = $this->config['submission_status'][$r['request_status']];
+
+            }
+
+            if (isset($this->fields['event_time'])) {
+
+                // Add a reformatted date/time
+                $r['event_time_reformatted'] = '';
+                $t = strtotime($r['event_time']);
+                if ($t > 0) {
+                    $r['event_time_reformatted'] = date('m/d/Y h:i A', strtotime($r['event_time']));
+                }
             }
 
         }
old mode 100644 (file)
new mode 100755 (executable)
index 8f587c4..f22c737
@@ -88,20 +88,23 @@ class GlmMembersAdmin_registrations_ajax_attendee extends GlmDataRegistrationsRe
 
                 // Get certain registrant data
                 $savedFields = $this->fields;
-                $this->fields = array();
-                $this->fields['id'] = $savedFields['id'];
-                $this->fields['not_attending'] = $savedFields['not_attending'];
-                $this->fields['reg_time'] = $savedFields['reg_time'];
-                $this->fields['reg_time_avail'] = array (
-                    'field'     => 'reg_time',
-                    'as'        => 'reg_time_avail',
-                    'type'      => 'pointer',
-                        'p_table'   => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_time',
-                        'p_field'   => 'attendees_available',
-                        'p_static'  => true,
-                    'use'       => 'g'
-                );
+                $this->fields = array(
+                    'id'                => $savedFields['id'],
+                    'account'           => $savedFields['account'],
+                    'email'             => $savedFields['email'],
+                    'not_attending'     => $savedFields['not_attending'],
+                    'reg_time'          => $savedFields['reg_time'],
+                    'reg_time_avail'    => array (
+                            'field'         => 'reg_time',
+                            'as'            => 'reg_time_avail',
+                            'type'          => 'pointer',
+                            'p_table'       => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_time',
+                            'p_field'       => 'attendees_available',
+                            'p_static'      => true,
+                            'use'           => 'g'
+                        ),
 
+                );
                 $registrantData = $this->getEntry($modelData['reg_id']);
                 $this->fields = $savedFields;
 
@@ -134,6 +137,7 @@ class GlmMembersAdmin_registrations_ajax_attendee extends GlmDataRegistrationsRe
                     }
                 }
 
+                // Update registrant entry
                 $this->wpdb->update(
                     GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_registrant',
                     array(
@@ -150,8 +154,29 @@ class GlmMembersAdmin_registrations_ajax_attendee extends GlmDataRegistrationsRe
                     array( '%d' )
                 );
 
+                // If the submitted E-Mail is different than what's stored in the account
+                if (trim($registrantData['email']) != trim($modelData['email'])) {
+
+                    // Update the E-Mail address in the account and reset validated flag
+                    $this->wpdb->update(
+                        GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account',
+                        array(
+                            'email' => $modelData['email'],
+                            'validated' => false
+                        ),
+                        array( 'id' => $registrantData['account'] ),
+                        array(
+                            '%s',
+                            '%d'
+                        ),
+                        array( '%d' )
+                        );
+
+                }
+
                 $registrant = array(
                     'id'    => $modelData['reg_id'],
+                    'email' => $modelData['email'],
                     'fname' => $modelData['fname'],
                     'lname' => $modelData['lname'],
                     'notAttending' => $notAttending,
index b0f43fa..59753d1 100755 (executable)
                                     If checked this inventory will be returned to permit another {$terms.reg_term_attendee} to {$terms.reg_term_register}.
                                     If you un-check this it will check to see if inventory is available and if not will not change this to {$terms.reg_term_attending}.
                                 </p>
+                                <label>E-Mail Address</label>
+                                <input class="glm-form-text-input-medium" type="text" name="email" value="{$r.account.email}"><br>
                                 <label>First Name</label>
-                                <input class="glm-form-text-input-medium" type="text" name="fname" value="{$r.fname}">
+                                <input class="glm-form-text-input-medium" type="text" name="fname" value="{$r.fname}"><br>
                                 <label>Last Name</label>
                                 <input class="glm-form-text-input-medium" type="text" name="lname" value="{$r.lname}">
                             </div>
@@ -407,6 +409,7 @@ jQuery(document).ready(function($){
 
         var notAttending = $('#glmRegNotAttending_' + refId).prop('checked');
 
+        var accountEmail = $('#glm-attendee-' + refId + ' input[name=email]').val().trim();
         var accountFname = $('#glm-attendee-' + refId + ' input[name=fname]').val().trim();
         var accountLname = $('#glm-attendee-' + refId + ' input[name=lname]').val().trim();
 
@@ -419,6 +422,7 @@ jQuery(document).ready(function($){
                 collection: 'attendee',
                 option: 'update',
                 reg_id: refId,
+                email: accountEmail,
                 fname: accountFname,
                 lname: accountLname,
                 not_attending: notAttending,
@@ -440,6 +444,7 @@ jQuery(document).ready(function($){
                 $('#glmRegAttedeeLine_' + refId).removeClass('glm-reg-gray');
                 $('#glmRegNotAttendingText_' + refId).html('');
                            }
+            $('#glm-attendee-form-' + account.id + ' input[name=email]').val( account.email );
             $('#glm-attendee-form-' + account.id + ' input[name=fname]').val( account.fname );
             $('#glm-attendee-form-' + account.id + ' input[name=lname]').val( account.lname );
             $('.glm-edit-form-' + $(this).data('registrant')).hide();
index 54fdc46..9598703 100755 (executable)
                 <!-- START EVENT REG TIMES -->
                 <div class="glm-reg-list-details-wrapper">
                     <div class="glm-row">
-    <!--                    <div class="glm-columns glm-large-2 glm-small-12 glm-reg-list-label">
-                            <strong> Dates/Times: </strong>
-                        </div>-->
-
+    
                         <div class="glm-columns glm-small-12 glm-reg-list-details">
 
-                            {$lastDate = ''}
-                            {foreach $event.recurrences as $rec}
-
-                                {$eDate = $rec.from_date.timestamp|date_format:"%B %e"}
-
-                                {if $eDate != $lastDate}
-                                    {$lastDate = $eDate}
-
-                                    <div class="glm-reg-list-dates glm-reg-list-details">
-<!--                                        {if $event.recurrences.0.recurring.value == 1} Occurring {/if}-->
-
-                                        {if $rec.from_date.timestamp|date_format:"%Y" != $rec.to_date.timestamp|date_format:"%Y"}
-                                            {$eDate}, {$rec.from_date.timestamp|date_format:"%Y"}
-                                        {else}
-                                            {$eDate}
-                                        {/if}
-
-                                        {if $rec.from_date.date != $rec.to_date.date}
-                                            {if $rec.from_date.timestamp|date_format:"%Y" != $rec.to_date.timestamp|date_format:"%Y"}
-                                                - {$rec.to_date.timestamp|date_format:"%B %e, %Y"}
-                                            {else}
-                                                - {$rec.to_date.timestamp|date_format:"%B %e, %Y"}
-                                            {/if}
-                                        {else if $rec.specific_dates}
-                                            {if $rec.from_date.timestamp|date_format:"%Y" != $rec.specific_dates|@end|date_format:"%Y"}
-                                                - {$rec.specific_dates|@end|date_format:"%B %e, %Y"},
-                                            {else}
-                                                - {$rec.specific_dates|@end|date_format:"%B %e, %Y"}
-                                            {/if}
-
-                                        {/if}
-<!--
-                                        {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 }
-                                            on
-                                            {foreach $rec.day_of_week.names as $day}
-                                                {if $day == "Thursday"}
-                                                    <span> {$day|substr:0:4} </span>
-                                                {else}
-                                                    <span> {$day|substr:0:3} </span>
-                                                 {/if}
-                                             {/foreach}
-
-                                        {/if}-->
-                                    </div>
-                                {/if}
-                                {if isset($rec.all_day) && !$rec.all_day.value}
-                                    <div class="glm-reg-list-times glm-reg-list-details">
-                                            {if $rec.start_time.time == $rec.end_time.time || $rec.start_time_only.value}
-                                                {$rec.start_time.time|strtotime|date_format:"%l:%M %P"}
-                                            {else}
-                                                {$rec.start_time.time|strtotime|date_format:"%l:%M %P"} - {$rec.end_time.time|strtotime|date_format:"%l:%M %P"}
-                                            {/if}
-                                            {if $rec.name && $rec.name != 'Imported' && $rec.name != 'Imported Event Schedule' }
-                                                {$rec.name}
-                                            {/if}
-                                    </div>
-                                {else}
-
-                                    {if $rec.name && $rec.name != 'Imported' && $rec.name != 'Imported Event Schedule' }
-                                        {$rec.name}
-                                    {/if}
-
-                                {/if}
-                            {/foreach}
-
-                            {if $event.eventCost}
+                {* If there's a starting timestamp for this event. Why wouldn't there be? *}
+                {if $event.first_datetime.timestamp}
+
+                            <div class="small-12 columns glm-reg-event-profile-details glm-reg-date glm-reg-has-icon"> {$event.first_datetime.timestamp|date_format:"%A, %B %e, %Y"}</div>
+                            <div class="small-12 columns glm-reg-event-profile-details glm-reg-time glm-reg-has-icon"> {$event.first_datetime.timestamp|date_format:"%l:%M %p"}</div>
+
+                    {* If the first and last timestamp are NOT the same, then there's other dates and times Should be selectable below. *}
+                    {if $event.first_date.timestamp != $regEvent.last_date.timestamp}
+                                <div class="small-12 columns glm-reg-event-profile-details"> (see other dates and times below)</div>
+                    {/if}
+
+                {/if}
+
+
+                {if $event.eventCost}
 
                                 <div class="glm-reg-list-cost glm-small-12 glm-column glm-reg-list-details">
                                     {$event.eventCost}
                                 </div>
 
-                            {/if}
-                            {if $event.hide_address.name == 'No'}
-                                {if !$event.use_member_location.value && isset($event.locations) && ($event.locations.name || $event.locations.address)}
+                {/if}
+                {if $event.hide_address.name == 'No'}
+                    {if !$event.use_member_location.value && isset($event.locations) && ($event.locations.name || $event.locations.address)}
                                     <div class="glm-columns glm-small-12 glm-reg-list-details glm-reg-list-location">
-                                           {if $event.locations.name}{$event.locations.name}<br>{/if}
-                                    </div>
-                                {/if}
-                            {/if}
+                       {if $event.locations.name}{$event.locations.name}<br>{/if}
+                                </div>
+                    {/if}
+                {/if}
                         </div>
                     </div>
                     <!-- EVENT REG TIMES END -->