Now displaying event and registrant totals in cart widget popup.
Now purging empty carts when account logs in.
Selecting latest non-empty cart when logging in.
Added more registrant info to cart and checkout summaries.
Fixed problems with not having account input data for checkout view when checking out as a guest
// Try to get the full list of pending carts for this user
$RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
- $cartSummary['regRequests'] = $RegRequest->getRegRequestListSimplified($where);
+ $cartSummary['regRequests'] = $RegRequest->getRegRequestListSimplified($where, true);
if (is_array($cartSummary['regRequests']) && count($cartSummary['regRequests'])) {
'cartPageText' => $misc['cart_page_text']
);
- echo "<pre>".print_r($templateData,1)."</pre>";
+ // echo "<pre>".print_r($templateData,1)."</pre>";
// Return status, any suggested view, and any data to controller
return array(
// Otherwise setup for a new account
} else {
- $regAccount = $Account->newEntry();
+ // Create an account record
+ $this->wpdb->insert(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'account',
+ array(
+ 'active' => true,
+ 'validated' => false,
+ 'date_created' => date('Y-m-d')
+ ),
+ array('%d', '%d', '%s')
+ );
+ $regAccountId = $this->wpdb->insert_id;
+
+ // Update request with account ID
+ $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
+ array('account' => $regAccountId),
+ array( 'id' => $cartId ),
+ array('%d')
+ );
+
+ // Get the account again for editing with all fields
+ $regAccount = $Account->editEntry($regAccountId);
+ // Create a suggested password and add it to the account
require_once GLM_MEMBERS_REGISTRATIONS_MAIN_PLUGIN_LIB_PATH.'/EasyPassword/EasyPassword.php';
$EasyPassword = new EasyPassword();
$regAccount['fieldData']['password'] = $EasyPassword->generateEasyPassword($type = 'firstlast');
// *** If redirected back, be sure to get the submitted data
- // Accounts list not needed
- unset($this->cart['accounts']);
-
$view = 'checkout';
$Misc = new GlmDataRegistrationsMisc($this->wpdb, $this->config);
$misc = $Misc->getEntry(1);
- // Compile template data
+ // If we don't have billing same flag initialized, do it now
+ if (!isset($regAccount['billingSame'])) {
+ $regAccount['billingSame'] = false;
+ }
+
+ // Compile template data
$templateData = array(
'page' => 'checkout',
'regAccountId' => $this->cart['request']['account'],
'fname' => $returnData['fname'],
'lname' => $returnData['lname'],
);
+
+ // Check for existing carts in "CART" status
+ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php';
+ $RegCartSupport = new GlmRegCartSupport($this->wpdb, $this->config);
+ $regCartSummary = $RegCartSupport->regCartSummary($returnId);
+
+ $RegRequest = false;
+ $deleted = false;
+
+ // If there's any current carts, get the last (most recent) one.
+ if ($regCartSummary && isset($regCartSummary['regRequests']) && count($regCartSummary['regRequests']) > 0 ) {
+
+ // If there's any carts with no events, delete them
+ foreach ($regCartSummary as $rcs) {
+ foreach ($rcs as $r) {
+
+ // If this cart is empty
+ if ($r['numb_events'] == 0) {
+
+ // If we haven't instatiated the reg request class
+ if ($RegRequest == false) {
+
+ require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php';
+ $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
+ }
+
+ // Delete this entry
+ $RegRequest->deleteEntry($r['id'], true);
+
+ $deleted = true;
+ }
+
+ }
+ }
+
+ // If any were deleted, but the cart summary again.
+ if ($deleted) {
+ $regCartSummary = $RegCartSupport->regCartSummary($returnId);
+ }
+
+ // If there's still any carts, make the latest one the current cart
+ if (count($regCartSummary['regRequests']) > 0) {
+ $mostRecent = end($regCartSummary['regRequests']);
+ $_SESSION['glm_reg_cart_id'] = $mostRecent['id'];
+ }
+
+ }
+
+
$modelRedirect = 'index';
$_REQUEST['page'] = 'list';
{/if}
</td>
</tr>
+ {assign var="acct" value=$cart.accounts.{$registrant.account}}
+ {if $acct.validated.value}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
+ (Account information is restricted)
+ </td>
+ </tr>
+ {else}
+ {if $acct.addr != '' || $acct.phone != '' || $acct.email != ''}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.org != ''} {$acct.title}, {$acct.org}<br> {/if}
+ {if $acct.addr1 != ''} {$acct.addr1}<br> {/if}
+ {if $acct.addr2 != ''} {$acct.addr2}<br> {/if}
+ {if $acct.city != ''} {$acct.city}, {$acct.state.value} {$acct.zip}<br> {/if}
+ {if $acct.country.name != ''} {$acct.country.name}<br> {/if}
+ {if $acct.phone != ''} Phone: {$acct.phone}<br> {/if}
+ {if $acct.fax != ''} Fax: {$acct.fax}<br> {/if}
+ {if $acct.email != ''} E-Mail: {$acct.email} {/if}
+ </td>
+ </tr>
+ {/if}
+ {/if}
{/foreach} {* registrants *}
{/foreach} {* rates *}
{/foreach} {* classes *}
<center>
<table>
<thead>
- <tr><th>ID</th><th style="white-space: nowrap;">Date created</th><th style="white-space: nowrap;">Date last updated</th><th>Selected</th></tr>
+ <tr><th>ID</th><th style="white-space: nowrap;">Date created</th><th style="white-space: nowrap;">Date last updated</th><th>Events</th><th>Registrants</th><th>Selected</th></tr>
</thead>
<tbody>
{foreach $regRequests as $rr}
</td>
<td style="white-space: nowrap;">{$rr.date_created.datetime}</td>
<td style="white-space: nowrap;">{$rr.last_update.datetime}</td>
+ <td style="white-space: nowrap;">{$rr.numb_events}</td>
+ <td style="white-space: nowrap;">{$rr.numb_registrants}</td>
<td>
{if $rr.id == $id}
Yes
autoOpen: true,
resizable: false,
modal: true,
- width: 500,
+ width: "auto",
closeText: "hide",
buttons: {
"Cancel": function () {
</div>
<div class="glm-reg-row">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.addr2} glm-reg-required{/if}"> </div>
- <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.addr1} glm-reg-fail{/if}"><input type="text" name="addr2" value="{$regAccount.fieldData.addr2}"{if $regAccount.fieldRequired.addr2} required{/if}></div>
+ <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.addr2} glm-reg-fail{/if}"><input type="text" name="addr2" value="{$regAccount.fieldData.addr2}"{if $regAccount.fieldRequired.addr2} required{/if}></div>
</div>
<div class="glm-reg-row">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.city} glm-reg-required{/if}">City:</div>
</div>
<div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_addr2} glm-reg-required{/if}"> </div>
- <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_addr1} glm-reg-fail{/if}"><input type="text" name="bill_addr2" value="{$regAccount.fieldData.bill_addr2}"{if $regAccount.fieldRequired.bill_addr2} required{/if}></div>
+ <div class="glm-large-9 glm-columns{if $regAccount.fieldFail.bill_addr2} glm-reg-fail{/if}"><input type="text" name="bill_addr2" value="{$regAccount.fieldData.bill_addr2}"{if $regAccount.fieldRequired.bill_addr2} required{/if}></div>
</div>
<div class="glm-reg-row glm-reg-bill-field">
<div class="glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_city} glm-reg-required{/if}">City:</div>
{/if}
</td>
</tr>
+ {assign var="acct" value=$cart.accounts.{$registrant.account}}
+ {if $acct.validated.value}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
+ (Account information is restricted)
+ </td>
+ </tr>
+ {else}
+ {if $acct.addr1 != '' || $acct.phone != '' || $acct.email != ''}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.org != ''} {$acct.title}, {$acct.org}<br> {/if}
+ {if $acct.addr1 != ''} {$acct.addr1}<br> {/if}
+ {if $acct.addr2 != ''} {$acct.addr2}<br> {/if}
+ {if $acct.city != ''} {$acct.city}, {$acct.state.value} {$acct.zip}<br> {/if}
+ {if $acct.country.name != ''} {$acct.country.name}<br> {/if}
+ {if $acct.phone != ''} Phone: {$acct.phone}<br> {/if}
+ {if $acct.fax != ''} Fax: {$acct.fax}<br> {/if}
+ {if $acct.email != ''} E-Mail: {$acct.email} {/if}
+ </td>
+ </tr>
+ {/if}
+ {/if}
{/foreach}
{/foreach}
{/foreach}
{/if}
</td>
</tr>
+ {assign var="acct" value=$cart.accounts.{$registrant.account}}
+ {if $acct.validated.value}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.email != ''}E-Mail: {$acct.email}<br>{/if}
+ (Account information is restricted)
+ </td>
+ </tr>
+ {else}
+ {if $acct.addr != '' || $acct.phone != '' || $acct.email != ''}
+ <tr>
+ <td colspan="2"> </td>
+ <td colspan="3">
+ {if $acct.org != ''} {$acct.title}, {$acct.org}<br> {/if}
+ {if $acct.addr1 != ''} {$acct.addr1}<br> {/if}
+ {if $acct.addr2 != ''} {$acct.addr2}<br> {/if}
+ {if $acct.city != ''} {$acct.city}, {$acct.state.value} {$acct.zip}<br> {/if}
+ {if $acct.country.name != ''} {$acct.country.name}<br> {/if}
+ {if $acct.phone != ''} Phone: {$acct.phone}<br> {/if}
+ {if $acct.fax != ''} Fax: {$acct.fax}<br> {/if}
+ {if $acct.email != ''} E-Mail: {$acct.email} {/if}
+ </td>
+ </tr>
+ {/if}
+ {/if}
{/foreach}
{/foreach}
{/foreach}