Work on issues reported in Meetings with Charis and a Customer
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 12 Apr 2018 14:47:09 +0000 (10:47 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 12 Apr 2018 14:47:09 +0000 (10:47 -0400)
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.

18 files changed:
classes/data/dataPaymentCode.php
classes/data/dataRegEvent.php
classes/regCartSupport.php
css/admin.css
models/admin/registrations/events_globalCodes.php
models/admin/registrations/events_paymentCodes.php
models/front/registrations/checkout.php
models/front/registrations/checkoutProcess.php
models/front/registrations/list.php
views/admin/registrations/eventPaymentCodes.html
views/front/registrations/cart.html
views/front/registrations/checkout.html
views/front/registrations/forgot.html
views/front/registrations/list.html
views/front/registrations/login.html
views/front/registrations/register.html
views/front/registrations/registration.html
views/front/registrations/summary.html

index 297d88d..1110696 100644 (file)
@@ -147,6 +147,7 @@ class GlmDataRegistrationsPaymentCode extends GlmDataAbstract
                 'field' => 'code',
                 'type' => 'text',
                 'required' => true,
+                'unique' => true,
                 'use' => 'a'
             ),
 
index 3203d97..5e0d552 100644 (file)
@@ -165,7 +165,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract
             'notify_email' => array (
                 'field'     => 'notify_email',
                 'type'      => 'text',
-                'required'  => true,
+                'required'  => false,
                 'use'       => 'a'
             ),
 
index 9430fdd..f148314 100644 (file)
@@ -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':
index ec8c9b7..3ad99e3 100644 (file)
@@ -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 */
index 10f1e1d..705c152 100644 (file)
@@ -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':
index f9ebef5..e9347d5 100644 (file)
@@ -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':
index d791acb..168742a 100644 (file)
@@ -141,7 +141,6 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport
 
                 $messages[] = "This request has already been submitted!<br>The information below is a summary of your submitted request.";
 
-echo "<pre>".print_r($this->cart,1)."</pre>";
                 // 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 "<pre>".print_r($this->cart,1)."</pre>";
         $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 "<pre>".print_r($this->cart,1)."</pre>";
         $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 "<pre>".print_r($this->cart,1)."</pre>";
             'eventCustomFieldsFidPrefix'    => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG.'-customfields-reg-event-'
         );
 
-        // echo "<pre>".print_r($templateData,1)."</pre>";
+        // echo "<pre>".print_r($regAccount,1)."</pre>";
 
         // Return status, any suggested view, and any data to controller
         return array(
index 92ea7b7..310de57 100644 (file)
@@ -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']."<P>";
 
         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
index 109948e..db43baf 100644 (file)
             'reg_bulletin'      => $misc['reg_bulletin']
         );
 
-             // Return status, any suggested view, and any data to controller
+        // echo "<pre>".print_r($templateData,1)."</pre>";
+
+        // Return status, any suggested view, and any data to controller
         return array(
             'status'        => true,
             'modelRedirect' => false,
index 973d1e3..3c4cb47 100644 (file)
@@ -3,6 +3,17 @@
     {include file='admin/registrations/eventSubTabs.html'}
 {/if}
 
+{if $option == 'globalCodes' && $haveMessages}
+<div class="glm-error">
+    <h3 class="glm-error">Please note:</h3>
+    <ul>
+  {foreach $messages as $m}
+        <li>{$m}</li>
+  {/foreach}
+    </ul>
+</div>
+{/if}
+
 <div>
 {if $option == 'globalCodes'}
     <h1>Global {$terms.reg_term_payment_code_plur_cap}</h1>
@@ -10,7 +21,8 @@
     <h1>{$terms.reg_term_event_cap} {$terms.reg_term_payment_code_plur_cap}</h1>
 {/if}
 </div>
-<div>&nbsp;</div>
+
+<div>&nbsp;</div>ssss
 
 <table class="glm-admin-table glm-settings-table" style="width: 99%;">
     <tr><td colspan="2">
index a698e55..f24caaf 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 <!--{if $cart.blockCheckout || !$haveCart || !$cart.haveEvents}
     <div>
         <div class="glm-reg-warning">You have not yet submitted your {$terms.reg_term_registration}. See above notes! <img src="{$assetUrl}/fingerUpRed.svg" style="height: 2em;"></div>
index 0b47145..29de7aa 100644 (file)
                 </div>
             </div>
 
-  {if $cart.totalCharges > 0}
+  {if $cart.grandTotal > 0}
               <div class="glm-row">
                   <div class="glm-large-6 glm-small-12 glm-columns">
                       <h4>Payment Information</h4>
index bfc018a..4ccb14e 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 <br>
 <form action="{$regUrl}?page=forgot" method="post">
     <input type="hidden" name="option" value="submit">
index a9788b1..25efacc 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 <div class="row">
         <div class="progress-container columns">
             <ul class="progressbar">
     {/if}
 {if $haveRegEvents}
     {foreach $regEvents as $event}
-        {assign var=first value = $event.times|@key}
-        {assign var=first_date value = $event.times.$first.start_time.timestamp}
-        
-        {* these are not in use  -  !!!Also need to stop using Recurrences here!!!! *} 
-        {* assign var=last value = $event.reg_time|@end *}
-        {* assign var=last_date value = $event.end_datetime *}
-        {* assign var=time_specific value = $event.time_specific.value *}
      
 <!--        <pre>{$event|@print_r}</pre>-->
         <!-- EVENT REG ITEM START -->
index fbdbff5..9d99e42 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 <br>
 <form action="{$regUrl}?page=login" method="post">
     <input type="hidden" name="option" value="submit">
index 954f60e..3aa39ba 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 <br>
 <form action="{$regUrl}?page=register" method="post">
     <input type="hidden" name="option" value="submit">
index d93c75c..549b404 100644 (file)
 <div id="glm-reg-detail">
 
     <h1>{$terms.reg_term_registrations_name}</h1>
-    {apply_filters('glm_members_registrations_header', 'accountHeader')}
+    {apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
     <div class="row progress-row">
         <div class="progress-container columns">
             <ul class="progressbar">
index a447328..b6e7baa 100644 (file)
@@ -1,4 +1,4 @@
-{apply_filters('glm_members_registrations_header', 'accountHeader')}
+{apply_filters('glm_members_registrations_header', 'accountHeader', {$page})}
 
 <div id="checkoutSuccess">
     <div id="checkout-success-title">