From 56f38c371154f9dcfec58736b0b70e65faff03d9 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Fri, 12 Jan 2018 12:14:59 -0500 Subject: [PATCH] Changed "Payment Codes" to "Comp Codes". Completed integration of Global and Event Comp Codes --- classes/data/dataRegRequestPayCode.php | 10 ++--- classes/regCartSupport.php | 12 +++++- views/admin/management/regterms.html | 2 +- views/admin/registrations/eventHeader.html | 2 +- .../registrations/eventPaymentCodes.html | 38 +++++++++---------- views/admin/registrations/eventSubTabs.html | 2 +- .../settings/registrationsPaymentCode.html | 32 ++++++++-------- views/front/registrations/cart.html | 6 +-- views/front/registrations/cartSummary.html | 10 +++-- 9 files changed, 64 insertions(+), 50 deletions(-) diff --git a/classes/data/dataRegRequestPayCode.php b/classes/data/dataRegRequestPayCode.php index 3429ee8..7071beb 100644 --- a/classes/data/dataRegRequestPayCode.php +++ b/classes/data/dataRegRequestPayCode.php @@ -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( diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 5a6a44c..1bfad46 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -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; diff --git a/views/admin/management/regterms.html b/views/admin/management/regterms.html index 5ed9736..5d98255 100644 --- a/views/admin/management/regterms.html +++ b/views/admin/management/regterms.html @@ -278,7 +278,7 @@ - Payment Code: + Comp Code: diff --git a/views/admin/registrations/eventHeader.html b/views/admin/registrations/eventHeader.html index 781440c..6456af5 100644 --- a/views/admin/registrations/eventHeader.html +++ b/views/admin/registrations/eventHeader.html @@ -3,6 +3,6 @@
diff --git a/views/admin/registrations/eventPaymentCodes.html b/views/admin/registrations/eventPaymentCodes.html index 8079d57..ea1814d 100644 --- a/views/admin/registrations/eventPaymentCodes.html +++ b/views/admin/registrations/eventPaymentCodes.html @@ -5,9 +5,9 @@
{if $option == 'globalCodes'} -

Global Payment Codes

+

Global Comp Codes

{else} -

Event Payment Codes

+

Event Comp Codes

{/if}
 
@@ -15,7 +15,7 @@
-
+
{if $option == 'globalCodes'} @@ -25,7 +25,7 @@ - + @@ -41,7 +41,7 @@ - +
Payment Code:Comp Code:
Payment Code Type:Comp Code Type:

* Required

Cancel - +
-
+
-

Are you sure you want to delete this Payment Code?

-

Yes, delete this Payment Code

+

Are you sure you want to delete this Comp Code?

+

Yes, delete this Comp Code

Cancel

-
+
{if $option == 'globalCodes'} @@ -102,14 +102,14 @@ - + - +
Payment Code:Comp Code:
Payment Code Type:Comp Code Type:

* Required

Cancel - +
@@ -150,7 +150,7 @@ - + @@ -162,11 +162,11 @@ {if $option == 'globalCodes'} - - + + {else} - - + + {/if} {if $havePayCodes} @@ -195,7 +195,7 @@ {/foreach} {else} - + {/if}
Payment Code Comp Code Type Amount Expire Date
 

Payment codes that apply to any event

Add Global Payment Code

Comp Codes that apply to any event

Add Global Comp Code

Payment codes that apply to any registrations for this event

Add Event Payment Code

Comp Codes that apply to any registrations for this event

Add Event Comp Code
(no payment codes listed)
(no comp] codes listed)
diff --git a/views/admin/registrations/eventSubTabs.html b/views/admin/registrations/eventSubTabs.html index 9a36e8a..8d4268c 100644 --- a/views/admin/registrations/eventSubTabs.html +++ b/views/admin/registrations/eventSubTabs.html @@ -14,7 +14,7 @@ Additional Fields {/if} Attendee Notification - Payment Codes + Comp Codes {$terms.reg_term_attendee_plur_cap} diff --git a/views/admin/settings/registrationsPaymentCode.html b/views/admin/settings/registrationsPaymentCode.html index d0900ea..fed1b39 100644 --- a/views/admin/settings/registrationsPaymentCode.html +++ b/views/admin/settings/registrationsPaymentCode.html @@ -8,8 +8,8 @@
-
Add Payment Code
-
+
Add Comp Code
+
@@ -17,7 +17,7 @@ - + @@ -29,7 +29,7 @@ - +
Payment Code:Comp Code:
Payment Code Type:Comp Code Type:

* Required

Cancel - +
-
+
-

Are you sure you want to delete this Payment Code?

-

Yes, delete this Payment Code

+

Are you sure you want to delete this Comp Code?

+

Yes, delete this Comp Code

Cancel

-
+
@@ -80,7 +80,7 @@ - + @@ -92,7 +92,7 @@ - +
Payment Code:Comp Code:
Payment Code Type:Comp Code Type:

* Required

Cancel - +
-

Registration Payment Codes

+

Registration Comp Codes

- - + + @@ -169,7 +169,7 @@ {/foreach} {else} - + {/if}
Amount Description Payment Code Payment Code Type Comp Code Comp Code Type  
(no payment codes listed)
(no comp] codes listed)
diff --git a/views/front/registrations/cart.html b/views/front/registrations/cart.html index 67eb67f..6bcc687 100644 --- a/views/front/registrations/cart.html +++ b/views/front/registrations/cart.html @@ -45,13 +45,13 @@
- If you have a "payment Code", please enter it here: + If you have a "Comp Code", please enter it here: - +
{assign var="codeSep" value=""} {if $cart.payCodes} -

Accepted Payment Codes: +

Accepted Comp Codes:    {foreach $cart.payCodes as $code}{$codeSep}{$code.code}{assign var="codeSep" value=", "}{/foreach}

diff --git a/views/front/registrations/cartSummary.html b/views/front/registrations/cartSummary.html index c83f19f..deb175b 100644 --- a/views/front/registrations/cartSummary.html +++ b/views/front/registrations/cartSummary.html @@ -56,7 +56,7 @@ {/if} {foreach $rate.registrants as $registrant} -
+
{$terms.reg_term_attendee_cap}: {$registrant.fname} {$registrant.lname} @@ -103,12 +103,12 @@
{/if} -
+
{/foreach} {* registrants *} {/foreach} {* rates *} {if $summaryType !== 'adminRequest'} -
+
{/if} {/foreach} {* classes *} {if $event} @@ -127,6 +127,7 @@ {/foreach} {/if} {if $event.eventDiscounts > 0} + {/if}
@@ -164,6 +166,7 @@ {/foreach} {/if} {if $cart.totalDiscounts > 0} + {/if}