Added checkboxes for all possible status values in event attendees export dialog...
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Jul 2018 17:02:19 +0000 (13:02 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Jul 2018 17:02:19 +0000 (13:02 -0400)
Also update the name of one status value.

config/plugin.ini
models/admin/ajax/registrantsListExport.php
models/admin/registrations/events.php
views/admin/registrations/eventRegistrants.html

index c73bb20..4d786a2 100644 (file)
@@ -204,7 +204,7 @@ submission_status[20]                           = 'Unpaid'
 submission_status[30]                           = 'Card Pending'
 submission_status[40]                           = 'Card Declined'
 submission_status[50]                           = 'Payment Pending'
-submission_status[60]                           = 'On Arrival'
+submission_status[60]                           = 'Pay On Arrival'
 submission_status[70]                           = 'Administrative Hold'
 submission_status[80]                           = 'Failed Submission'
 submission_status[99]                           = 'Canceled'
index b09f954..94194ba 100644 (file)
@@ -137,30 +137,31 @@ class GlmMembersAdmin_ajax_registrantsListExport extends GlmDataRegistrationsReq
         // Only return information records that are active
 
         $whereParts = array();
+
         // Filter for complete if given
-        if ( isset( $_REQUEST['complete'] ) && filter_var( $_REQUEST['complete'], FILTER_VALIDATE_BOOLEAN) ) {
-            $completed = true;
-            // $whereParts[] = "T.reg_request in (
-            // SELECT id
-            //   FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX .  "reg_request
-            //  WHERE status = {$this->config['submission_status_numb']['COMPLETE']})";
-
-            $whereParts[] = " T.not_attending <> true ";
+        if ( isset($_REQUEST['status']) && is_array($_REQUEST['status']) && count($_REQUEST['status']) > 0 ) {
+
+            // Collect all checked status values
+            $statusSelected = array();
+            foreach ($_REQUEST['status'] as $statusValue => $statusName) {
+                $statusSelected[] = $statusValue;
+            }
+            $statusList = implode(',', $statusSelected);
+
             $whereParts[] = "
                 (
                 SELECT count(id)
                   FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX .  "reg_request
                  WHERE id = T.reg_request
-                   AND status NOT IN
-                        (
-                        {$this->config['submission_status_numb']['CART']},
-                        {$this->config['submission_status_numb']['FAILED']},
-                        {$this->config['submission_status_numb']['CANCELED']}
-                        )
+                   AND status IN ($statusList)
                 ) > 0
             ";
+        } else {
+            die('ERROR: No status selected');
         }
 
+        $whereParts[] = "T.not_attending <> true";
+
         // Check for a text search
         if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) {
             $textSearch = trim($_REQUEST['text_search']);
index eeb7bef..ace9d88 100644 (file)
@@ -244,10 +244,11 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent
             'haveTimes'               => $haveTimes,
             'times'                   => $times,
             'selectedTime'            => $selectedTime,
-            'notifications'           => $notifications
+            'notifications'           => $notifications,
+            'submitStatus'            => $this->config['submission_status']
         );
 
-        // echo "<pre>".print_r($templateData,1)."</pre>";
+       // echo "<pre>".print_r($this->config['submission_status'],1)."</pre>";
 
         // Return status, any suggested view, and any data to controller
         return array(
index d8324a8..8ca322a 100644 (file)
         <input type="hidden" name="glm_action" value="registrantsListExport">
         <input type="hidden" name="regEventID" value="{$regEvent.id}">
         <table class="glm-admin-table">
-            <tr><td colspan="2"><label><input type="checkbox" name="complete" value="1" checked>Don't show attendees in pending or invalid carts</label></td></tr>
+        
             <tr>
                 <th>Name Search:</th>
                 <td><input type="text" name="text_search" value=""></td>
             </tr>
+            <tr>
+                <th>Request Status:</th>
+                <td>
+                    <table padding="3">
+                        <tr>
+                            <td class="exportFieldsTd">
+                                <a id="selectAllStatusFields" class="button button-secondary button-small">Check All</a> <a class="button button-secondary button-small" id="unselectAllStatusFields">Uncheck All</a> Please select at least one.<br> 
+                {foreach from=$submitStatus key=status_id item=status_name}
+                                <input class="statusCheckbox" type="checkbox" name="status[{$status_id}]"> {$status_name}<br>
+                {/foreach}
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
             <tr>
                 <th>Fields to export:</th>
                 <td>
                     <table padding="3">
                         <tr>
-                            <td colspan="2"><a id="selectAllExportFields">Check All</a> / <a id="unselectAllExportFields">Uncheck All</a></td>
+                            <td colspan="2"><a id="selectAllExportFields" class="button button-secondary button-small">Check All</a> <a class="button button-secondary button-small" id="unselectAllExportFields">Uncheck All</a></td>
                         </tr>
                         <tr>
                             <td class="exportFieldsTd">
-                                <input class="" type="checkbox" name="exportId"> {$terms.reg_term_attendee_cap} ID<br>
-                                <input type="checkbox" name="exportRegistrant" checked> {$terms.reg_term_attendee_cap} Name<br>
-                                <input type="checkbox" name="exportAddr1" checked> Address Line #1<br>
-                                <input type="checkbox" name="exportAddr2" checked> Address Line #2<br>
-                                <input type="checkbox" name="exportCity" checked> City<br>
-                                <input type="checkbox" name="exportState" checked> State<br>
-                                <input type="checkbox" name="exportZip" checked> ZIP/Postal Code<br>
+                                <input class="exportField" type="checkbox" name="exportId"> {$terms.reg_term_attendee_cap} ID<br>
+                                <input class="exportField" type="checkbox" name="exportRegistrant" checked> {$terms.reg_term_attendee_cap} Name<br>
+                                <input class="exportField" type="checkbox" name="exportAddr1" checked> Address Line #1<br>
+                                <input class="exportField" type="checkbox" name="exportAddr2" checked> Address Line #2<br>
+                                <input class="exportField" type="checkbox" name="exportCity" checked> City<br>
+                                <input class="exportField" type="checkbox" name="exportState" checked> State<br>
+                                <input class="exportField" type="checkbox" name="exportZip" checked> ZIP/Postal Code<br>
                             </td>
                             <td class="exportFieldsTd">
-                                <input type="checkbox" name="exportEmail" checked> Email <br>
-                                <input type="checkbox" name="exportPhone" checked> Phone <br>
-                                <input type="checkbox" name="exportCounty" checked> County <br>
-                                <input type="checkbox" name="exportLevel" checked> Level <br>
-                                <input type="checkbox" name="exportTime" checked> Date/Time <br>
-                                <input type="checkbox" name="exportRate" checked> Rate <br>
-                                <input type="checkbox" name="exportStatus" checked> Status <br>
+                                <input class="exportField" type="checkbox" name="exportEmail" checked> Email <br>
+                                <input class="exportField" type="checkbox" name="exportPhone" checked> Phone <br>
+                                <input class="exportField" type="checkbox" name="exportCounty" checked> County <br>
+                                <input class="exportField" type="checkbox" name="exportLevel" checked> Level <br>
+                                <input class="exportField" type="checkbox" name="exportTime" checked> Date/Time <br>
+                                <input class="exportField" type="checkbox" name="exportRate" checked> Rate <br>
+                                <input class="exportField" type="checkbox" name="exportStatus" checked> Status <br>
                                 {if apply_filters('glm-members-customfields-plugin-active', false)}
-                                    <input type="checkbox" name="exportCustom" checked> Custom Fields <br>
+                                    <input class="exportField" type="checkbox" name="exportCustom" checked> Custom Fields <br>
                                 {/if}
                             </td>
                         </tr>
             </tr>
         </table>
         <a id="exportRegistrantsCancel" class="button button-secondary glm-right">Cancel</a>
-        <input type="submit" value="Export" class="button button-primary">
+        <input id="exportSubmitButton" type="submit" value="Export" class="button button-primary">
     </form>
 </div>
 
 <script>
 jQuery(document).ready(function($){
 
+    // Export Submit Action to check for at least one status selected
+    $('#exportSubmitButton').click(function(){
+        if (!$('.statusCheckbox').is(":checked")) {
+            alert('Please select at least one request status.');
+            return false;
+        }
+    });
+    
     // Setup the Export Registrant Dialog
     var dialog = $('#exportRegistrantsDialog').dialog({
         autoOpen: false,
-        minWidth: 500,
+        minWidth: 600,
         dialogClass: 'glm-dialog-no-close',
     });
 
@@ -248,14 +271,26 @@ jQuery(document).ready(function($){
         $('#exportRegistrantsDialog').dialog('close');
     });
 
+    // Setup the Status select and unselect all
+    $('#selectAllStatusFields').click(function(){
+        $('.statusCheckbox').each(function(){
+            $(this).prop('checked', true);
+        });
+    });
+    $('#unselectAllStatusFields').click(function(){
+        $('.statusCheckbox').each(function(){
+            $(this).prop('checked', false);
+        });
+    });
+
     // Setup the Export select and unselect all
     $('#selectAllExportFields').click(function(){
-        $('.exportFieldsTd input[type="checkbox"]').each(function(){
+        $('.exportField').each(function(){
             $(this).prop('checked', true);
         });
     });
     $('#unselectAllExportFields').click(function(){
-        $('.exportFieldsTd input[type="checkbox"]').each(function(){
+        $('.exportField').each(function(){
             $(this).prop('checked', false);
         });
     });