* 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
* @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.
* 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.
// 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 );
//$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'];
// 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,
'haveRequests' => $haveRequests,
'registered' => $registered,
'haveRegistered' => $haveRegistered,
- 'reason' => $reason
+ 'reason' => $reason,
+ 'textSearch' => $textSearch
);
// Return status, any suggested view, and any data to controller
return array(
$prevStart = false;
$nextStart = false;
$start = 1;
+ $last = false;
$limit = 20; // Set to the number of listings per page
$orderBy = 'id';
$haveRequests = false;
$option = 'dashboard';
$errorMsg = false;
$textSearch = false;
+ $listEmpty = false;
$statusOptions = false;
$where = 'TRUE';
$deleted = false;
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);
}
$order = 'T.bill_city';
break;
- case 'state':
- $order = 'T.bill_state';
- break;
-
case 'created':
$order = 'T.date_created';
break;
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;
'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'].'/'
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
$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);
+ }
+
}
}
// 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
}
/*
- * Submission account?
+ * Process account
*/
if (count($messages) == 0) {
$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'];
} 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);
+ }
+
}
}
$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".
// 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
);
// 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(
// 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,
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;
// 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,
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
<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} </p>
+ <p><b>Total found:</b> {$numbAccounts} <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}
</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}
<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)
<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>
<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>
+ Include requests without attendees: <input type="checkbox" name="list_empty"{if $listEmpty} checked="checked"{/if}>
<input type="submit" value="Submit">
</span>
</p>
<div class="glm-admin-table-inner glm-admin-table">
- <p><b>Total found:</b> {if $haveRequests}{$requestsCount}{else}(none){/if} </p>
+ <p><b>Total found:</b> {if $haveRequests}{$requestsCount}{else}(none){/if} <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>