}
+ /**
+ * Entry Post Processing Call-Back Method
+ *
+ * Perform post-processing for all result entries.
+ *
+ * @param array $r Array of field result data for a single entry
+ * @param string $a Action being performed (l, i, g, ...)
+ *
+ * @return object Class object
+ *
+ */
+ public function entryPostProcessing( $result_data, $action )
+ {
+
+ // If doing the following actions
+ if (in_array($action, array('i'))) {
+
+ // Set the created date
+ $date = date('Y-m-d');
+ $this->wpdb->update(
+ GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event",
+ array('date_created' => $deate),
+ array('id' => $result_data['id']),
+ array('%s')
+ );
+
+ }
+
+ return $result_data;
+
+ }
+
+
public function checkOther($r, $a)
{
return $r;
}
+
+ /**
+ * Update Account Billing Only
+ *
+ * @param integer $requestId ID of registration request
+ *
+ * @return object Class object
+ */
+ public function updateAccountBillingOnly($accountId = false)
+ {
+
+ $savedFields = $this->fields;
+
+ $this->fields = array(
+ 'email' => $savedFields['email'],
+ 'bill_fname' => $savedFields['bill_fname'],
+ 'bill_lname' => $savedFields['bill_lname'],
+ 'bill_org' => $savedFields['bill_org'],
+ 'bill_title' => $savedFields['bill_title'],
+ 'bill_addr1' => $savedFields['bill_addr1'],
+ 'bill_addr2' => $savedFields['bill_addr2'],
+ 'bill_city' => $savedFields['bill_city'],
+ 'bill_state' => $savedFields['bill_state'],
+ 'bill_zip' => $savedFields['bill_zip'],
+ 'bill_country' => $savedFields['bill_country'],
+ 'bill_phone' => $savedFields['bill_phone'],
+ 'bill_fax' => $savedFields['bill_fax']
+ );
+
+ $requestSimplified = $this->getEntry($accountId);
+
+ $this->fields = $savedFields;
+ $this->postProcRegRequest = $savedPostProcess;
+
+ return $requestSimplified;
+
+ }
+
}
$ccConfirmation = '';
$emailError = false;
$passwordError = false;
+ $reqData = array();
+ $reqFormat = array();
$Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
$Request = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config);
}
// Check if cart has been successfully checked out or has been marked canceled.
- if ($this->cart['request']['status']['value'] > 0) {
+ if ($this->cart['request']['status']['name'] != 'CART') {
$messages[] = "This request has already been submitted!<br>The information below is a summary of your submitted request.";
* Submission account?
*/
- // Check if we need to collect billing account information or if it's the same as the main contact
-// if (isset($_REQUEST['billing_same']) && $_REQUEST['billing_same']) {
-// $billingSame = true;
-// }
-
if (count($messages) == 0) {
// If there's a logged in registrations user - Cart should already be with this account
// Try to update the account information and if that works get the data for editing again
if ($accountId > 0) {
-/*
- $regAccount = $Account->updateEntry($accountId);
-
- // If there was a problem, indicate that
- if (!$regAccount) {
- $messages[] = 'Unable to recall your account information. Please try again later.';
-
- // Otherwise get the data again prepaired for editing
- } else {
-*/
- $regAccount = $Account->editEntry($accountId);
- // }
+ $regAccount = $Account->updateAccountBillingOnly($accountId);
}
// Otherwise this is a guest so try to create the account using the submitted data
} else {
// Create the new account
- $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config);
$regAccount = $Account->insertEntry();
// If that was successful
}
-// echo "Form Result: <pre>".print_r($formResult,1)."</pre>";
-
// Save the results in the cart event data
$this->cart['events'][$eventKey]['customForm'] = $formResult;
}
}
-// echo "<pre>".print_r($this->cart['events'],1)."</pre>";
-
-
-// wp_die("KILLING WORDPRESS FOR TESTING IN checkoutProcess.php");
-
-
/*
* Policies accepted?
*/
$payMethod = ($_REQUEST['payMethod'] - 0);
}
- // Make sure that the selected payment method is available
- if ($payMethod > 0 && ($management['reg_payment_methods']['bitmap'][$payMethod]['default'])) {
- $payMethodName = $management['reg_payment_methods']['bitmap'][$payMethod]['name'];
- } else {
- $payMethod = false;
- }
-
- // Check if Billing data source fields
- $billPrefix = 'bill_';
- if (isset($_REQUEST['billing_same']) && $_REQUEST['billing_same']) {
- $billPrefix = '';
- }
+ // Add billing information to billing array
$billing = array(
- 'fname' => $regAccount['fieldData'][$billPrefix.'fname'],
- 'lname' => $regAccount['fieldData'][$billPrefix.'lname'],
- 'addr1' => $regAccount['fieldData'][$billPrefix.'addr1'],
- 'addr2' => $regAccount['fieldData'][$billPrefix.'addr2'],
- 'city' => $regAccount['fieldData'][$billPrefix.'city'],
- 'state' => $regAccount['fieldData'][$billPrefix.'state']['value'],
- 'country' => $regAccount['fieldData'][$billPrefix.'country']['value'],
- 'zip' => $regAccount['fieldData'][$billPrefix.'zip'],
- 'phone' => $regAccount['fieldData'][$billPrefix.'phone'],
+ 'fname' => $regAccount['fieldData']['bill_fname'],
+ 'lname' => $regAccount['fieldData']['bill_lname'],
+ 'addr1' => $regAccount['fieldData']['bill_addr1'],
+ 'addr2' => $regAccount['fieldData']['bill_addr2'],
+ 'city' => $regAccount['fieldData']['bill_city'],
+ 'state' => $regAccount['fieldData']['bill_state']['value'],
+ 'country' => $regAccount['fieldData']['bill_country']['value'],
+ 'zip' => $regAccount['fieldData']['bill_zip'],
+ 'phone' => $regAccount['fieldData']['bill_phone'],
'email' => $regAccount['fieldData']['email']
);
// Execute selected payment method
switch ($payMethod) {
- /*
- submission_status_numb['CART'] = 0
- submission_status_numb['COMPLETE'] = 10
- submission_status_numb['UNPAID'] = 20
- submission_status_numb['CC_PEND'] = 30
- submission_status_numb['CC_DECL'] = 40
- submission_status_numb['PAYMENT_PEND'] = 50
- submission_status_numb['ON_ARRIVAL'] = 60
- submission_status_numb['ADMIN_HOLD'] = 70
- submission_status_numb['FAILED'] = 80
- submission_status_numb['CANCELED'] = 99
- */
-
// No Charge
case $this->config['payment_method_numb']['NoCharge']:
$cartStatus = $this->config['submission_status_numb']['COMPLETE'];
case $this->config['payment_method_numb']['Check']:
// Get the check input
- $cardData = array(
- 'cc_name' => filter_input(INPUT_POST, 'cc_name', FILTER_SANITIZE_STRING), // Name on Check
- 'cc_numb' => filter_input(INPUT_POST, 'cc_numb', FILTER_SANITIZE_NUMBER_INT) // Check Number
+ $checkData = array(
+ 'cc_name' => filter_input(INPUT_POST, 'cc_name', FILTER_SANITIZE_STRING), // Name on Check
+ 'cc_numb' => filter_input(INPUT_POST, 'cc_numb', FILTER_SANITIZE_NUMBER_INT) // Check Number
);
- // Check all credit card input
+ // Check all check input
if (
- $cardData['cc_name'] && $cardData['cc_name'] != '' && // Name on Check
- $cardData['cc_numb'] && $cardData['cc_numb'] > 0 // Check Number
+ $checkData['cc_name'] && $checkData['cc_name'] != '' && // Name on Check
+ $checkData['cc_numb'] && $checkData['cc_numb'] > 0 // Check Number
) {
$cartStatus = $this->config['submission_status_numb']['COMPLETE'];
} else {
$messages[] = 'You did not supply all required check information.';
}
+ // Add check data to storage
+ $reqData = array_merge(
+ $reqData,
+ array(
+ 'cc_name' => $checkData['cc_name'], // Name on Check
+ 'cc_numb' => $checkData['cc_numb'] // Check Number
+ )
+ );
+ $reqFormat = array_merge(
+ $reqFormat,
+ array(
+ '%s',
+ '%s'
+ )
+ );
+
break;
// Payment Pending
$payment = array(
'name' => $this->config['settings']['reg_org_name'], // Name of venue
- 'charge' => $this->cart['totalCharges'], // Total charges this venue
+ 'charge' => $this->cart['totalCharges'], // Total charges
'cctype' => $cardData['cc_type'], // Card Type
'ccname' => $cardData['cc_name'], // Name on Card
'ccnumb' => $cardData['cc_numb'], // Card Number
// If successful submission - say we're complete
if (is_array($ccResult) && isset($ccResult['status']) && $ccResult['status'] == 1) {
+
$cartStatus = $this->config['submission_status_numb']['COMPLETE'];
- }
- // set $ccConfirmation
+ // Store Credit Card information
+ $cc_numb_store = '....'.substr($payment['ccnumb'], -4);
+ $reqData = array_merge(
+ $reqData,
+ array(
+ 'cc_type' => $payment['cctype'],
+ 'cc_name' => $payment['ccname'],
+ 'cc_numb' => $cc_numb_store,
+ 'cc_exp' => $payment['ccexp'],
+ 'cc_conf' => $ccConfirmation,
+ )
+ );
+ $reqFormat = array_merge(
+ $reqFormat,
+ array(
+ '%d',
+ '%s',
+ '%s',
+ '%s',
+ '%s',
+ )
+ );
+
+ }
}
break;
// Pay Pal
- case $this->config['payment_method_numb']['PayPal']:
- break;
+// case $this->config['payment_method_numb']['PayPal']:
+// break;
// Payment Method unknown
default:
-// $payMethod = false;
+ $payMethod = false;
+ $messages[] = "I'm sorry, we couldn't tell which payment method you wanted to use. Please select one under \"Payment Information\" below.";
break;
}
-exit;
/*
* Update the reg_request reccord: account id, billing, payment, status, etc...
*/
- $reqData = array();
- $reqFormat = array();
$now = date('Y-m-d H:i:s', time());
// Account ID
$reqData['account'] = $accountId;
$reqFormat[] = '%d';
- // Billing data
-
+ // Add billing data to requesst update arrays
$reqData = array_merge(
$reqData,
array(
)
);
- // If COMPLETE, save date, pay method, status, total
- if ($cartStatus == $this->config['submission_status_numb']['COMPLETE'] && $billing['addr2'] != '*** DO NOT CLEAR ***') {
+ // Save date, pay method, status, total
+ if (count($messages) == '' && $billing['addr2'] != '*** DO NOT CLEAR ***') {
$reqData = array_merge(
$reqData,
'date_submitted' => $now,
'pay_method' => $payMethod,
'status' => $cartStatus,
- 'total' => $payment['charge'],
+ 'total' => $this->cart['totalCharges'],
'total_discounts' => $this->cart['totalDiscounts'],
'registrants' => $this->cart['totalRegistrants']
)
$reqData['user_trace_info'] = serialize($trace);
$reqFormat[] = '%s';
- // Credit Card information
- $cc_numb_store = '';
- if (is_array($payment)) {
-
- $cc_numb_store = '....'.substr($payment['ccnumb'], -4);
-
- $reqData = array_merge(
- $reqData,
- array(
- 'cc_type' => $payment['cctype'],
- 'cc_name' => $payment['ccname'],
- 'cc_numb' => $cc_numb_store,
- 'cc_exp' => $payment['ccexp'],
- 'cc_conf' => $ccConfirmation,
- )
- );
- $reqFormat = array_merge(
- $reqFormat,
- array(
- '%s',
- '%s',
- '%s',
- '%s',
- '%s',
- )
- );
-
- $reqData['cc_type'] = $payment['cctype'];
- $reqFormat[] = '%s';
-
- }
-
$reqFormat[] = '%s';
// Store the data
'status' => $this->config['submission_status'],
'misc' => $misc
);
+
$summary = $this->generateHTML($summaryData, 'front/registrations/summaryStore.html');
+
+ // Store this summary in the request reccord
$updated = $this->wpdb->update(
GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request',
array(
),
array( 'id' => $requestId ),
array('%s')
- );
+ );
+ if ($updated != 1 && $billing['addr2'] != '*** DO NOT CLEAR ***') {
+ $messages[] = 'Cart Summary did not store. This is a technical issue that means our systems could not store a summmary of what you submitted.';
+ }
- // Update inventory totals and send notifications
+ // Update inventory totals and send notifications unless this is a test submission
if ($billing['addr2'] != '*** DO NOT CLEAR ***') {
+
$this->checkoutUpdateInventoryAndNotify($summary);
}
unset($_SESSION['glm_reg_cart_id']);
}
-
$view = 'summary';
// Build check code for display of summary in iframe
// Compile template data
$templateData = array(
+ 'haveMessages' => count($messages),
+ 'messages' => $messages,
'guestAccount' => $guestAccount,
'requestId' => $requestId,
'summaryCheck' => $summaryCheck,
{if $checkoutPageText}
<div id="checkout-page-text" class="glm-row">
- {$checkoutPageText}
- </div>
-{/if}
+ <p>{$checkoutPageText}</p>
+
+ {if $haveMessages}
+ <div class="glm-registrations-messages glm-reg-warning" class="glm-row">
+ <i>Please Note:</i>
+ <ul>
+ {foreach $messages as $m}
+ <li>{$m}</li>
+ {/foreach}
+ </ul>
+ </div>
+ {/if}
+
-{if $haveMessages}
- <div class="glm-registrations-messages glm-reg-warning" class="glm-row">
- <i>Please Note:</i>
- <ul>
-{foreach $messages as $m}
- <li>{$m}</li>
-{/foreach}
- </ul>
</div>
{/if}
+
{if $haveCart}
<form id="checkoutForm" href="{$regUrl}" method="post" class="glm-row">
<input type="hidden" name="page" value="checkoutProcess">
</div>
<div class="glm-reg-row glm-reg-bill-field">
<div class="glm-reg-checkout-field-label glm-small-12 glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.bill_fax} glm-reg-required{/if}">FAX{if $regAccount.fieldRequired.bill_fax} *{/if}</div>
- <div class="glm-reg-checkout-field-data glm-small-12 glm-large-9 glm-columns{if $regAccount.fieldFail.bill_fax} glm-reg-fail{/if}"><input type="text" name="bill_fax" value="{$regAccount.fieldData.bill_fax}"{if $regAccount.fieldRequired.fax} required{/if}></div>
+ <div class="glm-reg-checkout-field-data glm-small-12 glm-large-9 glm-columns{if $regAccount.fieldFail.bill_fax} glm-reg-fail{/if}"><input type="text" name="bill_fax" value="{$regAccount.fieldData.bill_fax}"{if $regAccount.fieldRequired.bill_fax} required{/if}></div>
</div>
+ <div class="glm-reg-row glm-reg-bill-field">
+ <p class="glm-reg-required">Please provide your E-Mail address. Without this we will be unable to contact you reqarding updates to this registration request.</p>
+ </div>
+ <div class="glm-reg-row glm-reg-bill-field">
+ <div class="glm-reg-checkout-field-label glm-small-12 glm-large-3 glm-columns glm-reg-nowrap{if $regAccount.fieldRequired.email} glm-reg-required{/if}">E-Mail Address{if $regAccount.fieldRequired.email} *{/if}</div>
+ <div class="glm-reg-checkout-field-data glm-small-12 glm-large-9 glm-columns{if $regAccount.fieldFail.email} glm-reg-fail{/if}"><input type="text" name="email" value="{$regAccount.fieldData.email}"{if $regAccount.fieldRequired.email} required{/if}></div>
+ </div>
+
</div>
</div>
<div class="glm-small-12 glm-large-6 glm-columns glm-reg-cart-summary">
<div class="glm-row">
<div class="glm-large-6 glm-small-12 glm-columns">
<h4>Payment Information</h4>
- <div style="white-space: nowrap;">
+ <div id="payMethodSelectors" data-paymethod="" style="white-space: nowrap;">
{foreach $payMethods as $payMethod}
{$pmName = array_search($payMethod.value, $payMethodsNumb)}
- {$pmNumb = $payMethodsNumb.{$pmName}}
+ {$pmNumb = $payMethodsNumb.{$pmName}} {$pmNumb}
<input id="payMethodButton_{$pmNumb}" type="radio" name="payMethod" value="{$pmNumb}" class="payMethodSelector"{if $defaultPayMethod==$pmNumb} checked="checked"{/if}> {$payMethods.{$pmNumb}.name}
{/foreach}
</div>
<script type="text/javascript">
jQuery(function($){
+ var payMethodNumb = false;
+
// When payment method selection changes
$('.payMethodSelector').on('change', function() {
// Get the value from the selected Payment Method
- var payMethodNumb = $(this).val();
+ payMethodNumb = $(this).val();
payMethodSelection(payMethodNumb);
});
// Start with all payment method sections hidden
$('.payMethodInput').attr('disabled', true);
- payMethodSelection({$defaultPayMethod});
+ // Get currently checked payment method - works after browser back button - Should never be needed, but just in case
+ var payMethodNumb = $("input[name='payMethod']:checked").val()
+ if (payMethodNumb == '') {
+ payMethodNumb = {$defaultPayMethod}+0;
+ }
+
+ payMethodSelection(payMethodNumb);
});