Skip to content

Commit

Permalink
Merge pull request #546 from SFDO-Community/2024_jan_fix_before_release
Browse files Browse the repository at this point in the history
2024 jan fix before release
  • Loading branch information
rdblake21 authored Jan 24, 2024
2 parents 879fe64 + e12933d commit 92f5a4d
Show file tree
Hide file tree
Showing 221 changed files with 175 additions and 34,437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr {
public List<questionItem> questionWrapper { get; set; }
private Id incomingRegId { get; set; }
public Map<String, String> lookUpDisplayValue { get; set; }

public String nextUrl { get; set; }

public class questionItem {
public String questionId { get; set; }
Expand Down Expand Up @@ -85,6 +85,7 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr {

templateSelected = SummitEventsShared.getTemplate(eventPage.Template__c);
pageFlow = SummitEventsShared.getPageFlow(eventInformation.eventId, eventInstance.Instance_Title__c, ApexPages.currentPage(), eventInstance.Instance_Start_Date__c, eventInstance.Instance_End_Date__c);
nextUrl = pageFlow.get('Next').getUrl().toLowerCase();
formattedNavDate = SummitEventsShared.navBreadcrumbBuilder(eventInstance);
instanceName = eventInstance.Name;
startTimeString = SummitEventsShared.formatTime(eventInstance.Instance_Start_Time__c, false);
Expand Down
95 changes: 51 additions & 44 deletions force-app/main/default/classes/SummitEventsRegistration.cls
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,38 @@ public class SummitEventsRegistration {
];

List<Task> activityUpdates = new List<Task>();
List<Messaging.SingleEmailMessage> emailsToSend = new List<Messaging.SingleEmailMessage>();

//loop through affected event registrations - have status change from old
for (Summit_Events_Registration__c areg : affectedRegs) {
for (Summit_Events_Registration__c registration : affectedRegs) {
//Loop through gather email templates to get template and use registration fields to fill in hooks
for (Summit_Events_Email__c em : matchEmail) {
Boolean statusMatch = false;
Boolean bccRegStatusMatch = false;
List<String> BCCsToGo = new List<String>();
if (em.Event__c.equals(areg.Event__c)) {
if (em.Event__c.equals(registration.Event__c)) {

statusMatch = false;

if (String.isNotBlank(em.Action_Sub_status__c) && String.isNotBlank(areg.Substatus__c)) {
if (em.Action_Sub_status__c.equals(areg.Substatus__c) && em.Action_Status__c.equalsIgnoreCase(areg.Status__c)) {
if (String.isNotBlank(em.Action_Sub_status__c) && String.isNotBlank(registration.Substatus__c)) {
if (em.Action_Sub_status__c.equals(registration.Substatus__c) && em.Action_Status__c.equalsIgnoreCase(registration.Status__c)) {
statusMatch = true;
}
} else if (em.Action_Status__c.equals(areg.Status__c) && String.isBlank(em.Action_Sub_status__c) && String.isBlank(areg.Substatus__c)) {
} else if (em.Action_Status__c.equals(registration.Status__c) && String.isBlank(em.Action_Sub_status__c) && String.isBlank(registration.Substatus__c)) {
statusMatch = true;
if (String.isNotBlank(areg.BCC_Transactional_Email_Statuses__c)) {
if (areg.BCC_Transactional_Email_Statuses__c.contains(em.Action_Status__c)) {
if (String.isNotBlank(registration.BCC_Transactional_Email_Statuses__c)) {
if (registration.BCC_Transactional_Email_Statuses__c.contains(em.Action_Status__c)) {
bccRegStatusMatch = true;
}
}
}

//Build the BCC list. No duplicate emails. Split strings.
BCCsToGo = addToEmailList(em.BCC_Email__c, BCCsToGo);
BCCsToGo = addToEmailList(areg.Registrant_Other_Email__c, BCCsToGo);
BCCsToGo = addToEmailList(areg.Registrant_Parent_Email__c, BCCsToGo);
BCCsToGo = addToEmailList(registration.Registrant_Other_Email__c, BCCsToGo);
BCCsToGo = addToEmailList(registration.Registrant_Parent_Email__c, BCCsToGo);
if (bccRegStatusMatch) {
BCCsToGo = addToEmailList(areg.BCC_Transactional_Emails__c, BCCsToGo);
BCCsToGo = addToEmailList(registration.BCC_Transactional_Emails__c, BCCsToGo);
}

if (statusMatch) {
Expand Down Expand Up @@ -147,7 +148,7 @@ public class SummitEventsRegistration {
//Get the value for hook from registration have to remove any registration object names since we are already in the object
String found = matcher2.group(1).replace(namespace + 'Summit_Events_Registration__c.', '');
try {
found = String.valueOf(areg.get(found));
found = String.valueOf(registration.get(found));
} catch (Exception e) {
found = '';
}
Expand All @@ -156,8 +157,8 @@ public class SummitEventsRegistration {
if (String.isBlank(found)) {
found = '';
}
//replace all hooks with found values from regstration

//replace all hooks with found values from registration
if (emailTags.contains(matcher2.group(1))) {
found = found.replace('_HL_ENCODED_', '<a href="');
found = found.replace('_HL__blank_HL_', '</a>');
Expand All @@ -172,13 +173,28 @@ public class SummitEventsRegistration {
//put email content (after hooks have been replaced with values) into the email template
originalTemplate = originalTemplate.replaceAll('\\[\\[DONT_DELETE_CONTENT_HERE\\]\\]', emailContent);

//send the message
String emailMessage = sendEmail2(areg.Registrant_Email__c, originalTemplate, emailContent, em.Email_Subject__c, em.Org_Email_Id__c, BCCsToGo);
//Create the email
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[]{
registration.Registrant_Email__c
});
mail.setSubject(em.Email_Subject__c);
mail.setBccAddresses(BCCsToGo);
mail.setPlainTextBody(emailContent);
if (String.isBlank(originalTemplate)) {
mail.setHtmlBody(emailContent);
} else {
mail.setHtmlBody(originalTemplate);
}
mail.setOrgWideEmailAddressId(em.Org_Email_Id__c);

//Add the email to the list of emails to send
emailsToSend.add(mail);

//Create an activity task
Task nt = new Task();
nt.WhatId = areg.Id;
nt.WhoId = areg.Contact__c;
nt.WhatId = registration.Id;
nt.WhoId = registration.Contact__c;
nt.Type = 'Email';
nt.ActivityDate = Date.today();
nt.Subject = 'Event status email: ' + em.Action_Status__c + ' - ' + em.Email_Subject__c;
Expand All @@ -187,17 +203,34 @@ public class SummitEventsRegistration {

nt.Description = emailContent.replaceAll('</p>', '\n'); // Replaces </p> (the paragraph closing tag) with a line break, since it is functionally identical to a line break
nt.Description = nt.Description.replaceAll('<(.*?)>', ''); // Replaces angled brackets and everything between with an empty string
nt.Description += '\n\n' + 'Registrant Email: ' + areg.Registrant_Email__c;
nt.Description = emailMessage + '\n\n' + nt.Description;
nt.Description += '\n\n' + 'Registrant Email: ' + registration.Registrant_Email__c;
nt.Description = nt.Description;

//Add the activity task to the list of activity tasks to save
activityUpdates.add(nt);
}

}
}
}

String emailMessage = 'Email successfully sent!';

if (emailsToSend.size() > 0) {
try {
Messaging.sendEmail(emailsToSend);
} catch (Exception ex) {
//If the email fails, we want to add the error message to the activity task description
emailMessage = 'Email failed with this error: ' + ex.getMessage();
System.debug(ex.getMessage());
}
}

if (activityUpdates.size() > 0) {
//Add email status message to the activity task description
for (Task t : activityUpdates) {
t.Description = emailMessage + '\n\n' + t.Description;
}
doCRUD crudToDo = new doCRUD();
crudToDo.savTask(activityUpdates);
}
Expand Down Expand Up @@ -248,32 +281,6 @@ public class SummitEventsRegistration {
return res;
}

public static String sendEmail2(String EmailTo, String HTMLBody, String plainBody, String Subject, Id OrgEmailId, List<String> BccList) {
String emailMessage = 'Email successfully sent!';
try {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(new String[]{
EmailTo
});
mail.setSubject(Subject);
mail.setBccAddresses(BccList);
mail.setPlainTextBody(plainBody);
if (String.isBlank(HTMLBody)) {
mail.setHtmlBody(plainBody);
} else {
mail.setHtmlBody(HTMLBody);
}
mail.setOrgWideEmailAddressId(OrgEmailId);
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[]{
mail
});
} catch (Exception ex) {
emailMessage = 'Email failed with this error: ' + ex.getMessage();
System.debug(ex.getMessage());
}
return emailMessage;
}

private without sharing class doCRUD {

public void savTask(List<Task> taskToSave) {
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/classes/SummitEventsShared.cls
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public with sharing class SummitEventsShared {
}

//If event has more than 1 item in list then submit page
if (pagesInEvent.size() > 1) {
if (pagesInEvent.size() > 1 && !(pagesInEvent.size() == 2 && pagesInEvent.contains(namespace + 'SummitEventsRegister') && pagesInEvent.contains(namespace + 'SummitEventsAdditionalQuestions'))) {
pagesInEvent.add(namespace + 'SummitEventsSubmit');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<externalId>false</externalId>
<inlineHelpText>Total Number of Guests not including the Registrant</inlineHelpText>
<label>Number of Guests</label>
<precision>2</precision>
<precision>4</precision>
<required>false</required>
<scale>0</scale>
<trackHistory>false</trackHistory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<formula>IF(!ISBLANK(Registrant_Preferred_First_Name__c), Registrant_Preferred_First_Name__c, Registrant_First_Name__c) + &apos; &apos; +
Registrant_Last_Name__c</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<label>Preferred First Name Formatted</label>
<label>Preferred Full Name Formatted</label>
<required>false</required>
<trackHistory>false</trackHistory>
<trackTrending>false</trackTrending>
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/pages/GeneralSLDS.page-meta.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>GeneralSLDS</label>
</ApexPage>
2 changes: 1 addition & 1 deletion force-app/main/default/pages/SummitEvents.page
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Created by Thaddaeus Dahlberg on 5/1/2018.
const communityBaseURL = '{!communityBaseURL}';
</script>
<link href="{!URLFOR($Resource.SummitEventsAssets, '/css/calendar.css')}" rel="stylesheet" type="text/css"/>
<script src="{!URLFOR($Resource.SummitEventsAssets, '/fullcalendar/dist/index.global.min.js')}"></script>
<script src="{!URLFOR($Resource.SummitEventsAssets, '/fullcalendar/index.global.min.js')}"></script>
<script src="{!URLFOR($Resource.SummitEventsAssets, '/js/moment.min.js')}"></script>
<script src="{!URLFOR($Resource.SummitEventsAssets, '/js/calendar.js')}"></script>
<!-- end copy -->
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/pages/SummitEvents.page-meta.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEvents</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsAddToCalendar</label>
</ApexPage>
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
</apex:repeat>
<div class="slds-col slds-size_1-of-1 slds-clearfix slds-p-around_x-small slds-p-vertical_xx-small">
<p class="slds-text-body slds-p-vertical_xx-small">
<apex:commandButton action="{!submitAdditionalQuestions}" onClick="fadeout();" Value="Next" id="submitQuestions" styleClass="slds-button slds-button_brand slds-p-horizontal_xx-large slds-p-vertical_xx-small"/>
<apex:commandButton action="{!submitAdditionalQuestions}" onClick="fadeout();" Value="{!IF(CONTAINS(nextUrl,'summiteventsconfirmation'), 'Register', 'Next')}" id="submitQuestions" styleClass="slds-button slds-button_brand slds-p-horizontal_xx-large slds-p-vertical_xx-small"/>
<apex:commandLink action="{!previousPage}" onClick="fadeout();" Value="Previous" id="previousPage" styleClass="slds-button slds-button_neutral slds-p-horizontal_xx-large slds-p-vertical_xx-small" immediate="true"/>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsAdditionalQuestions</label>
</ApexPage>
2 changes: 1 addition & 1 deletion force-app/main/default/pages/SummitEventsCancelReview.page
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Created by Thaddaeus Dahlberg on 5/1/2018.
<apex:define name="sectionNav"/>
<apex:define name="body">
<div class="slds-col slds-size_1-of-1 slds-p-vertical_x-small slds-p-vertical_xx-small">
<apex:messages/>
<apex:messages />
</div>
<apex:form id="SummitEventsRegistrationCancelReview" rendered="{!!eventOver && !eventNotFound && eventRegistration.Status__c != 'Cancelled'}" styleClass="slds-grid slds-wrap">
<div class="slds-col slds-size_1-of-1 slds-p-vertical_x-small slds-p-vertical_xx-small">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsCancelReview</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsConfirmation</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsDonation</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsHostAssignment</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>51.0</apiVersion>
<apiVersion>56.0</apiVersion>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsLetterheadLookup</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsParkingPass</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsPrintItineraries</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsRegister</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsRegisterAppointments</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsGuestRegistration</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<availableInTouch>true</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>SummitEventsSubmit</label>
</ApexPage>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>49.0</apiVersion>
<apiVersion>56.0</apiVersion>
<availableInTouch>false</availableInTouch>
<confirmationTokenRequired>false</confirmationTokenRequired>
<label>crowncollege2020</label>
Expand Down
Loading

0 comments on commit 92f5a4d

Please sign in to comment.