Skip to content

Commit

Permalink
fixing bug with schoolName field. Changing default list view for Logi…
Browse files Browse the repository at this point in the history
…n Attempt object
  • Loading branch information
jonsayer committed Jul 19, 2019
1 parent 349ee08 commit 6886b73
Show file tree
Hide file tree
Showing 5 changed files with 492 additions and 13 deletions.
30 changes: 26 additions & 4 deletions src/classes/C501_CTRL_ClassReg_CreateAcct.cls
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,30 @@ public class C501_CTRL_ClassReg_CreateAcct {
public Account family {get; set;}
public String pageStatus {get; set;}
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 schoolName {
get{
if(schoolName == null){
system.debug('rerunning schoolName get line 18');
schoolName = '';
}
system.debug('returning school name');
return schoolName;
}
set;
}

public String schoolRegion {
get{
if(schoolRegion == null){
system.debug('rerunning schoolRegion get line 18');
schoolRegion = '';
}
system.debug('returning school region');
return schoolRegion;
}
set;
Expand All @@ -36,9 +50,11 @@ public class C501_CTRL_ClassReg_CreateAcct {
public List<SelectOption> schoolList {
get {
if(schoolList == null ){
system.debug('rerunning schoolList get line 41');
schoolList = getSelectOptionsActiveSchools(schoolRegion);
}
System.debug('List<SelectOption> schoolList run: ' + schoolList);
system.debug('returning schoolList');
return schoolList;
} set;
}
Expand All @@ -49,6 +65,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
public List<Schema.FieldSetMember> childFieldSet {get; set;}

public C501_CTRL_ClassReg_CreateAcct(){

language = ApexPages.currentPage().getParameters().get('l');
if(language == null){
language = 'en_US';
Expand Down Expand Up @@ -113,6 +130,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
noStuID = false;
noAllergyResp = false;
needPickup = false;
schoolregion = '';

Map<String, Schema.FieldSet> FsAcctMap = Schema.SObjectType.Account.fieldSets.getMap();
Map<String, Schema.FieldSet> FsContMap = Schema.SObjectType.Contact.fieldSets.getMap();
Expand Down Expand Up @@ -335,7 +353,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
passValidation = false;
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,Label.C501_ClassReg_PhoneFail) );
}
system.debug( 'SchoolName after validation attempts: ' + schoolName );
if(passValidation == false){
return null;
}
Expand Down Expand Up @@ -392,8 +410,10 @@ public class C501_CTRL_ClassReg_CreateAcct {
teacherName = teacherName + schoolNameText.npe5__Affiliations__r[i].npe5__Contact__r.FirstName + ' ' +schoolNameText.npe5__Affiliations__r[i].npe5__Contact__r.LastName;
}


String nextStartDate = Datetime.newInstance(schoolNameText.C501_Next_Program_Start_Date__c, Time.newInstance(0,0,0,0)).format('MMMMM d, yyyy');
String nextStartDate = '';
if(schoolNameText.C501_Next_Program_Start_Date__c != null){
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);
Expand All @@ -416,6 +436,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
}

public static List<Account> getListOfActiveSchools(String regionFilter){
system.debug('rerunning getListOfActiveSchools line 424');
Id schoolRecordType = [select id from Recordtype where Name='School'].Id;
List<Account> schoolList = new List<Account>();
schoolList = [
Expand All @@ -430,6 +451,7 @@ public class C501_CTRL_ClassReg_CreateAcct {
ORDER BY School_District_Lookup__r.Name, Name
];
if(schoolList.size() == 0){
system.debug('first query returned null, pulling whole list');
schoolList = [
SELECT id,
Name,
Expand Down
2 changes: 2 additions & 0 deletions src/objects/Class_Site_Login_Attempt__c.object
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ Tracks logins to the Class Registration Site.</description>
<listViews>
<fullName>All</fullName>
<columns>NAME</columns>
<columns>Account__c</columns>
<columns>Login_IP_Address__c</columns>
<columns>Code_Sent_To__c</columns>
<columns>Secret_Code__c</columns>
<columns>SMS_Timestamp__c</columns>
<filterScope>Everything</filterScope>
Expand Down
5 changes: 4 additions & 1 deletion src/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<members>Contact.Parent_Education_second_parent__c</members>
<members>Contact.Parent_Education_second_parent__c</members>
<members>Contact.Preferred_Method_of_Contact__c</members>
<members>Contact.Preferred_Method_of_Contact__c</members>
<members>Contact.Race__c</members>
<members>Contact.Student_Special_Needs__c</members>
<members>Contact.Student_Transportation__c</members>
Expand Down Expand Up @@ -229,6 +228,10 @@
<members>School_Term__c.X2016_17_School_Terms</members>
<name>ListView</name>
</types>
<types>
<members>C501_Registration_Site_User</members>
<name>PermissionSet</name>
</types>
<types>
<members>Class_Reg_s_by_Signup_Method_This_Year</members>
<name>Report</name>
Expand Down
34 changes: 26 additions & 8 deletions src/pages/C501_ClassReg_CreateAcct.page
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,22 @@
<div class="form-group">
<label>{! $Label.C501_ClassReg_ChildSchoolRegion }</label>
<apex:selectList styleClass="form-control" id="regionSelect" value="{! schoolRegion }" size="1" multiselect="false" >
<apex:actionSupport event="onchange" action="{!refreshSchools}" rerender="schoolNameList" status="status"/>
<apex:actionSupport event="onchange" action="{!refreshSchools}" rerender="schoolNameList" status="status" oncomplete="saveSchool()"/>
<apex:selectOptions value="{!regions}"></apex:selectOptions>
</apex:selectList>
</div>
</div>
</div>
</apex:actionRegion>
<apex:outputPanel id="schoolNameList">
<apex:outputPanel id="schoolNameList" >
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>{! $Label.C501_ClassReg_ChildSchoolName } <span class="red">*</span></label>
<apex:selectList styleClass="form-control" value="{!schoolName }" size="1" html-name="School Name">
<apex:selectList id="schoolNameSelectList" styleClass="form-control schoolNameSelectList" size="1" html-name="School Name" >
<apex:selectOptions value="{!schoolList}"></apex:selectOptions>
</apex:selectList>

<apex:outputPanel rendered="{!noSchool}">
<div class="errorMsg">
<strong>Error:</strong> {! $Label.C501_ClassReg_PlzSelectOne }
Expand All @@ -195,7 +196,7 @@
</div>
</div>
</apex:outputPanel>
<apex:inputHidden value="{!schoolName }" id="schoolNameInput" />



Expand Down Expand Up @@ -660,8 +661,8 @@
</div>
</div>

<apex:actionFunction name="refreshTheSchools" action="{!refreshSchools}" rerender="schoolNameList" status="status">
</apex:actionFunction>
<!--<apex:actionFunction name="refreshTheSchools" action="{!refreshSchools}" rerender="schoolNameList" status="status" oncomplete="">
</apex:actionFunction>-->



Expand All @@ -680,8 +681,8 @@
</apex:actionStatus>


<apex:actionFunction name="changeSchoolList" action="{!refreshSchools}" rerender="schoolNameList" status="status"></apex:actionFunction>

<!--<apex:actionFunction name="changeSchoolList" action="{!refreshSchools}" rerender="schoolNameList" status="status"></apex:actionFunction>
-->
</apex:form>
</apex:outputPanel>

Expand Down Expand Up @@ -1109,9 +1110,26 @@
</apex:outputPanel>-->

<script>

$(document).ready(function(){
if('{!schoolName}' != ''){
$('.schoolNameSelectList').val( '{!schoolName}' );
}


saveSchool();
});

$('#stateSelect').change(function() {
$('[id$=theState]').val( $('#stateSelect').val() );
});

function saveSchool(){
$('.schoolNameSelectList').change(function() {
$('[id$=schoolNameInput]').val( $(this).val() );
});
}

</script>


Expand Down
Loading

0 comments on commit 6886b73

Please sign in to comment.