Changed "Payment Codes" to "Comp Codes". Completed integration of Global and Event...
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 12 Jan 2018 17:14:59 +0000 (12:14 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 12 Jan 2018 17:14:59 +0000 (12:14 -0500)
classes/data/dataRegRequestPayCode.php
classes/regCartSupport.php
views/admin/management/regterms.html
views/admin/registrations/eventHeader.html
views/admin/registrations/eventPaymentCodes.html
views/admin/registrations/eventSubTabs.html
views/admin/settings/registrationsPaymentCode.html
views/front/registrations/cart.html
views/front/registrations/cartSummary.html

index 3429ee8..7071beb 100644 (file)
@@ -270,7 +270,7 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract
 
                 // Check if payment code has expired
                 if ($payCode['expire_date']['timestamp'] < time()) {
-                    $messages[] = 'Payment code "'.$payCode['code'].'" is past expiration date and no longer accepted.';
+                    $messages[] = 'Comp Code "'.$payCode['code'].'" is past expiration date and no longer accepted.';
                 } else {
 
                     // Check if the payment code has not yet been added
@@ -293,11 +293,11 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract
                             )
                             );
                     } else {
-                        $messages[] = 'Payment code "'.$newCode.'" has already been added.';
+                        $messages[] = 'Comp Code "'.$newCode.'" has already been added.';
                     }
                 }
             } else {
-                $messages[] = 'Payment code "'.$newCode.'" is not valid.';
+                $messages[] = 'Comp Code "'.$newCode.'" is not valid.';
             }
         }
 
@@ -315,7 +315,7 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract
 
             // If there's a code saved that matches the delete code, drop it
             if ($delCode > 0 && isset($regPayCodes[$delCode])) {
-                $messages[] = 'Payment code "'.$regPayCodes[$delCode]['code'].'" has been removed.';
+                $messages[] = 'Comp Code "'.$regPayCodes[$delCode]['code'].'" has been removed.';
                 unset($regPayCodes[$delCode]);
                 $this->deleteEntry($delCode, true);
             }
@@ -335,7 +335,7 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract
 
         // If any were expired, add a message
         if ($expired != '') {
-            $messages[] = 'These payment codes have expired and have been removed from your cart: '.$expired;
+            $messages[] = 'These Comp Codes have expired and have been removed from your cart: '.$expired;
         }
 
         return array(
index 5a6a44c..1bfad46 100644 (file)
@@ -695,9 +695,14 @@ class GlmRegCartSupport
                             }
                         }
 
+                        // Make sure discounts don't exceed charges
+                        if ($eventDiscounts > $eventCharges) {
+                            $eventDiscounts = $eventCharges;
+                        }
+
                         // Save totals for this event
                         $this->cart['events'][$eventKey]['eventRegistrants']    = $eventRegistrants;
-                        $this->cart['events'][$eventKey]['eventCharges']        = $eventCharges;
+                        $this->cart['events'][$eventKey]['eventCharges']        = $eventCharges - $eventDiscounts;
                         $this->cart['events'][$eventKey]['eventDiscounts']      = $eventDiscounts;
 
                         // Add totals to request
@@ -749,6 +754,11 @@ class GlmRegCartSupport
 
         $this->cart['haveEvents'] = $haveEvents;
 
+        // Make sure discounts don't exceed charges
+        if ($totalDiscounts > $totalCharges) {
+            $totalDiscounts = $totalCharges;
+        }
+
         // Save totals for this request
         $this->cart['totalRegistrants'] = $totalRegistrants;
         $this->cart['totalCharges']     = $totalCharges;
index 5ed9736..5d98255 100644 (file)
                         </td>
                     </tr>
                     <tr>
-                        <th>Payment Code:</th>
+                        <th>Comp Code:</th>
                         <td>
                             <table class="glm-admin-table">
                                 <tr>
index 781440c..6456af5 100644 (file)
@@ -3,6 +3,6 @@
 <h2 class="nav-tab-wrapper">
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events" class="nav-tab{if $option==dashboard} nav-tab-active{/if}">Dashboard</a>
     <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventDashboard" class="nav-tab{if $option==eventDashboard} nav-tab-active{/if}">Dashboard For Last Selected Event</a>
-    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=globalCodes" class="nav-tab{if $option==globalCodes} nav-tab-active{/if}">Global Payment Codes</a>
+    <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=globalCodes" class="nav-tab{if $option==globalCodes} nav-tab-active{/if}">Global Comp Codes</a>
 </h2>
 <div id="glm-admin-content-container">
index 8079d57..ea1814d 100644 (file)
@@ -5,9 +5,9 @@
 
 <div>
 {if $option == 'globalCodes'}
-    <h1>Global Payment Codes</h1>
+    <h1>Global Comp Codes</h1>
 {else}
-    <h1>Event Payment Codes</h1>
+    <h1>Event Comp Codes</h1>
 {/if}
 </div>
 <div>&nbsp;</div>
@@ -15,7 +15,7 @@
 <table class="glm-admin-table glm-settings-table" style="width: 99%;">
     <tr><td colspan="2">
         <!-- Add Registration Payment Code Button and Dialog Box -->
-        <div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Payment Code" stye="">
+        <div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Comp Code" stye="">
             <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
 {if $option == 'globalCodes'}
                 <input type="hidden" name="option" value="globalCodes">
@@ -25,7 +25,7 @@
                 <input type="hidden" name="option2" value="new">
                 <table class="glm-admin-table">
                     <tr>
-                        <th class="glm-required">Payment Code:</th>
+                        <th class="glm-required">Comp Code:</th>
                         <td>
                             <input id="code" data-id="code" type="text" name="code" class="glm-form-text-input">
                         </td>
@@ -41,7 +41,7 @@
                         </td>
                     </tr>
                     <tr>
-                        <th class="glm-required">Payment Code Type:</th>
+                        <th class="glm-required">Comp Code Type:</th>
                         <td>
                             <select id="default-code-type" data-id="code_type" name="code_type">
                                 <option value=""></option>
                 </table>
                 <p><span class="glm-required">*</span> Required</p>
                 <a id="newPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
-                <input type="submit" value="Add new Payment Code" class="button button-primary">
+                <input type="submit" value="Add new Comp Code" class="button button-primary">
 
             </form>
         </div>
 
         <!-- Delete Registration Payment Code Button -->
-        <div id="deletePaymentCodeDialog" class="glm-dialog-box" title="Delete Payment Code">
+        <div id="deletePaymentCodeDialog" class="glm-dialog-box" title="Delete Comp Code">
             <center>
-                <p>Are you sure you want to delete this Payment Code?</p>
-                <p><div id="deletePaymentCodeConfirm" class="button button-primary">Yes, delete this Payment Code</div></p>
+                <p>Are you sure you want to delete this Comp Code?</p>
+                <p><div id="deletePaymentCodeConfirm" class="button button-primary">Yes, delete this Comp Code</div></p>
                 <p><div id="deletePaymentCodeCancel" class="button button-primary">Cancel</div></p>
             </center>
         </div>
 
         <!-- Edit Registration Payment Code Dialog Box -->
-        <div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Payment Code">
+        <div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Comp Code">
             <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
 {if $option == 'globalCodes'}
                 <input type="hidden" name="option" value="globalCodes">
                 <!-- This is only temporary until we reinstate the "Used With" selection below -->
                 <table class="glm-admin-table">
                       <tr>
-                        <th class="glm-required">Payment Code:</th>
+                        <th class="glm-required">Comp Code:</th>
                         <td>
                             <input type="hidden" value="{$eventPaycodeType}" name="ref_type">
                             <input id="edit-code" data-id="code" type="text" name="code" class="glm-form-text-input">
                         </td>
                     </tr>
                     <tr>
-                        <th class="glm-required">Payment Code Type:</th>
+                        <th class="glm-required">Comp Code Type:</th>
                         <td>
                             <select id="edit-code-type" data-id="code_type" name="code_type">
                                 <option value=""></option>
                 </table>
                 <p><span class="glm-required">*</span> Required</p>
                 <a id="editPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
-                <input type="submit" value="Update this Payment Code">
+                <input type="submit" value="Update this Comp Code">
 
             </form>
         </div>
         <table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 99%;">
             <thead>
                 <tr>
-                    <th> Payment Code</th>
+                    <th> Comp Code</th>
                     <th> Type </th>
                     <th> Amount </th>
                     <th> Expire Date </th>
                 <tr><td colspan="6">&nbsp;</td></tr>
                 <tr>
 {if $option == 'globalCodes'}
-                    <th colspan="5"><h3>Payment codes that apply to any event</h3></th>
-                    <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Global Payment Code</a></td>
+                    <th colspan="5"><h3>Comp Codes that apply to any event</h3></th>
+                    <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Global Comp Code</a></td>
 {else}
-                    <th colspan="5"><h3>Payment codes that apply to any registrations for this event</h3></th>
-                    <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Event Payment Code</a></td>
+                    <th colspan="5"><h3>Comp Codes that apply to any registrations for this event</h3></th>
+                    <td><a id="newPaymentCodeButton" class="button button-primary glm-button glm-right" onClick="return;">Add Event Comp Code</a></td>
 {/if}
                 </tr>
             {if $havePayCodes}
                         </tr>
                 {/foreach}
             {else}
-                <tr class="alternate"><td colspan="2">(no payment codes listed)</td></tr>
+                <tr class="alternate"><td colspan="2">(no comp] codes listed)</td></tr>
             {/if}
             </tbody>
         </table>
index 9a36e8a..8d4268c 100644 (file)
@@ -14,7 +14,7 @@
         <a {if $option=="eventCustomFields"}onClick="return false;" class="nav-tab nav-tab-active"{else}href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=eventCustomFields&regEventID={$regEventID}" class="nav-tab"{/if}>Additional Fields</a>
 {/if}
         <a {if $option=="notifications" || $option=="notificationsUpdate"}onClick="return false;" class="nav-tab nav-tab-active"{else}href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=notifications&regEventID={$regEventID}" class="nav-tab"{/if}>Attendee Notification</a>
-        <a {if $option=="paymentCodes"}onClick="return false;" class="nav-tab nav-tab-active"{else}href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=paymentCodes&regEventID={$regEventID}" class="nav-tab"{/if}>Payment Codes</a>
+        <a {if $option=="paymentCodes"}onClick="return false;" class="nav-tab nav-tab-active"{else}href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=paymentCodes&regEventID={$regEventID}" class="nav-tab"{/if}>Comp Codes</a>
         <!-- <a {if $option=="registrants"}onClick="return false;" class="nav&#45;tab nav&#45;tab&#45;active"{else}href="{$thisUrl}?page=glm&#45;members&#45;admin&#45;menu&#45;registrations&#45;events&#38;option=registrants&#38;regEventID={$regEventID}" class="nav&#45;tab"{/if}>{$terms.reg_term_attendee_plur_cap}</a> -->
         <a href="{$thisUrl}?page=glm-members-admin-menu-registrations-events&option=registrants&regEventID={$regEventID}" class="nav-tab{if $option=='registrants'} nav-tab-active{/if}">{$terms.reg_term_attendee_plur_cap}</a>
     </h2>
index d0900ea..fed1b39 100644 (file)
@@ -8,8 +8,8 @@
 <table class="glm-admin-table glm-settings-table" style="width: 90%;">
     <tr><td colspan="2">
         <!-- Add Registration Payment Code Button and Dialog Box -->
-        <div id="newPaymentCodeButton" class="button button-primary glm-right">Add Payment Code</div>
-        <div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Payment Code">
+        <div id="newPaymentCodeButton" class="button button-primary glm-right">Add Comp Code</div>
+        <div id="newPaymentCodeDialog" class="glm-dialog-box" title="Enter a New Comp Code">
             <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
                 <input type="hidden" name="glm_action" value="registrationsPaymentCode">
                 <input type="hidden" name="option" value="addNew">
@@ -17,7 +17,7 @@
                 <!-- This is only temporary until we reinstate the "Used With" selection below -->
                 <table class="glm-admin-table">
                     <tr>
-                        <th class="glm-required">Payment Code:</th>
+                        <th class="glm-required">Comp Code:</th>
                         <td>
                             <input id="code" data-id="code" type="text" name="code" class="glm-form-text-input">
                         </td>
@@ -29,7 +29,7 @@
                         </td>
                     </tr>
                     <tr>
-                        <th>Payment Code Type:</th>
+                        <th>Comp Code Type:</th>
                         <td>
                             <select id="default-code-type" data-id="code_type" name="code_type">
                                 <option value=""></option>
                 </table>
                 <p><span class="glm-required">*</span> Required</p>
                 <a id="newPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
-                <input type="submit" value="Add new Payment Code" class="button button-primary">
+                <input type="submit" value="Add new Comp Code" class="button button-primary">
 
             </form>
         </div>
 
         <!-- Delete Registration Payment Code Button -->
-        <div id="deletePaymentCodeDialog" class="glm-dialog-box" title="Delete Payment Code">
+        <div id="deletePaymentCodeDialog" class="glm-dialog-box" title="Delete Comp Code">
             <center>
-                <p>Are you sure you want to delete this Payment Code?</p>
-                <p><div id="deletePaymentCodeConfirm" class="button button-primary">Yes, delete this Payment Code</div></p>
+                <p>Are you sure you want to delete this Comp Code?</p>
+                <p><div id="deletePaymentCodeConfirm" class="button button-primary">Yes, delete this Comp Code</div></p>
                 <p><div id="deletePaymentCodeCancel" class="button button-primary">Cancel</div></p>
             </center>
         </div>
 
         <!-- Edit Registration Payment Code Dialog Box -->
-        <div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Payment Code">
+        <div id="editPaymentCodeDialog" class="glm-dialog-box" title="Edit this Comp Code">
             <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
                 <input type="hidden" name="glm_action" value="registrationsPaymentCode">
                 <input type="hidden" name="option" value="update">
@@ -80,7 +80,7 @@
                 <!-- This is only temporary until we reinstate the "Used With" selection below -->
                 <table class="glm-admin-table">
                       <tr>
-                        <th class="glm-required">Payment Code:</th>
+                        <th class="glm-required">Comp Code:</th>
                         <td>
                             <input id="edit-code" data-id="code" type="text" name="code" class="glm-form-text-input">
                         </td>
@@ -92,7 +92,7 @@
                         </td>
                     </tr>
                     <tr>
-                        <th>Payment Code Type:</th>
+                        <th>Comp Code Type:</th>
                         <td>
                             <select id="edit-code-type" data-id="code_type" name="code_type">
                                 <option value=""></option>
                 </table>
                 <p><span class="glm-required">*</span> Required</p>
                 <a id="editPaymentCodeCancel" class="button button-primary glm-right">Cancel</a>
-                <input type="submit" value="Update this Payment Code">
+                <input type="submit" value="Update this Comp Code">
 
             </form>
         </div>
 
 
-        <h2 style="clear:both;">Registration Payment Codes</h2>
+        <h2 style="clear:both;">Registration Comp Codes</h2>
 
         <table class="wp-list-table wideFat fixed posts glm-admin-table" style="width: 90%;">
             <thead>
                 <tr>
                     <th> Amount </th>
                     <th> Description </th>
-                    <th> Payment Code</th>
-                    <th> Payment Code Type </th>
+                    <th> Comp Code</th>
+                    <th> Comp Code Type </th>
                     <th>&nbsp;</th>
                 </tr>
             </thead>
                         </tr>
                 {/foreach}
             {else}
-                <tr class="alternate"><td colspan="2">(no payment codes listed)</td></tr>
+                <tr class="alternate"><td colspan="2">(no comp] codes listed)</td></tr>
             {/if}
             </tbody>
         </table>
index 67eb67f..6bcc687 100644 (file)
 
     <div class="glm-row" style="white-space: nowrap; line-height: 1rem;">
         <form href="{$regUrl}?page=cart" method="post">
-            If you have a "payment Code", please enter it here: 
+            If you have a "Comp Code", please enter it here: 
             <input type="text" name="regPaymentCode" style="width: 10rem; display: inline;">
-            <input type="submit" class="button button-secondary glm-button" style="font-size: .8rem;" name="applyPaymentCode" value="Apply Payment Code">
+            <input type="submit" class="button button-secondary glm-button" style="font-size: .8rem;" name="applyPaymentCode" value="Apply Comp Code">
         </form>
         {assign var="codeSep" value=""}
         {if $cart.payCodes}
-            <p><b>Accepted Payment Codes:</b>
+            <p><b>Accepted Comp Codes:</b>
                 &nbsp;&nbsp;
                 {foreach $cart.payCodes as $code}{$codeSep}{$code.code}<a class="dashicons dashicons-trash" href="{$regUrl}?page=cart&deletePayCode={$code.id}"></a>{assign var="codeSep" value=", "}{/foreach}
             </p>
index c83f19f..deb175b 100644 (file)
@@ -56,7 +56,7 @@
    {/if}
    
    {foreach $rate.registrants as $registrant}
-   <div class="glm-reg-cart-registrant-item">
+        <div class="glm-reg-cart-registrant-item">
             <div class="row glm-reg-cart-registrant">
                 <div class="{$summaryColumnsItem} column glm-reg-cart-item">
                     <span class="glm-reg-label glm-reg-cart-data">{$terms.reg_term_attendee_cap}: </span><span class="glm-reg-front glm-reg-cart-data glm-reg-cart-data-value">{$registrant.fname} {$registrant.lname}</span>
                 </div>
             </div>
     {/if}
-       </div> 
+        </div> 
    {/foreach} {* registrants *} 
    
   {/foreach} {* rates *}
   {if $summaryType !== 'adminRequest'}
-    <hr class="glm-reg-class-separator">
+        <hr class="glm-reg-class-separator">
   {/if}
  {/foreach} {* classes *}
  {if $event}
    {/foreach}
  {/if}
  {if $event.eventDiscounts > 0}
+ <!-- 
             <div class="row glm-reg-cart-event-discount">
                 <div class="small-8 medium-8 column glm-reg-right glm-reg-cart-label">
                     Event Discounts
                      ${$event.eventDiscounts|number_format:2}
                 </div>
             </div>
+ -->            
  {/if}
             <div class="row glm-reg-row-bold glm-reg-cart-event-registrants">
                 <div class="small-12 column glm-reg-right glm-reg-cart-data glm-reg-cart-subtotal">
   {/foreach}
 {/if}
 {if $cart.totalDiscounts > 0}
+<!-- 
         <div class="row glm-reg-cart-total-discounts">
             <div class="small-12 medium-8 column glm-reg-right glm-reg-cart-label">
                 Total Discounts
                 ${$cart.totalDiscounts|number_format:2}
             </div>
         </div>
+ -->        
 {/if}
         <div class="row glm-reg-row-bold glm-reg-cart-summary-footer">
             <div class="small-12 medium-8 column text-center glm-reg-cart-total-attendees">