Fixed incorrect "ID" (should be "id") in updateTimeEntryCounts() in regCartSupport.
Removed some unwanted fields in several data classes and added pointer entries to get frequently used data.
Updated cart and checkout links and other layout issues for registrations.
'use' => 'lgneud'
),
- // Any MagicForm data associated with requested event
- 'mf_data' => array (
- 'field' => 'mf_data',
- 'type' => 'text',
- 'required' => false,
- 'use' => 'a'
- ),
-
// System operator's notes for this registration request
'notes' => array (
'field' => 'notes',
'type' => 'text',
'required' => false,
'use' => 'a'
- ),
- // Any MagicForm data associated with requested event
- 'mf_data' => array (
- 'field' => 'mf_data',
- 'type' => 'text',
- 'required' => false,
- 'use' => 'a'
- ),
+ )
);
'use' => 'a'
),
- // Any MagicForm data associated with registrant
- 'mf_data' => array (
- 'field' => 'mf_data',
- 'type' => 'text',
- 'required' => false,
- 'use' => 'a'
- ),
-
// System operator's notes for this registration request
'notes' => array (
'field' => 'notes',
'use' => 'lgneud'
),
- // Any MagicForm data associated with registrant
- 'mf_data' => array (
- 'field' => 'mf_data',
- 'type' => 'text',
- 'required' => false,
- 'use' => 'a'
- ),
-
// System operator's notes for this registration request
'notes' => array (
'field' => 'notes',
// Validate request ID
if (!$requestId || ($requestId-0) <= 0) {
- return false;
+ return $this->cart;
}
// Try to get the base registration request data
$this->cart['request'] = $RegRequest->getEntry($requestId);
if (!$this->cart['request']) {
- return false;
+ return $this->cart;
+ }
+
+ // Check if the person looking at this cart is permitted to do so
+ if (!$this->checkRequestingAccount($requestId)) {
+ return $this->cart;
}
// Add submitting account if not guest submission (at this point)
public function checkRegistrationRequest($requestId = false, $json = false, $noReturn = false)
{
+ $this->cart['blockCheckout'] = false;
+
// Try to get the cart data
$this->getRegistrationCart($requestId, false, true);
- if (!$this->cart) {
- return false;
+ // If cart status is false, then we don't have a cart so return now
+ if (!$this->cart['status']) {
+ $this->cart['blockCheckout'] = true;
+ return $this->cart;
}
// First purge any expired pending registration holds
$totalDiscounts = 0;
$grandTotal = 0;
- $this->cart['blockCheckout'] = false;
-
// If we have a cart and a good request array
if ($this->cart && is_array($this->cart['request'])) {
}
+ /*
+ * Update request to use another account
+ *
+ * @param integer $requestId
+ * @param integer $accountId
+ *
+ * @return boolean True is success otherwise false
+ * @access public
+ */
+ public function replaceRequestingAccount($requestId = false, $accountId = false)
+ {
+
+ // **** NEED TO COMPLETE THIS FUNCTION ****
+
+ }
+
+ /*
+ * Check if logged in user has permission to access cart
+ *
+ * Will also check for admin user and permit access even if it's not their cart
+ *
+ * If the cart does not have a submitting account (account = 0) then assign it to $accountId unless admin user
+ *
+ * @param integer $requestId
+ *
+ * @return boolean True if permitted otherwise false
+ * @access public
+ */
+ public function checkRequestingAccount($requestId = false)
+ {
+
+ // Do we have a valid request ID
+ if (!$requestId || ($requestId - 0) == 0) {
+ return false;
+ }
+
+ // Try to get the base request information
+ $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
+ $regRequest = $RegRequest->getEntry($requestId);
+ if (!$regRequest) {
+ return false;
+ }
+
+ // If the user is an WordPress administrator or we have contacts add-on and WordPress user with adequate permissions
+ if (current_user_can('administrator') && apply_filters('glm_members_menu_members', true)) {
+ return true;
+ }
+
+ // If there's no logged in registrations user
+ if (!isset($_SESSION) || !isset($_SESSION['LoginAccount']) || !is_array($_SESSION['LoginAccount'])) {
+
+ // If it's a guest account and the request ID is in the current session - allow cart
+ if ($_SESSION['LoginAccount']['id'] == 0 && $_SESSION['glm_reg_cart_id'] == $requestId) {
+ return true;
+ }
+
+ }
+ echo "<pre>".print_r($_SESSION,1).print_r($regRequest,1)."</pre>";
+ // If there's a logged in registrations user
+ if (isset($_SESSION) && isset($_SESSION['LoginAccount']) && is_array($_SESSION['LoginAccount'])) {
+
+ // If the registrations user owns the cart
+ if ($_SESSION['LoginAccount']['id'] == $regRequest['account']) {
+ return true;
+ }
+
+ // If it's a guest cart and the cart ID matches glm_reg_cart_id in session - Was user's cart before logged in
+ if ($regRequest['id'] == $_SESSION['glm_reg_cart_id']) {
+
+ // Assign this cart to the logged in user
+ $updated = $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+ array(
+ 'account' => $_SESSION['LogInAccount']['id']
+ ),
+ array( 'id' => $requestId ),
+ array(
+ '%d'
+ )
+ );
+
+ if ($updated) {
+ return true;
+ }
+
+ }
+ }
+
+ return false;
+ }
+
+
/*
* Add an account to the accounts list in the temoporary cart array if not already there
*
'attendees_pending' => $time['attendees_pending'],
'attendess_available' => $time['attendess_available']
),
- array( 'ID' => $timeId ),
+ array( 'id' => $timeId ),
array(
'%d',
'%d',
// Get all current registration event data
$regEvent = $this->getEventConfig($regEventID, false, false, true);
-$re = $this->checkEventTimes();
-echo "<pre>".print_r($re['firstTime']['start_time']['timestamp'],1)."</pre>";
-$earliestDate = date('m/d/y', $re['firstTime']['start_time']['timestamp']);
-echo "EarliestDate = $earliestDate<P>";
// Make all arrays of arrays non-associative to make Backbone happy
if (is_array($regEvent['reg_class'])) {
// If bad cart ID, set to false
if ($cartId <= 0) {
$cartId = false;
- } else {
- // If good dart ID save that in the session
- $_SESSION['glm_reg_cart_id'] = $cartId;
}
} elseif (isset($_SESSION['glm_reg_cart_id'])) {
}
+ // If we have a cart ID now
if ($cartId) {
- // Try to get a Validate cart with updated totals
+ // Try to get a Validated cart with updated totals
$this->checkRegistrationRequest($cartId);
- if ($this->cart) {
+ // If the cart checks out OK
+ if ($this->cart && $this->cart['status']) {
+
+ // Mark it as good and stuff the cart ID in the current session
$haveCart = true;
+ $_SESSION['glm_reg_cart_id'] = $cartId;
+
}
}
+
$view = 'cart';
// Compile template data
$templateData = array(
+ 'page' => 'cart',
'cartId' => $cartId,
'haveCart' => $haveCart,
'cart' => $this->cart,
// Compile template data
$templateData = array(
+ 'page' => 'checkout',
'cartId' => $cartId,
'haveCart' => $haveCart,
'cart' => $this->cart,
// Compile template data
$templateData = array(
+ 'page' => 'checkoutProcess'
);
// Return status, any suggested view, and any data to controller
// Compile template data
$templateData = array(
+ 'page' => 'register',
//'events' => $eventData,
'regEventsCount' => $regEventsCount,
'haveRegEvents' => $haveRegEvents,
// Compile template data
$templateData = array(
+ 'page' => 'register',
'reg' => $reg,
'emailError' => $emailError,
'regUrl' => GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/',
$this->postProcAddedEventData = true;
$regEvent = $this->getEventForRegistration($eventRegID);
- // echo '<pre>$regEvent: ' . print_r( $regEvent, true ) . '</pre>';
+ //echo '<pre>$regEvent: ' . print_r( $regEvent, true ) . '</pre>';
// Create an $event array with the event data.
$event = array(
// Compile template data
$templateData = array(
+ 'page' => 'registration',
'haveCart' => $haveCart,
'isNewCart' => $isNewCart,
'regEvent' => $regEvent,
// Compile template data
$templateData = array(
+ 'page' => 'summary'
);
// Return status, any suggested view, and any data to controller
*
* misc - Misc settings and text - Site owner may update
*
- * Magic Forms Tables
- * magicforms - Forms
- * --> Event, Registration, Rate Class, Account, Registrant
- * mf_data - Data submitted to a form
- * --> Submission, Event Registration, Rate Class selected, Account, Registrant
- * mf_temp_file - Temporary file meta-data
- *
- * added_info_fields - Additional fields
- * added_info_data - Submitted additional field data
- * --> added_info_fields
- *
* payment codes - Promotional payment codes - Used with various things
* --> Event, Submission, Event Registration, Event Registrant, Account or global
*
* reg_request_rate - Specific registration date/rate (one or more)
* reg_request_registrant - Registrant (one or more)
*
+ * NOTE: additional fields and added fields data will be coming from the Custom Fields add-on
*
* Overall Flow
* ------------
reg_event INT NULL, -- Pointer to reg_event
event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data
event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart
- mf_data TEXT NULL, -- Any MagicForm data associated with requested event
+-- mf_data TEXT NULL, -- Any MagicForm data associated with requested event
notes TEXT NULL, -- System operator's notes for this registration request
PRIMARY KEY (id),
INDEX (reg_request),
reg_request_event INT NULL, -- Pointer to reg_request_event table entry
class INT NULL, -- Pointer to event reg_class table - False (0) if registration class no longer exits
class_name TINYTEXT NULL, -- Name of event class at the time selected
- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
+-- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
notes TEXT NULL, -- System operator's notes for this registration request
PRIMARY KEY (id),
INDEX (reg_event),
base_rate FLOAT, -- Base rate at time of registration
per_registrant FLOAT, -- Per Registrant Rate at time of registration
registrant_credits TINYINT NULL, -- Number of registrants included in base rate at time of registration
- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
+-- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
notes TEXT NULL, -- System operator's notes for this registration request
PRIMARY KEY (id),
INDEX (reg_event),
reg_request_rate INT NULL, -- Pointer to reg_request_rate table entry
fname TINYTEXT NULL, -- First name of registrant at the time of selection
lname TINYTEXT NULL, -- Last name of registrant at the time of selection
- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
+-- mf_data TEXT NULL, -- Any MagicForm data associated with registrant
notes TEXT NULL, -- System operator's notes for this registration request
PRIMARY KEY (id),
INDEX (account),
</div>
<div class="glm-rate-label" style="margin-bottom: .5em;">
<h3><%= name %></h3>
- Start Days: <%= start_days %>, End Days: <%= end_days %>, Base: <%= base_rate %>. Per-Registrant: <%= per_registrant %>. Registrant Credits: <%= registrant_credits %>
+ Start Days: <%= start_days %>, End Days: <%= end_days %>, Base: $<%= base_rate %>. Per-Registrant: $<%= per_registrant %>. Registrant Credits: <%= registrant_credits %>
</div>
</div>
</div>
<tr>
<th style="white-space: nowrap;">Cost:</th>
<td>
- <span class="glm-nowrap">Base <input class="rate-base-rate glm-form-text-input-veryshort" type="text" name="base_rate_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (base_rate) { %><%- base_rate %><% } %>"></span>
- <span class="glm-nowrap">Per-Registrant <input class="rate-per-registrant glm-form-text-input-veryshort" type="text" name="per_registrant_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (per_registrant) { %><%- per_registrant %><% } %>"></span>
+ <span class="glm-nowrap">Base $<input class="rate-base-rate glm-form-text-input-veryshort" type="text" name="base_rate_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (base_rate) { %><%- base_rate %><% } %>"></span>
+ <span class="glm-nowrap">Per-Registrant $<input class="rate-per-registrant glm-form-text-input-veryshort" type="text" name="per_registrant_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (per_registrant) { %><%- per_registrant %><% } %>"></span>
<span class="glm-nowrap">Registrant Credits <input class="rate-registrant-credits glm-form-text-input-veryshort" type="text" name="registrant_credits_<% if (id) { %><%- id %><% } else { %> new <% } %>" value="<% if (registrant_credits) { %><%- registrant_credits %><% } %>"></span>
<br>
</td>
{if $haveRequests}
{foreach $requests as $r}
<tr>
- <td>{$r.id}</a></td>
+ <td>{$r.id}<a href="">show</a></td>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_fname}</td>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_lname}</td>
<td><a href="{$thisUrl}?page=glm-members-admin-menu-registrations-requests&option=requestDashboard&requestID={$r.id}">{$r.bill_org}</td>
{include file='front/registrations/header.html'}
-{if $haveCart}
- <h2>Selected Registrations</h2>
-
+ <div>
+ <div class="glm-right" style="padding-top: 1.5em;" title="Please refer to this ID when requesting assistance.">Request ID: {$cartId}</div>
+ <h2 class="glm-left" style="clear: none;">Selected Registrations</h2>
+ </div>
<table class="glm-admin-table" width="100%">
<thead>
</thead>
+
<tbody>
+{if $haveCart}
+
{foreach $cart.events as $event}
<tr>
- <th colspan="5">Event: {$event.event_name}</th>
+ <th colspan="5"><a href="{$regUrl}?page=registration&eventRegId={$event.reg_event}"><span class="dashicons dashicons-edit"></span></a>Event: {$event.event_name}</th>
</tr>
{foreach $event.classes as $class}
<tr>
<td style="text-align: right;">${$cart.totalCharges|number_format:2}</td>
</tfoot>
+{else}
+ <tr><td colspan="5" class="glm-reg-warning">There was a problem locating the information for your request!</td></tr>
+{/if}
</tbody>
</table>
{if $cart.blockCheckout}
<div>
- <div class="glm-reg-warning">You have not yet submitted your registration. See above for issues! <img src="{$assetUrl}/fingerUpRed.svg" width="50";"></div>
+ <div class="glm-reg-warning">You have not yet submitted your registration. See above notes! <img src="{$assetUrl}/fingerUpRed.svg" style="height: 2em;"></div>
</div>
{else}
<div class="glm-right">
- <div class="glm-reg-warning">You have not yet submitted your registration! <img src="{$assetUrl}/fingerRightRed.svg" width="50";"> <a href="{$regUrl}?page=checkout" class="button tiny">Complete Registration</a></div>
+ <div class="glm-reg-warning">You have not yet submitted your registration! <img src="{$assetUrl}/fingerRightRed.svg" style="height: 2em;"> <a href="{$regUrl}?page=checkout" class="button tiny">Complete Registration</a></div>
</div>
{/if}
-{else}
- <tr class="alternate"><td colspan="2">No cart data</td></tr>
-{/if}
+
+
+
{if $cart.blockCheckout}
<div>
- <div class="glm-reg-warning">You have not yet submitted your registration. See above for issues! <img src="{$assetUrl}/fingerUpRed.svg" width="50";"></div>
+ <div class="glm-reg-warning">You have not yet submitted your registration. See above for issues! <img src="{$assetUrl}/fingerUpRed.svg" style="height: 2em;"></div>
</div>
{else}
- <div class="glm-right">
- <div class="glm-reg-warning">You have one more step! <img src="{$assetUrl}/fingerRightRed.svg" width="50";"> <a href="{$regUrl}?page=checkout" class="button tiny">Submit Registration</a></div>
+ <div class="glm-right" style="white-space; nowrap;">
+ <span class="glm-reg-warning">You have one more step to complete your registration!</span> <img src="{$assetUrl}/fingerRightRed.svg" style="height: 2em;"> <a href="{$regUrl}?page=checkout" class="button tiny">Submit Registration</a>
+ or <a href="{$regUrl}?page=cart" class="button tiny">Return to Cart</a>
</div>
{/if}
<div id="accountHeader">
+ <div class="glm-right">
{if $loggedIn}
Logged in as {$loggedIn.fname} {$loggedIn.lname}
<a class="button tiny" href="{$regUrl}?page=login&option=logout">Logout</a>
<a id="appLogin" class="button tiny" href="{$regUrl}?page=login">Login</a>
<a id="register" class="button tiny" href="{$regUrl}?page=register">Register</a>
{/if}
-</div>
-<div>
- <a href="{$regUrl}" class="button tiny">Register for Another Event</a>
+ </div>
+ {if $page != 'register'}
+ <a href="{$regUrl}" class="button tiny">Register for Another Event</a>
+ {/if}
+
</div>