From b6a548911a8d1d45315a8a7a853a595aaf398980 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 12 Apr 2018 10:47:09 -0400 Subject: [PATCH] Work on issues reported in Meetings with Charis and a Customer Updated call to glm_members_registrations_header filter to include $page parameter now required. Changed Payment Codes to having to have a Unique Name. Fixed problem with "Free" discount code for events (Global worked fine) in regCardSupport.php. Checkout page now does not display any payment methods if Grand Total is $0.00 for any reason. Checkout processing now sets payment method to "No Charge" if grand total is $0.00 (free) due to discounts. Checkout now checks for any account data it can pre-fill in checkout form. Fixed inability to edit notification subjects. Subject input was laying behind the text editor div. Added name of application to merchant name for E-Mail from Authorize.net at checkout. Fixed errors from smarty parameters that are no longer in use in list.html. --- classes/data/dataPaymentCode.php | 1 + classes/data/dataRegEvent.php | 2 +- classes/regCartSupport.php | 4 +- css/admin.css | 4 +- .../registrations/events_globalCodes.php | 18 +++++++- .../registrations/events_paymentCodes.php | 18 +++++++- models/front/registrations/checkout.php | 44 +++++++++++++++---- .../front/registrations/checkoutProcess.php | 15 ++++--- models/front/registrations/list.php | 4 +- .../registrations/eventPaymentCodes.html | 14 +++++- views/front/registrations/cart.html | 2 +- views/front/registrations/checkout.html | 2 +- views/front/registrations/forgot.html | 2 +- views/front/registrations/list.html | 9 +--- views/front/registrations/login.html | 2 +- views/front/registrations/register.html | 2 +- views/front/registrations/registration.html | 2 +- views/front/registrations/summary.html | 2 +- 18 files changed, 107 insertions(+), 40 deletions(-) diff --git a/classes/data/dataPaymentCode.php b/classes/data/dataPaymentCode.php index 297d88d..1110696 100644 --- a/classes/data/dataPaymentCode.php +++ b/classes/data/dataPaymentCode.php @@ -147,6 +147,7 @@ class GlmDataRegistrationsPaymentCode extends GlmDataAbstract 'field' => 'code', 'type' => 'text', 'required' => true, + 'unique' => true, 'use' => 'a' ), diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 3203d97..5e0d552 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -165,7 +165,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'notify_email' => array ( 'field' => 'notify_email', 'type' => 'text', - 'required' => true, + 'required' => false, 'use' => 'a' ), diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 9430fdd..f148314 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -678,7 +678,7 @@ class GlmRegCartSupport switch ($code['code_type']) { case 'Free': $thisDiscount = $eventCharges; - $eventDiscounts = $totalCharges; + $eventDiscounts += $thisDiscount; // Don't worry, code below will prevent exceeding total of event charges break; case 'Amount': @@ -731,7 +731,7 @@ class GlmRegCartSupport switch ($code['code_type']) { case 'Free': $thisDiscount = $totalCharges; - $totalDiscounts = $totalCharges; + $totalDiscounts += $totalCharges; // Don't worry, code below will prevent exceeding total of event charges break; case 'Amount': diff --git a/css/admin.css b/css/admin.css index ec8c9b7..3ad99e3 100644 --- a/css/admin.css +++ b/css/admin.css @@ -215,7 +215,7 @@ label.registrant-label { padding: 2rem 0 1rem 0; } .glm-reg-message-title { - padding: 0 0 1rem 0; + padding: 1rem 0 1rem 0; } .glm-reg-message-prompt { text-align: right !important; @@ -226,8 +226,6 @@ label.registrant-label { padding-top: 3rem; } .glm-reg-message-body { - position: relative; - top: -2.5rem; } /*}}} End New Register Account */ diff --git a/models/admin/registrations/events_globalCodes.php b/models/admin/registrations/events_globalCodes.php index 10f1e1d..705c152 100644 --- a/models/admin/registrations/events_globalCodes.php +++ b/models/admin/registrations/events_globalCodes.php @@ -20,12 +20,26 @@ if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { switch($_REQUEST['option2']) { case 'new': - $PayCode->insertEntry(); + $res = $PayCode->insertEntry(); + if (!$res['status']) { + foreach ($res['fieldFail'] as $ff) { + if (trim($ff) != '') { + $messages[] = $ff; + } + } + } break; case 'update': $payCodeId = ($_REQUEST['payCodeId'] - 0); - $x = $PayCode->updateEntry($payCodeId); + $res = $PayCode->updateEntry($payCodeId); + if (!$res['status']) { + foreach ($res['fieldFail'] as $ff) { + if (trim($ff) != '') { + $messages[] = $ff; + } + } + } break; case 'delete': diff --git a/models/admin/registrations/events_paymentCodes.php b/models/admin/registrations/events_paymentCodes.php index f9ebef5..e9347d5 100644 --- a/models/admin/registrations/events_paymentCodes.php +++ b/models/admin/registrations/events_paymentCodes.php @@ -20,12 +20,26 @@ if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { switch($_REQUEST['option2']) { case 'new': - $PayCode->insertEntry(); + $res = $PayCode->insertEntry(); + if (!$res['status']) { + foreach ($res['fieldFail'] as $ff) { + if (trim($ff) != '') { + $messages[] = $ff; + } + } + } break; case 'update': $payCodeId = ($_REQUEST['payCodeId'] - 0); - $x = $PayCode->updateEntry($payCodeId); + $res = $PayCode->updateEntry($payCodeId); + if (!$res['status']) { + foreach ($res['fieldFail'] as $ff) { + if (trim($ff) != '') { + $messages[] = $ff; + } + } + } break; case 'delete': diff --git a/models/front/registrations/checkout.php b/models/front/registrations/checkout.php index d791acb..168742a 100644 --- a/models/front/registrations/checkout.php +++ b/models/front/registrations/checkout.php @@ -141,7 +141,6 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport $messages[] = "This request has already been submitted!
The information below is a summary of your submitted request."; -echo "
".print_r($this->cart,1)."
"; // Build check code for display of summary in iframe $summaryCheck = md5($this->cart['request']['id'].GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET.$this->cart['request']['account']); @@ -275,7 +274,41 @@ echo "
".print_r($this->cart,1)."
"; $regAccount['fieldRequired']['comp_code'] = true; $regAccount['fieldFail']['comp_code'] = ''; -// *** If redirected back, be sure to get the submitted data + // Check if there's no billing name/addr + if (trim($regAccount['fieldData']['bill_lname']) == '') { + + // See if we have other name/addr data in account and use that + if (trim($regAccount['fieldData']['lname']) != '') { + $regAccount['fieldData']['bill_fname'] = $regAccount['fieldData']['fname']; + $regAccount['fieldData']['bill_lname'] = $regAccount['fieldData']['lname']; + $regAccount['fieldData']['bill_org'] = $regAccount['fieldData']['org']; + $regAccount['fieldData']['bill_title'] = $regAccount['fieldData']['title']; + $regAccount['fieldData']['bill_addr1'] = $regAccount['fieldData']['addr1']; + $regAccount['fieldData']['bill_addr2'] = $regAccount['fieldData']['addr2']; + $regAccount['fieldData']['bill_city'] = $regAccount['fieldData']['city']; + $regAccount['fieldData']['bill_state'] = $regAccount['fieldData']['state']; + $regAccount['fieldData']['bill_zip'] = $regAccount['fieldData']['zip']; + $regAccount['fieldData']['bill_country'] = $regAccount['fieldData']['country']; + $regAccount['fieldData']['bill_phone'] = $regAccount['fieldData']['phone']; + $regAccount['fieldData']['bill_fax'] = $regAccount['fieldData']['fax']; + + // Otherwise if there's only one registrant, use their info, what's there + } elseif (count($this->cart['accounts']) == 1) { + $acct = current($this->cart['accounts']); + $regAccount['fieldData']['bill_fname'] = $acct['fname']; + $regAccount['fieldData']['bill_lname'] = $acct['lname']; + $regAccount['fieldData']['bill_org'] = $acct['org']; + $regAccount['fieldData']['bill_title'] = $acct['title']; + $regAccount['fieldData']['bill_addr1'] = $acct['addr1']; + $regAccount['fieldData']['bill_addr2'] = $acct['addr2']; + $regAccount['fieldData']['bill_city'] = $acct['city']; + $regAccount['fieldData']['bill_state'] = $acct['state']; + $regAccount['fieldData']['bill_zip'] = $acct['zip']; + $regAccount['fieldData']['bill_country'] = $acct['country']; + $regAccount['fieldData']['bill_phone'] = $acct['phone']; + $regAccount['fieldData']['bill_fax'] = $acct['fax']; + } + } $view = 'checkout'; @@ -321,11 +354,6 @@ echo "
".print_r($this->cart,1)."
"; $Misc = new GlmDataRegistrationsMisc($this->wpdb, $this->config); $misc = $Misc->getEntry(1); - // 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', @@ -349,7 +377,7 @@ echo "
".print_r($this->cart,1)."
"; 'eventCustomFieldsFidPrefix' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG.'-customfields-reg-event-' ); - // echo "
".print_r($templateData,1)."
"; + // echo "
".print_r($regAccount,1)."
"; // Return status, any suggested view, and any data to controller return array( diff --git a/models/front/registrations/checkoutProcess.php b/models/front/registrations/checkoutProcess.php index 92ea7b7..310de57 100644 --- a/models/front/registrations/checkoutProcess.php +++ b/models/front/registrations/checkoutProcess.php @@ -272,19 +272,24 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport * Process any Custom Fields */ - // ******* NEED TO DO THIS ******** +// ******* NEED TO DO THIS ??? ******** /* * Process Payment? */ +echo "Grand Total = ".$this->cart['grandTotal']."

"; require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataManagement.php'; $Management = new GlmDataRegistrationsManagement($this->wpdb, $this->config); $management = $Management->getEntry(1); // Get payment method selected - if (isset($_REQUEST['payMethod'])) { - $payMethod = ($_REQUEST['payMethod'] - 0); + if ($this->cart['grandTotal'] > 0) { + if (isset($_REQUEST['payMethod'])) { + $payMethod = ($_REQUEST['payMethod'] - 0); + } + } else { + $payMethod = $this->config['payment_method_numb']['NoCharge']; } // Add billing information to billing array @@ -474,8 +479,8 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport $payment = array( 'transOpt' => $transOpt, // 0 = charge card, 1 = charge and store, 2 = charge stored card - 'name' => $this->config['settings']['reg_org_name'], // Name of venue - 'charge' => $this->cart['totalCharges'], // Total charges + 'name' => $this->config['settings']['reg_org_name'].' - '.$this->config['terms']['reg_term_registrations_name'], // Name of venue + name of "Registrations". + 'charge' => $this->cart['grandTotal'], // Total charges 'customerProfileId' => $customerProfileId, // Customer profile ID for charging stored card 'paymentProfileId' => $paymentProfileId, // Payment profile ID for charging stored card 'cctype' => $cardData['cc_type'], // Card Type diff --git a/models/front/registrations/list.php b/models/front/registrations/list.php index 109948e..db43baf 100644 --- a/models/front/registrations/list.php +++ b/models/front/registrations/list.php @@ -184,7 +184,9 @@ 'reg_bulletin' => $misc['reg_bulletin'] ); - // Return status, any suggested view, and any data to controller + // echo "

".print_r($templateData,1)."
"; + + // Return status, any suggested view, and any data to controller return array( 'status' => true, 'modelRedirect' => false, diff --git a/views/admin/registrations/eventPaymentCodes.html b/views/admin/registrations/eventPaymentCodes.html index 973d1e3..3c4cb47 100644 --- a/views/admin/registrations/eventPaymentCodes.html +++ b/views/admin/registrations/eventPaymentCodes.html @@ -3,6 +3,17 @@ {include file='admin/registrations/eventSubTabs.html'} {/if} +{if $option == 'globalCodes' && $haveMessages} +
+

Please note:

+ +
+{/if} +
{if $option == 'globalCodes'}

Global {$terms.reg_term_payment_code_plur_cap}

@@ -10,7 +21,8 @@

{$terms.reg_term_event_cap} {$terms.reg_term_payment_code_plur_cap}

{/if}
-
 
+ +
 
ssss
diff --git a/views/front/registrations/cart.html b/views/front/registrations/cart.html index a698e55..f24caaf 100644 --- a/views/front/registrations/cart.html +++ b/views/front/registrations/cart.html @@ -1,4 +1,4 @@ -{apply_filters('glm_members_registrations_header', 'accountHeader')} +{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})} diff --git a/views/front/registrations/login.html b/views/front/registrations/login.html index fbdbff5..9d99e42 100644 --- a/views/front/registrations/login.html +++ b/views/front/registrations/login.html @@ -1,4 +1,4 @@ -{apply_filters('glm_members_registrations_header', 'accountHeader')} +{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
diff --git a/views/front/registrations/register.html b/views/front/registrations/register.html index 954f60e..3aa39ba 100644 --- a/views/front/registrations/register.html +++ b/views/front/registrations/register.html @@ -1,4 +1,4 @@ -{apply_filters('glm_members_registrations_header', 'accountHeader')} +{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index d93c75c..549b404 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -420,7 +420,7 @@

{$terms.reg_term_registrations_name}

- {apply_filters('glm_members_registrations_header', 'accountHeader')} + {apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
    diff --git a/views/front/registrations/summary.html b/views/front/registrations/summary.html index a447328..b6e7baa 100644 --- a/views/front/registrations/summary.html +++ b/views/front/registrations/summary.html @@ -1,4 +1,4 @@ -{apply_filters('glm_members_registrations_header', 'accountHeader')} +{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
    -- 2.17.1