From 27c460b877fe3b4980ad5113ab5f07e6500c5ebf Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:39:14 -0500 Subject: [PATCH 1/3] added check for event closed on cancel page --- .../default/classes/SummitEventsCancelReviewController.cls | 4 ++++ force-app/main/default/pages/SummitEventsCancelReview.page | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/force-app/main/default/classes/SummitEventsCancelReviewController.cls b/force-app/main/default/classes/SummitEventsCancelReviewController.cls index e76ef119..68323be1 100644 --- a/force-app/main/default/classes/SummitEventsCancelReviewController.cls +++ b/force-app/main/default/classes/SummitEventsCancelReviewController.cls @@ -110,4 +110,8 @@ public with sharing class SummitEventsCancelReviewController { } + public PageReference checkEventDetails() { + return SummitEventsShared.checkForEvent('cancel'); + } + } \ No newline at end of file diff --git a/force-app/main/default/pages/SummitEventsCancelReview.page b/force-app/main/default/pages/SummitEventsCancelReview.page index a16e6a2a..028b6633 100644 --- a/force-app/main/default/pages/SummitEventsCancelReview.page +++ b/force-app/main/default/pages/SummitEventsCancelReview.page @@ -5,7 +5,7 @@ license that can be found in the LICENSE file. Created by Thaddaeus Dahlberg on 5/1/2018. --> - + {!evtInstance.Event__r.Event_Name__c} From 696b34141c09ad2d93e653d1244a38e13700e5b3 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:07:00 -0500 Subject: [PATCH 2/3] When default values are given for add questions and visible they are set now. especially picklists --- .../classes/SummitEventsAdditionalQuestionsCtlr.cls | 13 ++++++++++++- .../SummitEventsAssets/js/guestRegistration.js | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/force-app/main/default/classes/SummitEventsAdditionalQuestionsCtlr.cls b/force-app/main/default/classes/SummitEventsAdditionalQuestionsCtlr.cls index 7520826a..a75ee0c1 100644 --- a/force-app/main/default/classes/SummitEventsAdditionalQuestionsCtlr.cls +++ b/force-app/main/default/classes/SummitEventsAdditionalQuestionsCtlr.cls @@ -58,6 +58,7 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr { eventInformation = SummitEventsShared.getSummitEventsInfo(); questionWrapper = new List(); Map hiddenValues = new Map(); + Map defaultValues = new Map(); //eventInformation is an object gathered from the encrypted client cookie that contains event id and instance ids without which thou shall not pass if (String.isNotBlank(eventInformation.eventId) && String.isNotBlank(eventInformation.instanceId)) { @@ -299,8 +300,11 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr { //add question to question wrapper if it is visible, otherwise apply default value to the event registration. if (question.Is_Visible__c) { questionWrapper.add(quest); - } else { if (String.isNotBlank(question.Default_Value__c)) { + defaultValues.put(mapToField, question.Default_Value__c); + } + } else { + if (String.isNotBlank(question.Default_Value__c) && question.Question_Field_Type__c != 'Picklist') { hiddenValues.put(mapToField, question.Default_Value__c); } } @@ -334,6 +338,13 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr { eventRegistration.put(key, hiddenValues.get(key)); } + //Apply default values if registration value is not blank + for (String key : defaultValues.keySet()) { + if (String.isBlank((String) eventRegistration.get(key))) { + eventRegistration.put(key, defaultValues.get(key)); + } + } + //Get the holding values if there are any for (String key : lookUpDisplayValue.keySet()) { String lookupField = key.trim(); diff --git a/force-app/main/default/staticresources/SummitEventsAssets/js/guestRegistration.js b/force-app/main/default/staticresources/SummitEventsAssets/js/guestRegistration.js index b31c33c8..82c2a4e6 100644 --- a/force-app/main/default/staticresources/SummitEventsAssets/js/guestRegistration.js +++ b/force-app/main/default/staticresources/SummitEventsAssets/js/guestRegistration.js @@ -290,6 +290,9 @@ function buildPicklist(question) { let selectOption = document.createElement('option'); selectOption.text = opt; selectOption.value = options[opt]; + if(question.defaultValue === options[opt]){ + selectOption.selected = true; + } picklist.add(selectOption); } } From 733893dfff18d48f7794104c68e9a7a7d47069d3 Mon Sep 17 00:00:00 2001 From: Thaddaeus Dahlberg <16785863+tcdahlberg@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:57:57 -0500 Subject: [PATCH 3/3] fixed cancel link page issues --- .../SummitEventsCancelReviewController.cls | 43 +++-- .../pages/SummitEventsCancelReview.page | 161 +++++++++++------- 2 files changed, 116 insertions(+), 88 deletions(-) diff --git a/force-app/main/default/classes/SummitEventsCancelReviewController.cls b/force-app/main/default/classes/SummitEventsCancelReviewController.cls index 68323be1..dceaf93c 100644 --- a/force-app/main/default/classes/SummitEventsCancelReviewController.cls +++ b/force-app/main/default/classes/SummitEventsCancelReviewController.cls @@ -5,10 +5,11 @@ public with sharing class SummitEventsCancelReviewController { public Summit_Events_Registration__c eventRegistration { get; set; } + public Summit_Events__c eventPage { get; set; } public SummitEventsInfo eventInformation { get; set; } public List appointments { get; set; } public String templateSelected { get; set; } - public Boolean eventOver { get; set; } + public Boolean eventIsClosed { get; set; } public Boolean eventNotFound { get; set; } public String formattedNavDate { get; set; } public String eventParameter { get; set; } @@ -17,7 +18,9 @@ public with sharing class SummitEventsCancelReviewController { public SummitEventsCancelReviewController() { eventParameter = ApexPages.currentPage().getParameters().get('eventInfo'); eventNotFound = true; - eventOver = false; + eventIsClosed = false; + eventRegistration = new Summit_Events_Registration__c(); + templateSelected = SummitEventsShared.getTemplate(''); if (!String.isBlank(eventParameter)) { String decryptedParameter = SummitEventsShared.decryptString(eventParameter, false); @@ -30,24 +33,14 @@ public with sharing class SummitEventsCancelReviewController { if (String.isNotBlank(eventInformation.registrationId)) { eventRegistration = [ - SELECT Id, Status__c, Name, Event__r.Name, Event_Instance__c, Event__r.Event_Name__c, Event__r.Event_description__c, - Event__r.Event_Footer__c, Event__r.Event_Cancel_Review_Title__c, Event_Name__c, Event_Instance__r.Instance_Title__c, - Event__r.Event_Cancel_Review_Description__c, Event__r.Event_Cancelled_Notification_Text__c, - Event__r.Template__c, Event__r.Event_Home_Link_Title__c, Event__r.Event_Home_Link_URL__c, - Event_Instance__r.Instance_Start_Date__c, Event_Instance__r.Instance_Start_Time__c, - Event_Instance__r.Instance_End_Date__c, Event_Instance__r.Instance_End_Time__c, Event_Instance__r.Instance_Time_Zone__c, - Event__r.Tracking_Cancel_Registration__c, Event__r.Account__r.Name, Event__r.Audience__c, - Event__r.Filter_Category__c, Event__r.Event_Sponsor__c + SELECT Id, Status__c, Name, Event_Instance__c, Event_Name__c, Event_Instance__r.Instance_Title__c, Event__c FROM Summit_Events_Registration__c WHERE Id = :eventInformation.registrationId WITH SECURITY_ENFORCED ]; - if (eventRegistration != null) { - templateSelected = SummitEventsShared.getTemplate(eventRegistration.Event__r.Template__c); - appointments = [ SELECT Id, Appointment_Title__c, Appointment_Category__c, Appointment_Type__c FROM Summit_Events_Appointments__c @@ -56,20 +49,30 @@ public with sharing class SummitEventsCancelReviewController { ]; eventInstance = [ - SELECT Id, Event__r.Event_Name__c, Instance_Title__c, - Instance_Start_Date__c, Instance_End_Date__c, Instance_Start_Time__c, Instance_End_Time__c, Instance_Time_Zone__c + SELECT Id, Instance_Title__c, Instance_Start_Date__c, Instance_End_Date__c, Instance_Start_Time__c, Instance_End_Time__c, Instance_Time_Zone__c, + Registration_Close_Date__c, Current_Available_Capacity__c, Active_Status__c FROM Summit_Events_Instance__c W WHERE Id = :eventRegistration.Event_Instance__c WITH SECURITY_ENFORCED ]; - if (SummitEventsShared.convertDateToDatetime(eventRegistration.Event_Instance__r.Instance_End_Date__c, null, '') < SummitEventsShared.adjustForTimeZone(Datetime.now(), eventRegistration.Event_Instance__r.Instance_Time_Zone__c)) { - eventOver = true; - } + eventPage = [ + SELECT Id, Event_Name__c, Event_description__c, Event_Footer__c, Event_Cancel_Review_Title__c, Event_Cancel_Review_Description__c, + Event_Cancelled_Notification_Text__c, Event_Home_Link_Title__c, Event_Home_Link_URL__c, Tracking_Cancel_Registration__c, + Account__r.Name, Audience__c, Filter_Category__c, Event_Sponsor__c, Event_Full_Text__c, Template__c + FROM Summit_Events__c + WHERE Id = :eventRegistration.Event__c + WITH SECURITY_ENFORCED + ]; + + templateSelected = SummitEventsShared.getTemplate(eventPage.Template__c); + + eventIsClosed = SummitEventsShared.isEventClosed(eventInstance); if (eventInstance != null) { formattedNavDate = SummitEventsShared.navBreadcrumbBuilder(eventInstance); } + eventNotFound = false; } } @@ -110,8 +113,4 @@ public with sharing class SummitEventsCancelReviewController { } - public PageReference checkEventDetails() { - return SummitEventsShared.checkForEvent('cancel'); - } - } \ No newline at end of file diff --git a/force-app/main/default/pages/SummitEventsCancelReview.page b/force-app/main/default/pages/SummitEventsCancelReview.page index 028b6633..29289f2c 100644 --- a/force-app/main/default/pages/SummitEventsCancelReview.page +++ b/force-app/main/default/pages/SummitEventsCancelReview.page @@ -5,37 +5,41 @@ license that can be found in the LICENSE file. Created by Thaddaeus Dahlberg on 5/1/2018. --> - + - {!evtInstance.Event__r.Event_Name__c} + {!eventPage.Event_Name__c} - Cancel - {!eventRegistration.Event__r.Event_Home_Link_Title__c} + {!eventPage.Event_Home_Link_Title__c} + -
- -
- -
+
+ +
+ +
+ + + -
+ -
-
-
-

- -

-

- -

-
-
-

- -

-

- -

-
    - -
  • - - -
    - - -
  • -
    -
- -

- -

- -

- -

+ + + +

+ +

+ +

+ {!evtInstance.Instance_Title__c} +

+
+
+

+ +

+
-
- - -

Your registration has been Cancelled

-

The registration record we have on file has been cancelled.

-
- -

No event found

-

The link you followed doesn't contain information to any registration we have on file.

-
- -

Event over

-

We're sorry, the event {!evt.Event_Name__c} {!IF(!ISBLANK(evt.Event_Instance_Title__c), ' - ' + evt.Event_Instance_Title__c, '')} has already occured and your registration can not be cancelled.

-
-
- + + +

Your registration has been Cancelled

+

The registration record we have on file has been cancelled.

+
+ + + +

No event found

+

The link you followed doesn't contain information to any registration we have on file.

+
+ + +
+

+ +

+

+ +

+
+
+

+ +

+ +

+ {!evtInstance.Instance_Title__c} +

+
+

+ +

+
    + +
  • + + +
    + + +
  • +
    +
+ +

+ +

+
+ +

+ +

+
+ +
+
+
+ +
+