+ /*
+ * Is the request at the supplied ID still in "Cart" status
+ *
+ * @param integer $id ID of request
+ *
+ * @return boolean True if still in "Cart" status or false
+ */
+ function isCartStatus($id) {
+
+ $cart = $this->wpdb->get_row("
+ SELECT status
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request
+ WHERE id = $id
+ ;", ARRAY_A);
+
+ if ($cart['status'] == 0) {
+ return true;
+ }
+
+ return false;
+
+ }
+
/*
* Create a new cart
*
$this->cart['blockCheckout'] = false;
- // If cart status is false, then we don't have a cart so block checkout, clear cart ID, and return
- if (!$this->cart['status']) {
+ // If request returned status false or request is no longer in "cart" status , then we don't have a cart so block checkout, clear cart ID, and return
+ if (!$this->cart['status'] || $this->cart['request']['status']['value'] > 0) {
$this->cart['blockCheckout'] = true;
$_SESSION['glm_reg_cart_id'] = false;
- trigger_error('Cart ID '.$requestId.' does not have matching reg_request record. Cart ID removed from session.');
+ trigger_error('Request ID '.$requestId.' does not have matching reg_request record or no longer in cart status. Cart ID removed from session.');
return $this->cart;
}
// If we have a cart ID now
if ($cartId) {
+ if (!$this->isCartStatus($cartId)) {
+
+ // Clear session
+ $_SESSION['glm_reg_cart_id'] = false;
+
+ // Compile template data
+ $templateData = array(
+ 'messages' => array('We are unable to access your request. Your session may have timed out or been submitted already.')
+ );
+
+ // Send user back to list page
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'registrations',
+ 'modelRedirect' => 'list',
+ 'view' => 'front/registrations/list.html',
+ 'data' => $templateData
+ );
+
+ }
+
// Try to get a Validated cart with updated totals
$this->checkRegistrationRequest($cartId);
- // If the cart checks out OK
- if ($this->cart && $this->cart['status']) {
+ // If the cart loads OK
+ if ($this->cart) {
// Mark it as good and stuff the cart ID in the current session
$haveCart = true;
$_SESSION['glm_reg_cart_id'] = $cartId;
+ // Otherwise request is not valid or is no longer in "Cart" status
}
-
}
// Compile template data
if ($cartId) {
+ // Check if this request is not in Cart status
+ if (!$this->isCartStatus($cartId)) {
+
+ // Clear session
+ $_SESSION['glm_reg_cart_id'] = false;
+
+ // Compile template data
+ $templateData = array(
+ 'messages' => array('We are unable to access your request. Your session may have timed out or been submitted already.')
+ );
+
+ // Send user back to list page
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'registrations',
+ 'modelRedirect' => 'list',
+ 'view' => 'front/registrations/list.html',
+ 'data' => $templateData
+ );
+ }
+
$this->getRegistrationCart($cartId);
+ // If cart ID is good and we have a cart
if ($this->cart) {
+
$haveCart = true;
+
}
}
}
-
}
$regAccountId = $this->cart['request']['account'];
$requestId = ($_SESSION['glm_reg_cart_id'] - 0);
if ($requestId > 0) {
+ if (!$this->isCartStatus($requestId)) {
+
+ // Clear session
+ $_SESSION['glm_reg_cart_id'] = false;
+
+ // Compile template data
+ $templateData = array(
+ );
+
+ // Send user back to list page
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'registrations',
+ 'modelRedirect' => 'list',
+ 'view' => 'front/registrations/list.html',
+ 'data' => $templateData
+ );
+
+ }
+
// Try to get a validated cart
$this->checkRegistrationRequest($requestId);
/*
* 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.";
+ $messages[] = "The request may have already been submitted!";
// Build check code for display of summary in iframe
$summaryCheck = md5($this->cart['request']['id'].GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET.$this->cart['request']['account']);
$alphaSelected = false;
$haveRegEvents = false;
$regEventsCount = false;
+ $messages = false;
+
+ if (isset($actionData['messages'])) {
+ $messages = $actionData['messages'];
+ }
// Start by checking if we need to purge any old data - Once per hour
$lastPurgeTime = get_option('glmMembersRegistrationsPluginLastPurgeTime');
// Compile template data
$templateData = array(
'page' => 'register',
+ 'haveMessages' => count($messages),
+ 'messages' => $messages,
'regEventsCount' => $regEventsCount,
'haveRegEvents' => $haveRegEvents,
'regEvents' => $list,
// If it's a positive integer, try to get the cart
if ($cartId > 0) {
+
+ // Ask if this request is not in Cart status
+ if (!$RegCart->isCartStatus($cartId)) {
+
+ // Clear session
+ $_SESSION['glm_reg_cart_id'] = false;
+
+ // Compile template data
+ $templateData = array(
+ 'messages' => array('We are unable to access your request. Your session may have timed out or been submitted already.')
+ );
+
+ // Send user back to list page
+ return array(
+ 'status' => true,
+ 'menuItemRedirect' => 'registrations',
+ 'modelRedirect' => 'list',
+ 'view' => 'front/registrations/list.html',
+ 'data' => $templateData
+ );
+ }
+
+ // Get cart and check for insufficient inventory
$cart = $RegCart->checkRegistrationRequest( $cartId );
if ($cart !== false && is_array($cart)) {
$haveCart = true;
1. Activate the plugin through the 'Plugins' menu in WordPress
== Changelog ==
+= (pending) =
+* Checkout page now shows "Billing Information" if there are charges or "Contact Information" if there's no charge.
+
= 1.0.20 =
* Fixed date and time displayed for an event on registration page so it reflects only current or future dates and times.
* Fixed time displayed for an event on registration page so it no longer shows a range of times, only the time for the date shown.
<b>{$r.account.email}</b>
<p>
<input id="glmRegNotAttending_{$r.id}" type="checkbox" name="not_attending" value="1"{if $r.not_attending.value} checked{/if}> Not Attending<br>
- Note that if check this the inventory will be returned to permit another {$terms.reg_term_attendee} to {$terms.reg_term_register}.
+ 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>First Name</label>
<div class="glm-reg-billing-info">
<div class="row">
<div class="columns medium-8 small-12 text-left glm-reg-required">
+ {if $cart.grandTotal > 0}
<h4>Billing Information</h4>
+ {else}
+ <h4>Contact Information</h4>
+ {/if}
+
+
</div>
<div class="columns medium-4 small-12 glm-reg-required glm-reg-required-guide">
* Required Fields
</ul>
</div>
</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>
+{/if}
+
+
+
<div id="glm-reg-list" class="glm-reg-row">
{if $reg_bulletin}
<div id="reg_bulletin">