Skip to content

Commit

Permalink
changes up to 7/12/2019
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsayer committed Jul 12, 2019
1 parent 3c0836c commit 0d61f47
Show file tree
Hide file tree
Showing 10 changed files with 384 additions and 119 deletions.
68 changes: 57 additions & 11 deletions src/classes/C501_CTRL_ClassReg_CreateAcct.cls
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class C501_CTRL_ClassReg_CreateAcct {
public ID loginID {get; set;}
public String schoolName {get; set;}
public Account schoolNameText {get; set;}
public Boolean dontKnowId {get; set;}
public Boolean noAllergies {get; set;}

public String schoolRegion {
get{
if(schoolRegion == null){
Expand All @@ -22,9 +25,12 @@ public class C501_CTRL_ClassReg_CreateAcct {
public School_Term__c term {get; set;}
public String grade {get; set;}
public Boolean noState {get; set;}
public Boolean needPickup {get; set;}
public Boolean noSchool {get; set;}
public Boolean noGrade {get; set;}
public Boolean noWaiver {get; set;}
public Boolean noStuID {get; set;}
public Boolean noAllergyResp {get; set;}
private String RegType {get; set;}

public List<SelectOption> schoolList {
Expand Down Expand Up @@ -103,6 +109,10 @@ public class C501_CTRL_ClassReg_CreateAcct {
noSchool = false;
noGrade = false;
noWaiver = false;
dontKnowId = false;
noStuID = false;
noAllergyResp = false;
needPickup = false;

Map<String, Schema.FieldSet> FsAcctMap = Schema.SObjectType.Account.fieldSets.getMap();
Map<String, Schema.FieldSet> FsContMap = Schema.SObjectType.Contact.fieldSets.getMap();
Expand Down Expand Up @@ -198,6 +208,31 @@ public class C501_CTRL_ClassReg_CreateAcct {
} else {
noGrade = false;
}

if(term.Student_School_ID__c == null && dontKnowId == false){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,Label.C501_RegSite_ProvideStudentId ) );
noStuId = true;
passValidation = false;
} else {
noStuId = false;
}

if(child.Allergies__c == null && noAllergies == false){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,Label.C501_RegSite_NoAllergiesError ) );
noAllergyResp = true;
passValidation = false;
} else {
noAllergyResp = false;
}

if(child.Student_Transportation__c == 'Will receive a ride' && (child.Authorized_Pickup_1_Name__c == null || child.Authorized_Pickup_1_Phone__c == null || child.Authorized_Pickup_1_Relationship__c == null ) ){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,Label.C501_RegSite_PickUpChildError ) );
needPickup = true;
passValidation = false;
} else {
needPickup = false;
}

if( parent.Email == null && parent.HomePhone == null && parent.MobilePhone == null && parent.OtherPhone == null ){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,Label.C501_RegSite_ParentContactRequired) );
passValidation = false;
Expand Down Expand Up @@ -232,11 +267,15 @@ public class C501_CTRL_ClassReg_CreateAcct {

schoolNameText = [Select id,
Name,
Teachers_at_Site__c,
Primary_Teacher__r.FirstName ,
Primary_Teacher__r.LastName ,
Secondary_Teacher__r.FirstName ,
Secondary_Teacher__r.LastName
C501_Next_Program_Start_Date__c,
(
SELECT npe5__Status__c,
npe5__Contact__c,
npe5__Contact__r.FirstName,
npe5__Contact__r.LastName
FROM npe5__Affiliations__r
WHERE npe5__Status__c = 'Current'
)
from Account
where id = :schoolName];

Expand All @@ -250,14 +289,21 @@ public class C501_CTRL_ClassReg_CreateAcct {
C501_UTIL_ClassRegUtilities.sendSMSGenericFuture(parent.MobilePhone,Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name );
}
if(parent.Email != null && parent.Email != '' ){
String teacherName = schoolNameText.Primary_Teacher__r.FirstName + ' ' + schoolNameText.Primary_Teacher__r.LastName;

if(schoolNameText.Secondary_Teacher__r.LastName != null){
teacherName = teacherName + ' ' + Label.C501_ClassReg_AND + ' ' + schoolNameText.Secondary_Teacher__r.FirstName + ' ' + schoolNameText.Secondary_Teacher__r.LastName;
String teacherName = '';
for(Integer i = 0; i < schoolNameText.npe5__Affiliations__r.size(); i++){
if(i != 0 && i + 1 == schoolNameText.npe5__Affiliations__r.size() && schoolNameText.npe5__Affiliations__r.size() > 1){
teacherName = teacherName + ' ' + Label.C501_ClassReg_AND + ' ';
} else if(i != 0 && schoolNameText.npe5__Affiliations__r.size() > 1 ) {
teacherName = teacherName + ', ';
}
teacherName = teacherName + schoolNameText.npe5__Affiliations__r[i].npe5__Contact__r.FirstName + ' ' +schoolNameText.npe5__Affiliations__r[i].npe5__Contact__r.LastName;
}

String emailMessage = Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name +Label.C501_RegSite_EmailConfirmP2+' '+Label.C501_RegSite_EmailConfirmP3+' '+teacherName+Label.C501_RegSite_EmailConfirmP4;
C501_UTIL_ClassRegUtilities.SendEmailGeneric('[email protected]',parent.Email,Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name,emailMessage);

String nextStartDate = Datetime.newInstance(schoolNameText.C501_Next_Program_Start_Date__c, Time.newInstance(0,0,0,0)).format('MMMMM d, yyyy');

String emailMessage = Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name +Label.C501_RegSite_EmailConfirmP2+' '+nextStartDate+' '+Label.C501_RegSite_EmailConfirmP3+' '+teacherName+Label.C501_RegSite_EmailConfirmP4;
C501_UTIL_ClassRegUtilities.SendEmailGeneric('[email protected]',parent.Email,Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name,emailMessage);

C501_UTIL_ClassRegUtilities.logActivityToContact(parent.Id,Label.C501_RegSite_ConfirmSMS+' '+schoolNameText.Name, emailMessage,'Email');
}
Expand Down
5 changes: 5 additions & 0 deletions src/classes/C501_CTRL_ClassReg_CreateAcct.cls-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
<minorNumber>11</minorNumber>
<namespace>npe01</namespace>
</packageVersions>
<packageVersions>
<majorNumber>3</majorNumber>
<minorNumber>7</minorNumber>
<namespace>npe5</namespace>
</packageVersions>
<status>Active</status>
</ApexClass>
2 changes: 1 addition & 1 deletion src/classes/C501_CTRL_ClassReg_Login.cls
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class C501_CTRL_ClassReg_Login {
phoneNumber = '';
confirmation = '';
identityInput = null;
remember = true;
remember = false;
}

public PageReference confirmLoginBySendToAddress(){
Expand Down
6 changes: 3 additions & 3 deletions src/classes/C501_UTIL_ClassRegUtilities.cls
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ public class C501_UTIL_ClassRegUtilities {

public static void sendEmailConfirmation(ID AcctID, String emailAddress){
Class_Site_Login_Attempt__c att = generateLoginCode(AcctID, emailAddress);
String message = Label.C501_ClassReg_CodeMessage + ' '+att.Secret_Code__c + ' ' +Label.C501_ClassReg_CodeMessageDisclaim;
SendEmailGeneric('jon-c@501commons.org',emailAddress,Label.C501_ClassReg_ConfirmCodeSubject,message);
String message = Label.C501_ClassReg_CodeMessage + ' '+att.Secret_Code__c + ' ' +Label.C501_ClassReg_CodeMessageDisclaim+' '+Label.C501_ClassReg_CodeMessageExpire;
SendEmailGeneric('salesforce@techbridgegirls.org',emailAddress,Label.C501_ClassReg_ConfirmCodeSubject,message);
insert att;
}

Expand Down Expand Up @@ -278,7 +278,7 @@ public class C501_UTIL_ClassRegUtilities {

public static void sendSMS(ID AcctID,String phoneNumber){
Class_Site_Login_Attempt__c att = generateLoginCode(AcctId, phoneNumber);
sendSMSGeneric(phoneNumber,Label.C501_ClassReg_CodeMessage + ' '+att.Secret_Code__c + ' ' + Label.C501_ClassReg_CodeMessageDisclaim);
sendSMSGeneric(phoneNumber,Label.C501_ClassReg_CodeMessage + ' '+att.Secret_Code__c + ' ' + Label.C501_ClassReg_CodeMessageDisclaim+' '+Label.C501_ClassReg_CodeMessageExpire);
insert att;
}

Expand Down
84 changes: 84 additions & 0 deletions src/labels/CustomLabels.labels
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
<shortDescription>C501_ClassReg_AddtlStudentInfo</shortDescription>
<value>Additional Student Information</value>
</labels>
<labels>
<fullName>C501_ClassReg_AuthPickup</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_AuthPickup</shortDescription>
<value>If you selected &quot;Someone will pick up my child&quot;, What is the name of someone authorized to pick up your child?</value>
</labels>
<labels>
<fullName>C501_ClassReg_AuthToTreatMinor</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -77,20 +84,41 @@
<shortDescription>C501_ClassReg_ChildSchoolRegion</shortDescription>
<value>Techbridge serves girls in four different regions. Which region is your child&apos;s school in?</value>
</labels>
<labels>
<fullName>C501_ClassReg_CodeMessage</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_CodeMessage</shortDescription>
<value>Hello There! Your code for the Techbridge Girls registration system is:</value>
</labels>
<labels>
<fullName>C501_ClassReg_CodeMessageDisclaim</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_CodeMessageDisclaim</shortDescription>
<value>This is an unmonitored account so please don’t reply.</value>
</labels>
<labels>
<fullName>C501_ClassReg_CodeMessageExpire</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_CodeMessageExpire</shortDescription>
<value>Code expires in 30 min.</value>
</labels>
<labels>
<fullName>C501_ClassReg_ConfirmCodeSubject</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_ConfirmCodeSubject</shortDescription>
<value>Your Techbridge Girls Confirmation Code</value>
</labels>
<labels>
<fullName>C501_ClassReg_EmergencySubtext</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_EmergencySubtext</shortDescription>
<value>In case the parent/guardian cannot be reached, please provide an EMERGENCY CONTACT.</value>
</labels>
<labels>
<fullName>C501_ClassReg_EvalStudy</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -272,6 +300,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_ClassReg_PhotoVideoP1</shortDescription>
<value>Occasionally, Techbridge Girls program activities may be photographed, videotaped, and/or audio taped for educational, publicity or fundraising purposes. Please indicate if you give permission for you and/or your child or ward to appear in videos, photos and/or audio recordings without compensation (e.g., as part of brochures, slide shows or program websites). Your authorization below also permits Techbridge Girls to share photos and other media depicting you and/or your child or ward with partner organizations for use in their promotions of Techbridge Girls events and programs.</value>
</labels>
<labels>
<fullName>C501_ClassReg_PickUpChild</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_ClassReg_PickUpChild</shortDescription>
<value>Persons allowed to pick up my child:</value>
</labels>
<labels>
<fullName>C501_ClassReg_PlzSelectOne</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -391,6 +426,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_Continue</shortDescription>
<value>Continue</value>
</labels>
<labels>
<fullName>C501_RegSite_DontKnowID</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_DontKnowID</shortDescription>
<value>Check here if you don&apos;t know and authorize Techbridge Girls to get this from your child&apos;s school.</value>
</labels>
<labels>
<fullName>C501_RegSite_EmailConfirmP2</fullName>
<language>en_US</language>
Expand All @@ -412,6 +454,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_EmailConfirmP4</shortDescription>
<value>. Please contact the Techbridge Teacher at your school or community site for any questions.</value>
</labels>
<labels>
<fullName>C501_RegSite_EmergencyContacts</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_EmergencyContacts</shortDescription>
<value>Emergency Contacts</value>
</labels>
<labels>
<fullName>C501_RegSite_FamilyInformation</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -468,6 +517,20 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_Login</shortDescription>
<value>Log in</value>
</labels>
<labels>
<fullName>C501_RegSite_NoAllergies</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_NoAllergies</shortDescription>
<value>No Food Restrictions or Allergies</value>
</labels>
<labels>
<fullName>C501_RegSite_NoAllergiesError</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_NoAllergiesError</shortDescription>
<value>Please indicate if your child has any food allergies or restrictions.</value>
</labels>
<labels>
<fullName>C501_RegSite_NotProvided</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -503,13 +566,27 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_ParentLastName</shortDescription>
<value>Parent/Guardian Last Name</value>
</labels>
<labels>
<fullName>C501_RegSite_PickUpChildError</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_PickUpChildError</shortDescription>
<value>Please identify someone who can pick up your child from the program.</value>
</labels>
<labels>
<fullName>C501_RegSite_ProvidePhoneEmail</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_ProvidePhoneEmail</shortDescription>
<value>Please provide your phone number or email address to log in.</value>
</labels>
<labels>
<fullName>C501_RegSite_ProvideStudentId</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_ProvideStudentId</shortDescription>
<value>Please provide a Student ID Number, or give us permission to get it from your child&apos;s school.</value>
</labels>
<labels>
<fullName>C501_RegSite_RememberMeDevice</fullName>
<language>en_US</language>
Expand Down Expand Up @@ -566,6 +643,13 @@ We may also look at your child’s school information, like attendance and cours
<shortDescription>C501_RegSite_StudentInformation</shortDescription>
<value>Student Information</value>
</labels>
<labels>
<fullName>C501_RegSite_Transport</fullName>
<language>en_US</language>
<protected>false</protected>
<shortDescription>C501_RegSite_Transport</shortDescription>
<value>Transportation and Authorized Pickup</value>
</labels>
<labels>
<fullName>C501_RegSite_WeSentYouCode</fullName>
<language>en_US</language>
Expand Down
10 changes: 10 additions & 0 deletions src/objects/Account.object
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ SUBSTITUTE(C501_Class_Site_Mobile_Number__c, &quot;(&quot;, &quot;&quot;), &quot
<trackHistory>false</trackHistory>
<type>Phone</type>
</fields>
<fields>
<fullName>C501_Next_program_start_date__c</fullName>
<externalId>false</externalId>
<inlineHelpText>This is the date that the next class begins at this school.</inlineHelpText>
<label>Next program start date</label>
<required>false</required>
<trackFeedHistory>false</trackFeedHistory>
<trackHistory>false</trackHistory>
<type>Date</type>
</fields>
<fields>
<fullName>Primary_Teacher__c</fullName>
<deleteConstraint>SetNull</deleteConstraint>
Expand Down
Loading

0 comments on commit 0d61f47

Please sign in to comment.