Fixed issues with registration by Event Code and other matters
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 5 Feb 2019 17:39:25 +0000 (12:39 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 5 Feb 2019 17:39:25 +0000 (12:39 -0500)
Added more fields to registration events dashboard list.
Added active flag status to specific reg evnet dashboard.
Remvoed local function that is now in main plugin.
Fixed some minor issues with checks as to why a reg event might not show in list.

classes/data/dataRegEvent.php
models/admin/registrations/events_dashboard.php
models/admin/registrations/events_eventDashboard.php
models/admin/registrations/events_registrants.php
models/admin/registrations/requests.php
models/front/registrations/registration.php
views/admin/registrations/eventDashboard.html
views/admin/registrations/eventEdit.html
views/admin/registrations/eventsDashboard.html
views/front/registrations/list.html

index b4f5d75..e0ce220 100755 (executable)
@@ -924,6 +924,8 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
         $this->fields = array(
             'id' => $fSave['id'],
             'event' => $fSave['event'],
+            'active' => $fSave['active'],
+            'event_code' => $fSave['event_code'],
             'event_name' => $fSave['event_name'],
             'time_specific' => $fSave['time_specific'],
             'first_datetime' => $fSave['first_datetime'],
index 5601a7c..e0d4778 100755 (executable)
@@ -127,51 +127,6 @@ if (isset($_REQUEST['request_status_select'])) {
     $statusSelected = $_REQUEST['request_status_select'];
 }
 
-/**
- * ******* TEMPORARY - USE SAME FUNCTION IN MAIN PLUGIN WHEN THAT'S UPDATED (less the number 2 at the end)  *************
- */
-// require_once GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_PATH.'/classes/glmPluginSupport.php';
-function glmMembersConfigArraySetup2( $configTable, $configNumbTable = false, $configSelectedArray = false)
-{
-
-    // Check if config table array exits
-    if (!is_array($configTable) || count($configTable) == 0) {
-        return false;
-    }
-
-    // Build base array
-    $conf = array();
-    foreach ($configTable as $key=>$descr) {
-        $conf[$key] = array(
-            'id' => $key,
-            'descr' => $descr,
-            'name' => false,
-            'selected' => false
-        );
-    }
-
-    // If name->number array add that data
-    if (is_array($configNumbTable) && count($configNumbTable) > 0) {
-        foreach ($configNumbTable as $name=>$key) {
-            if (isset($conf[$key])) {
-                $conf[$key]['name'] = $name;
-            }
-        }
-    }
-
-    // If a selected array is provided, add that data
-    if (is_array($configSelectedArray) && count($configSelectedArray) > 0) {
-        foreach ($configSelectedArray as $key) {
-            if (isset($conf[$key])) {
-                $conf[$key]['selected'] = true;
-            }
-        }
-    }
-
-    return $conf;
-
-}
-
 // Check for an update to the status of a request
 if (isset($_REQUEST['option2']) && $_REQUEST['option2'] == 'updateStatus' && isset($_REQUEST['requestId']) && isset($_REQUEST['status'])) {
 
index 6046fd6..9cc16f3 100755 (executable)
@@ -170,8 +170,8 @@ if ($regEvent !== false) {
                                 if ($time['active']['value']) {
                                     $haveActiveFutureTimes = true;
 
-                                    // If this is a time specific time entry and there's availability
-                                    if ($haveTimeSpecificEvent && $time['attendees_available'] > 0) {
+                                    // If this is a time specific time entry and there's availability or unlimited
+                                    if ($haveTimeSpecificEvent && ($time['attendees_available'] > 0 || $time['attendee_max'] == 0)) {
                                         $haveActiveFutureAvailability = true;
                                     }
 
index f2edc97..e8149ee 100644 (file)
@@ -92,53 +92,8 @@ if (isset($_REQUEST['status']) && is_array($_REQUEST['status']) && count($_REQUE
 // Build data for picklist output
 $status = $this->config['submission_status'];
 
-
-/**
- * ******* TEMPORARY - USE SAME FUNCTION IN MAIN PLUGIN WHEN THAT'S UPDATED (less the number 2 at the end)  *************
- */
-function glmMembersConfigArraySetup2( $configTable, $configNumbTable = false, $configSelectedArray)
-{
-
-    // Check if config table array exits
-    if (!is_array($configTable) || count($configTable) == 0) {
-        return false;
-    }
-
-    // Build base array
-    $conf = array();
-    foreach ($configTable as $key=>$descr) {
-        $conf[$key] = array(
-            'id' => $key,
-            'descr' => $descr,
-            'name' => false,
-            'selected' => false
-        );
-    }
-
-    // If name->number array add that data
-    if (is_array($configNumbTable) && count($configNumbTable) > 0) {
-        foreach ($configNumbTable as $name=>$key) {
-            if (isset($conf[$key])) {
-                $conf[$key]['name'] = $name;
-            }
-        }
-    }
-
-    // If a selected array is provided, add that data
-    if (is_array($configSelectedArray) && count($configSelectedArray) > 0) {
-        foreach ($configSelectedArray as $key) {
-            if (isset($conf[$key])) {
-                $conf[$key]['selected'] = true;
-            }
-        }
-    }
-
-    return $conf;
-
-}
-
 // Build array of status options for view
-$statusOptions = glmMembersConfigArraySetup2($this->config['submission_status'], $this->config['submission_status_numb'], $statusSelected);
+$statusOptions = glmMembersConfigArraySetup($this->config['submission_status'], $this->config['submission_status_numb'], $statusSelected);
 
 
 // Build where clause for status and add to where parts
index 47681cb..f66d5de 100755 (executable)
@@ -259,54 +259,8 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
                 // Build data for picklist output
                 $status = $this->config['submission_status'];
 
-
-                /**
-                 * ******* TEMPORARY - USE SAME FUNCTION IN MAIN PLUGIN WHEN THAT'S UPDATED (less the number 2 at the end)  *************
-                 */
-                function glmMembersConfigArraySetup2( $configTable, $configNumbTable = false, $configSelectedArray)
-                {
-
-                    // Check if config table array exits
-                    if (!is_array($configTable) || count($configTable) == 0) {
-                        return false;
-                    }
-
-                    // Build base array
-                    $conf = array();
-                    foreach ($configTable as $key=>$descr) {
-                        $conf[$key] = array(
-                            'id' => $key,
-                            'descr' => $descr,
-                            'name' => false,
-                            'selected' => false
-                        );
-                    }
-
-                    // If name->number array add that data
-                    if (is_array($configNumbTable) && count($configNumbTable) > 0) {
-                        foreach ($configNumbTable as $name=>$key) {
-                            if (isset($conf[$key])) {
-                                $conf[$key]['name'] = $name;
-                            }
-                        }
-                    }
-
-                    // If a selected array is provided, add that data
-                    if (is_array($configSelectedArray) && count($configSelectedArray) > 0) {
-                        foreach ($configSelectedArray as $key) {
-                            if (isset($conf[$key])) {
-                                $conf[$key]['selected'] = true;
-                            }
-                        }
-                    }
-
-                    return $conf;
-
-                }
-
                 // Build array of status options for view
-                $statusOptions = glmMembersConfigArraySetup2($this->config['submission_status'], $this->config['submission_status_numb'], $statusSelected);
-
+                $statusOptions = glmMembersConfigArraySetup($this->config['submission_status'], $this->config['submission_status_numb'], $statusSelected);
 
                 // Build where clause for status and add to where parts
                 $statusWhere = "(".implode(',', $statusSelected).")";
index b0fa57e..75c533d 100755 (executable)
 
             // Otherwise it should be an event code
             } else {
-                if ($action)
                 // Try to get reg event ID
                 $regEventID = $this->wpdb->get_var("
                     SELECT id
index 3399e68..0f1cbc6 100755 (executable)
@@ -7,6 +7,14 @@
         <div class="glm-row">
             <div class="glm-small-12 glm-medium-4 glm-left">
                 <div class="glm-admin-table">
+                    <div class="glm-row">
+                        <div class="glm-small-6 glm-column">
+                            <h3>{$terms.reg_term_event_cap} Active:</h3>
+                        </div>
+                        <div class="glm-small-6 glm-column">
+                            {$regEvent.active.name}
+                        </div>
+                    </div>
                     <div class="glm-row">
                         <div class="glm-small-6 glm-column">
                             <h3>{$terms.reg_term_event_cap} Code:</h3>
                             <div class="glm-small-12 glm-column">
                                 <h3 class="glm-notice">This {$terms.reg_term_event_cap} is Not Displayed in Lists</h3>
                             </div>
-                            <div class="glm-small-12 glm-column">
-                                This {$terms.reg_term_event} is not displayed to users in lists of available
-                                {$terms.reg_term_registration_plur} {$terms.reg_term_event_plur}.
-                            </div>
                         </div>
                     {/if}
                 </div>
index a868f9b..c927fc7 100644 (file)
 
             <tr><th colspan="2" class="reg-event-edit-section"><h2>{$terms.reg_term_event_cap} Location{if $regEvent.fieldData.event} - Using location from {$terms.reg_term_event}{/if}</h2></th></tr>
 
-  {if !$regEvent.fieldData.event}
+  {if $regEvent.fieldData.event}
+            {* If this data is coming from a linked event, supply blank input for these fields. *}
+            <input type="hidden" name="hide_address" value="0">
+            <input type="hidden" name="useMemberLocationCheckbox" value="0">
+            <input type="hidden" name="member" value="0">
+            <input type="hidden" name="location_name" value="">
+            <input type="hidden" name="address" value="">
+            <input type="hidden" name="city" value="0">
+            <input type="hidden" name="state" value="">
+            <input type="hidden" name="region" value="0">
+            <input type="hidden" name="phone" value="">
+            <input type="hidden" name="url" value="">
+            <input type="hidden" name="email" value="">
+            <input type="hidden" name="lat" value="0">
+            <input type="hidden" name="lon" value="0">
+  {else}
             <tr>
                 <th class="glm-nowrap-left-align">Hide Location Address:</th>
                 <td>
index 5fe637c..ef5e8f5 100755 (executable)
@@ -57,7 +57,9 @@
                 <tr>
                     <th>ID</th>
                     <th>{$terms.reg_term_event_cap} Name</th>
-                    <th>Date Specific?</th>
+                    <th>Code</th>
+                    <th>Active</th>
+                    <th>Date<br>Specific?</th>
                     <th>Maximum<br>{$terms.reg_term_attendee_plur_cap}</th>
                     <th>{$terms.reg_term_registered_cap}</th>
                     <th>Cart<br>Hold</th>
@@ -79,6 +81,8 @@
             {/if}
                     <td style="width: 50px;"><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$r.id}">{$r.id}</a></td>
                     <td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard&regEventID={$r.id}">{$r.event_name}</a></td>
+                    <td>{$r.event_code}</td>
+                    <td>{if $r.active.value}Yes{/if}</td>
                     <td>{if $r.time_specific.value}Yes{/if}</td>
                     <td>{$r.total}</td>
                     <td>{$r.registered}</td>
index eebc54d..bea3d9d 100755 (executable)
 </div>
 
 {if $haveMessages}
-<div class="glm-registrations-messages glm-reg-warning glm-row" style="clear: all;">
-    <i>Please Note:</i>
-    <ul>
-{foreach $messages as $m}
-        <li>{$m}</li>
-{/foreach}
-    </ul>
-</div>
+    <div class="glm-registrations-messages glm-reg-warning glm-row" style="clear: all;">
+        <i>Please Note:</i>
+        <ul>
+            {foreach $messages as $m}
+                <li>{$m}</li>
+            {/foreach}
+        </ul>
+    </div>
 {/if}
 
 
     </div>
 {/if}
 {if $settings.reg_show_select_by_code}
-    <form action="{$thisUrl}?page={$thisPage}" method="get" id="regEventByCode">
-        <label>If you know the code for your desired {$terms.reg_term_event}, enter it here.</label><input type="text" name="event" value="" class="glm-form-text-input-short">
-    </form>
+
+    <div class="glm-row" style="white-space: nowrap; line-height: 1rem; text-align: center;">
+
+        <form action="{$thisUrl}?page={$thisPage}" method="get" id="regEventByCode">
+            If you have an {$terms.reg_term_event} code, enter it here.
+            <input type="text" name="event" value="" style="width: 10rem; display: inline;">
+            <input type="submit" class="button button-secondary glm-button" style="font-size: .8rem;" name="applyPaymentCode" value="Go to {$terms.reg_term_event}">
+        </form>
+    </div>
+
+
 {/if}
 {if $haveRegEvents}
     {foreach $regEvents as $event}
         <!-- EVENT REG ITEM END -->
     {/foreach}
 {else}
-    <center><h3>Sorry, no {$terms.reg_term_event_plur} listed for {$terms.reg_term_registration} at this time.</h3></center>
+    <center>
+        <p style="padding-top: 2em;">
+            Sorry, no {$terms.reg_term_event_plur} listed for {$terms.reg_term_registration} at this time.
+            {if $settings.reg_show_select_by_code}
+                <br>If you have an {$terms.reg_term_event} code you may enter that above.
+            {/if}
+
+        </p>
+    </center>
 {/if}
 
 </div>