Enhancements and fixes to registrations checkout and requests and accounts dashboard hotfix/1.0.18
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 11 Sep 2018 17:26:12 +0000 (13:26 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 11 Sep 2018 17:26:12 +0000 (13:26 -0400)
Now properly formatting checkout failure notices in request Notes field
Added more list filtering and pagenation features to accounts and requests lists
Now not showing requessts that have no attenees in request admin list by default
Adde more debug information to checkout processing

index.php
models/admin/registrations/accounts.php [changed mode: 0644->0755]
models/admin/registrations/requests.php [changed mode: 0644->0755]
models/front/registrations/checkoutProcess.php
readme.txt
views/admin/registrations/accountsDashboard.html [changed mode: 0644->0755]
views/admin/registrations/requestDashboard.html
views/admin/registrations/requestsDashboard.html [changed mode: 0644->0755]

index bd61992..11bbca1 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Associate - Event Registrations Add-On
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Add-on to integrate registrations into Events add-on.
- * Version: 1.0.17
+ * Version: 1.0.18
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -17,7 +17,7 @@
  * @package glmMembersRegistrationsAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.17
+ * @version 1.0.18
  */
 
 // Check that we're being called by WordPress.
@@ -41,7 +41,7 @@ if (!defined('ABSPATH')) {
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.0.17');
+define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.0.18');
 define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '1.0.1');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
old mode 100644 (file)
new mode 100755 (executable)
index ebd295c..2b08d22
@@ -267,7 +267,12 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             // Check if we have a Text Search string
             if ( isset( $_REQUEST['textSearch'] ) && trim( $_REQUEST['textSearch'] ) != '' ) {
                 $textSearch = trim( $_REQUEST['textSearch'] );
-                $where .= " AND ( lname LIKE '%$textSearch%' OR fname LIKE '%$textSearch%' OR CONCAT_WS( ' ', fname, lname) LIKE '%$textSearch%' )";
+                $where .= " AND (
+                    CONCAT_WS( ' ', fname, lname) LIKE '%$textSearch%' or
+                    org LIKE '%$textSearch%' OR
+                    email LIKE '%$textSearch%' OR
+                    id = '$textSearch'
+                )";
             }
 
             $accountsResult = $this->getList( $where, 'lname', true, 'id', $start, $limit  );
@@ -276,6 +281,9 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             //$accounts    = $this->getList( $where );
             // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
 
+            // Get total numbers of account
+            $numbAccounts = $this->getStats($where);
+
             // Get paging results
             $numbDisplayed = $accountsResult['returned'];
             $lastDisplayed = $accountsResult['last'];
@@ -314,9 +322,10 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
         // Compile template data
         $templateData = array(
             'hasAccounts'        => $hasAccounts,
-            'numAccounts'        => ($accounts) ? count($accounts) : 0,
+            'numbAccounts'       => $numbAccounts,
             'accounts'           => $accounts,
             'account'            => $account,
+            'start'              => $start,
             'limit'              => $limit,
             'prevStart'          => $prevStart,
             'nextStart'          => $nextStart,
@@ -339,7 +348,8 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount
             'haveRequests'       => $haveRequests,
             'registered'         => $registered,
             'haveRegistered'     => $haveRegistered,
-            'reason'             => $reason
+            'reason'             => $reason,
+            'textSearch'         => $textSearch
         );
              // Return status, any suggested view, and any data to controller
         return array(
old mode 100644 (file)
new mode 100755 (executable)
index 353566c..47f9eb0
@@ -90,6 +90,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
         $prevStart      = false;
         $nextStart      = false;
         $start          = 1;
+        $last           = false;
         $limit          = 20;        // Set to the number of listings per page
         $orderBy        = 'id';
         $haveRequests   = false;
@@ -102,6 +103,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
         $option         = 'dashboard';
         $errorMsg       = false;
         $textSearch     = false;
+        $listEmpty      = false;
         $statusOptions  = false;
         $where          = 'TRUE';
         $deleted        = false;
@@ -222,8 +224,13 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
 
                 if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) {
                     $textSearch = trim($_REQUEST['textSearch']);
-                    $where .= " AND concat( T.bill_fname, ' ', T.bill_lname) LIKE '%".$textSearch."%'";
+                    $where .= " AND (
+                        concat( T.bill_fname, ' ', T.bill_lname) LIKE '%".$textSearch."%' or
+                        T.bill_org LIKE '%$textSearch%' OR
+                        T.bill_email LIKE '%$textSearch%' OR
+                        id = '$textSearch'
 
+                    )";
                     // Clean up for use in redisplaying search value
                     $textSearch = stripslashes($textSearch);
                 }
@@ -328,10 +335,6 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
                         $order = 'T.bill_city';
                         break;
 
-                    case 'state':
-                        $order = 'T.bill_state';
-                        break;
-
                     case 'created':
                         $order = 'T.date_created';
                         break;
@@ -362,10 +365,26 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
                     if ($newStart > 0) {
                         $start = $newStart;
                     }
+
                 }
 
-                // Get list of requests
+                // Check if we're listing empty carts
+                // NEED TO TEST list_empty here and add to view
+                if (isset($_REQUEST['list_empty']) && $_REQUEST['list_empty'] == 'on') {
+                    $listEmpty = true;
+                } else {
+
+                    // Return only requests that have attendees assigned
+                    $where .= " AND (SELECT COUNT(id) from ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant WHERE reg_request = T.id)";
+
+                }
+
+                // Get list of requests - Save post process flag and set it for this request - This provides attendee count
+                $savePostProc = $this->postProcRegRequest;
+                $this->postProcRegRequest = true;
                 $requestsResult = $this->getList($where, $order, true, 'id', $start, $limit);
+                $this->postProcRegRequest = $savePostProc;
+
                 if ($requestsResult) {
 
                     $haveRequests = true;
@@ -435,6 +454,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ
             'option'        => $option,
             'deleted'       => $deleted,
             'textSearch'    => $textSearch,
+            'listEmpty'     => $listEmpty,
             'statusOptions' => $statusOptions,
             'messages'      => $messages,
             'regUrl'        => GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/'
index 9b2a523..886115f 100644 (file)
@@ -86,6 +86,10 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
     public function modelAction($actionData = false)
     {
 
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            trigger_error("GLM Registrations - Starting Checkout processing", E_USER_NOTICE);
+        }
+
         $messages       = array();      // Fatal Messages
         $noticeMessages = array();      // Non-fatal messages
         $cartStatus     = 0;            // Default to CART
@@ -131,7 +135,19 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                 $this->checkRegistrationRequest($requestId);
 
                 if (!$this->cart['status'] || !$this->cart['validated']) {
+
                     $messages[] = 'No current cart found. Please log in to continue with an existing cart or start selecting your registrations.';
+
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                        trigger_error("GLM Registrations - Do not have a valid request!", E_USER_NOTICE);
+                    }
+
+                } else {
+
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                        trigger_error("GLM Registrations - Have valid request: $requestId", E_USER_NOTICE);
+                    }
+
                 }
             }
 
@@ -140,6 +156,14 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
         // Check if cart has been successfully checked out or has been marked canceled.
         if ($this->cart['request']['status']['value'] != $this->config['submission_status_numb']['CART']) {
 
+            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                trigger_error("GLM Registrations - Attempt to process request that has already checked out!: $requestId", E_USER_NOTICE);
+            }
+
+
+            /*
+             * This cart has been completed or is otherwise not in cart status anymore. Display the submitted results rather than process.
+             */
             $messages[] = "This request has already been submitted!<br>The information below is a summary of your submitted request.";
 
             // Build check code for display of summary in iframe
@@ -167,7 +191,7 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
         }
 
         /*
-         * Submission account?
+         * Process account
          */
 
         if (count($messages) == 0) {
@@ -186,10 +210,18 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                     $regAccount = $Account->editEntry($accountId);
                 }
 
+                if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                    trigger_error("GLM Registrations - Using logged in account: $raccountId", E_USER_NOTICE);
+                }
+
 
             // Otherwise this is a guest so try to create the account using the submitted data
             } else {
 
+                if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                    trigger_error("GLM Registrations - Processing as Guest", E_USER_NOTICE);
+                }
+
                 // Since there's no account yet, we'll use the billing data for the base account data
                 $_REQUEST['fname']      = $_REQUEST['bill_fname'];
                 $_REQUEST['lname']      = $_REQUEST['bill_lname'];
@@ -240,6 +272,11 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
                 } else {
                     $messages[] = 'Unable to create a guest account for this request. Please try again later.';
+
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                        trigger_error("GLM Registrations - Unable to create or populate guest account", E_USER_NOTICE);
+                    }
+
                 }
 
             }
@@ -513,6 +550,10 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                         $CcProcessor = new PaymentGateway($account);
                     }
 
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                        trigger_error("GLM Registrations - Payment Processor: ".$this->config['proc_dir'][$ccProcessor], E_USER_NOTICE);
+                    }
+
                     $payment = array(
                         'transOpt'          => $transOpt,                                   // 0 = charge card, 1 = charge and store, 2 = charge stored card
                         'name'              => $this->config['settings']['reg_org_name'].' - '.$this->config['terms']['reg_term_registrations_name'],   // Name of venue + name of "Registrations".
@@ -533,6 +574,10 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
                     // If successful submission - say we're complete
                     if (is_array($ccResult) && isset($ccResult['status']) && $ccResult['status'] == 1) {
 
+                        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                            trigger_error("GLM Registrations - Payment Success", E_USER_NOTICE);
+                        }
+
                         $cartStatus = $this->config['submission_status_numb']['COMPLETE'];
 
                         // Store Credit Card information
@@ -696,7 +741,16 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
         );
 
         // Check if request to do a test checkout only - Don't clear session or update inventory
-        $doNotClear = $_REQUEST['bill_addr2'] == '*** GLM DO NOT CLEAR ***';
+        $doNotClear = false;
+        if ($_REQUEST['bill_addr2'] == '*** GLM DO NOT CLEAR ***') {
+
+            $doNotClear = true;
+
+            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                trigger_error("GLM Registrations - Test Submission Requested - Not clearing after processing", E_USER_NOTICE);
+            }
+
+        }
 
         // User Trace data
         $trace = array(
@@ -755,6 +809,11 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
         // Check if not properly stored ..... Send E-Mail to developers
         if ($updated === false) {
+
+            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                trigger_error("GLM Registrations - Failed to store checkout results!", E_USER_NOTICE);
+            }
+
             $err = array(
                 'Site'                  => $this->config['settings']['reg_org_name'],
                 'requestId'             => $requestId,
@@ -793,6 +852,10 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
         if (count($messages) != 0) {
 
+            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                trigger_error("GLM Registrations - Sending user back to checkout page!", E_USER_NOTICE);
+            }
+
             // Include the billing info same flag
             $regAccount['billingSame'] = $billingSame;
 
@@ -908,6 +971,11 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport
 
         // echo "<pre>".print_r($templateData['regAccount'],1)."</pre>";
 
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            trigger_error("GLM Registrations - Checkout processing complete", E_USER_NOTICE);
+        }
+
+
         // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
index d672d49..5df6a3c 100755 (executable)
@@ -25,6 +25,12 @@ e.g.
 1. Activate the plugin through the 'Plugins' menu in WordPress
 
 == Changelog ==
+= 1.0.18 =
+* Now properly formatting checkout failure notices in request Notes field
+* Added more list filtering and pagenation features to accounts and requests lists
+* Now not showing requests that have no attendees in request admin list
+* Added more debug information to checout processing 
+
 = 1.0.17 =
 * Fixed checkout error messages not showing on checkout page if not checkout page top text provided in settings
 
old mode 100644 (file)
new mode 100755 (executable)
index b36e7a5..ebdf4f8
         <div class="">
             <p>
                 <span class="glm-nowrap">
-                    <b>Name Search: </b><input  id="glmEventsSearch" name="textSearch" type="text" id="autoTest">
+                    <b>Name / E-mail / Organization / ID Search: </b><input  id="glmEventsSearch" name="textSearch" type="text" id="autoTest">
                     <input type="submit" value="Submit">
                 </span>
             <p>
         </div>
 
         <br clear="all">
-    <p><b>Total found:</b> {$numAccounts}&nbsp;&nbsp;</p>
+    <p><b>Total found:</b> {$numbAccounts}&nbsp;&nbsp; <b>Showing:</b> {$start} through {$lastDisplayed}</p>
 
-    {if $paging && $numAccounts}
+    {if $paging && $numbAccounts}
         <input type="Submit" name="pageSelect" value="Previous {$limit} Accounts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
         <input type="Submit" name="pageSelect" value="Next {$limit} Accounts" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
     {/if}
@@ -75,7 +75,7 @@
     </table>
 {/if}
 
-    {if $paging && $numAccounts}
+    {if $paging && $numbAccounts}
         <input type="Submit" name="pageSelect" value="Previous {$limit} Accounts" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
         <input type="Submit" name="pageSelect" value="Next {$limit} Accounts" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
     {/if}
index bb5d665..69d33e3 100644 (file)
                             <div class="glm-small-12 glm-column">
         {if $cart.request.notes != ''}
                                 <div style="background-color: white; border: solid black 1px; padding: .2em; margin-top: .2em;">
-                                    {$cart.request.notes}
+                                    {$cart.request.notes|nl2br}
                                 </div>
         {else}
                                 (no notes entered)
old mode 100644 (file)
new mode 100755 (executable)
index 84758e3..d22a8ec
@@ -18,7 +18,7 @@
     <div>
         <p>
             <span class="glm-nowrap">
-                <b>Text Search: <input type="text" name="textSearch"  value="{if $textSearch}{$textSearch}{/if}"></b>
+                <b>Name / E-Mail / Organzation / ID Search:</b> <input type="text" name="textSearch"  value="{if $textSearch}{$textSearch}{/if}"></b>
             </span>&nbsp;&nbsp;&nbsp;
             <span class="glm-nowarp">
                 Status: (Select at least one)
                     <option value="name"{if $orderBy == 'name'} selected{/if}>Name</option>
                     <option value="org"{if $orderBy == 'org'} selected{/if}>Organization</option>
                     <option value="city"{if $orderBy == 'city'} selected{/if}>City</option>
-                    <option value="state"{if $orderBy == 'state'} selected{/if}>State</option>
                     <option value="created"{if $orderBy == 'created'} selected{/if}>Date Created</option>
                     <option value="updated"{if $orderBy == 'updated'} selected{/if}>Last Updated</option>
                 </select>
             </span>&nbsp;&nbsp;&nbsp;
+                Include requests without attendees: <input type="checkbox" name="list_empty"{if $listEmpty} checked="checked"{/if}> 
                 <input type="submit" value="Submit">
             </span>
         </p>
@@ -50,7 +50,7 @@
 
   <div class="glm-admin-table-inner glm-admin-table">
   
-     <p><b>Total found:</b> {if $haveRequests}{$requestsCount}{else}(none){/if}&nbsp;&nbsp;</p>
+     <p><b>Total found:</b> {if $haveRequests}{$requestsCount}{else}(none){/if}&nbsp;&nbsp; <b>Showing:</b> {$start} through {$lastDisplayed}</p>
  
     {if $paging}
         <input type="Submit" name="pageSelect" value="Previous {$limit} Requests" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
                     <th>Last Name</th>
                     <th>Org</th>
                     <th>City</th>
-                    <th>State</th>
-                    <th>Country</th>
                     <th>Phone</th>
                     <th>E-mail</th>
+                    <th>Attendees</th>
                     <th>Created</th>
                     <th>Updated</th>
                     <th>Status</th>
                     <td>{$r.bill_lname}</td>
                     <td>{$r.bill_org}</td>
                     <td>{$r.bill_city}</td>
-                    <td>{$r.bill_state}</td>
-                    <td>{$r.bill_country}</td>
                     <td>{$r.bill_phone}</td>
                     <td>{$r.bill_email}</td>
+                    <td>{$r.numb_registrants}</td>
                     <td>{$r.date_created.datetime|substr:0:10}</td>
                     <td>{$r.last_update.datetime|substr:0:10}</td>
                     <td>{$r.status.name}</td>