Skip to content

Commit

Permalink
Merge pull request #33 from SalesforceFoundation/feature/update-schema
Browse files Browse the repository at this point in the history
Feature/update schema
  • Loading branch information
ceiroa committed May 19, 2015
2 parents 978e1d1 + 201ddb1 commit 6ce8a67
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 196 deletions.
2 changes: 1 addition & 1 deletion cumulusci.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cumulusci.package.name=HEDAP
cumulusci.package.namespace=hedap2
cumulusci.package.namespace=hedap3
cumulusci.package.apiVersion=32.0
cumulusci.package.installClass=STG_InstallScript
cumulusci.github.url.raw=https://raw.github.com/SalesforceFoundation/HEDAP
Expand Down
4 changes: 2 additions & 2 deletions src/classes/AFFL_MultiRecordTypeMapper.cls
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ public with sharing class AFFL_MultiRecordTypeMapper {
}

/*******************************************************************************************************
* @description Tells caller if Account record type needs Academic Record auto-creation.
* @description Tells caller if Account record type needs Program Enrollment auto-creation.
* @param accountRecordType The name of the Account record type as entered in the Affiliation Mappings.
* @return Boolean Whether the Account record type has been flagged as needing Academic Record auto-creation.
********************************************************************************************************/
public Boolean needsAcademicRecord(String accountRecordType) {
public Boolean needsProgramEnrollment(String accountRecordType) {
if(accountRecordType != null) {
return mapAccRecTypeToAcadAutoCreate.get(accountRecordType);
}
Expand Down
8 changes: 4 additions & 4 deletions src/classes/AFFL_MultiRecordType_TDTM.cls
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public with sharing class AFFL_MultiRecordType_TDTM extends TDTM_Runnable {
if(newlist != null && newlist.size() > 0) {
for (SObject so : newlist) {
Affiliation__c affl = (Affiliation__c)so;
createAcademicRecordIfNecessary(affl, dmlWrapper, afflMapper);
createProgramEnrollmentIfNecessary(affl, dmlWrapper, afflMapper);
}
}
afflMultiHasRunAfter = true;
Expand Down Expand Up @@ -213,10 +213,10 @@ public with sharing class AFFL_MultiRecordType_TDTM extends TDTM_Runnable {
return oldLookupsSameType.size();
}

private void createAcademicRecordIfNecessary(Affiliation__c affl, DmlWrapper dmlWrapper, AFFL_MultiRecordTypeMapper afflMapper) {
private void createProgramEnrollmentIfNecessary(Affiliation__c affl, DmlWrapper dmlWrapper, AFFL_MultiRecordTypeMapper afflMapper) {
if(affl != null && affl.Affiliation_Type__c != null) {
Boolean needsAcademicRecord = afflMapper.needsAcademicRecord(affl.Affiliation_Type__c);
if(needsAcademicRecord != null && needsAcademicRecord) {
Boolean needsProgramEnrollment = afflMapper.needsProgramEnrollment(affl.Affiliation_Type__c);
if(needsProgramEnrollment != null && needsProgramEnrollment) {
Program_Enrollment__c acadRec = new Program_Enrollment__c(Affiliation__c = affl.ID, Contact__c = affl.Contact__c);
dmlWrapper.objectsToInsert.add(acadRec);
}
Expand Down
10 changes: 5 additions & 5 deletions src/classes/AFFL_MultiRecordType_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ public with sharing class AFFL_MultiRecordType_TEST {
}

@isTest
public static void autoCreateAcademicRecord() {
if (strTestOnly != '*' && strTestOnly != 'autoCreateAcademicRecord') return;
public static void autoCreatProgramEnrollment() {
if (strTestOnly != '*' && strTestOnly != 'autoCreatProgramEnrollment') return;

setup();

Expand All @@ -292,8 +292,8 @@ public with sharing class AFFL_MultiRecordType_TEST {
Test.stopTest();

//Verify Academic Record has been created
List<Program_Enrollment__c> academicRecords = [select ID, Contact__c from Program_Enrollment__c where Affiliation__c = :affl.ID];
System.assertEquals(1, academicRecords.size());
System.assertEquals(contact.ID, academicRecords[0].Contact__c);
List<Program_Enrollment__c> programEnrollments = [select ID, Contact__c from Program_Enrollment__c where Affiliation__c = :affl.ID];
System.assertEquals(1, programEnrollments.size());
System.assertEquals(contact.ID, programEnrollments[0].Contact__c);
}
}
2 changes: 1 addition & 1 deletion src/classes/STG_InstallScript.cls
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ global without sharing class STG_InstallScript implements InstallHandler {
mappings.add(new Affl_Mappings__c(Name = 'Administrative', Account_Record_Type__c = 'Administrative', Primary_Affl_Field__c = 'Primary Administrative Account'));
mappings.add(new Affl_Mappings__c(Name = 'Business Organization', Account_Record_Type__c = 'Business Organization', Primary_Affl_Field__c = 'Primary Business Organization'));
mappings.add(new Affl_Mappings__c(Name = 'Household Account', Account_Record_Type__c = 'Household Account', Primary_Affl_Field__c = 'Primary Household'));
mappings.add(new Affl_Mappings__c(Name = 'Educational Institution', Account_Record_Type__c = 'Educational Institution', Primary_Affl_Field__c = 'Primary Educational Institution', Auto_Program_Enrollment__c = true));
mappings.add(new Affl_Mappings__c(Name = 'Educational Institution', Account_Record_Type__c = 'Educational Institution', Primary_Affl_Field__c = 'Primary Educational Institution'));
mappings.add(new Affl_Mappings__c(Name = 'Department', Account_Record_Type__c = 'University Department', Primary_Affl_Field__c = 'Primary Department', Auto_Program_Enrollment__c = true));
mappings.add(new Affl_Mappings__c(Name = 'Sports', Account_Record_Type__c = 'Sports Organization', Primary_Affl_Field__c = 'Primary Sports Organization'));
insert mappings;
Expand Down
15 changes: 14 additions & 1 deletion src/layouts/Contact-Contact Layout.layout
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<behavior>Readonly</behavior>
<field>Organization_Type__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Gender__c</field>
</layoutItems>
<layoutItems>
<behavior>Edit</behavior>
<field>Military_Service__c</field>
</layoutItems>
</layoutColumns>
<layoutColumns>
<layoutItems>
Expand All @@ -54,7 +62,12 @@
<detailHeading>false</detailHeading>
<editHeading>true</editHeading>
<label>Description Information</label>
<layoutColumns/>
<layoutColumns>
<layoutItems>
<behavior>Edit</behavior>
<field>Military_Background__c</field>
</layoutItems>
</layoutColumns>
<style>OneColumn</style>
</layoutSections>
<layoutSections>
Expand Down
16 changes: 13 additions & 3 deletions src/objects/Affl_Mappings__c.object
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@
<type>Text</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Auto_Program_Enrollment_Role__c</fullName>
<externalId>false</externalId>
<label>Auto Program Enrollment Role</label>
<length>255</length>
<required>false</required>
<trackTrending>false</trackTrending>
<type>Text</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Auto_Program_Enrollment__c</fullName>
<defaultValue>false</defaultValue>
<description>If checked, an Academic record will be automatically created when the user creates an Affiliation to an Account of this type.</description>
<description>If checked, a Program Enrollment record will be automatically created when the user creates an Affiliation to an Account of this type.</description>
<externalId>false</externalId>
<inlineHelpText>If checked, an Academic record will be automatically created when the user creates an Affiliation to an Account of this type.</inlineHelpText>
<label>Auto Academic Record</label>
<inlineHelpText>If checked, a Program Enrollment record will be automatically created when the user creates an Affiliation to an Account of this type.</inlineHelpText>
<label>Auto Program Enrollment</label>
<trackTrending>false</trackTrending>
<type>Checkbox</type>
</fields>
Expand Down
140 changes: 31 additions & 109 deletions src/objects/Contact.object
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fields>
<fullName>Admission_Date__c</fullName>
<externalId>false</externalId>
<label>Admission Date</label>
<required>false</required>
<trackFeedHistory>false</trackFeedHistory>
<type>Date</type>
</fields>
<fields>
<fullName>AlternateEmail__c</fullName>
<description>Alternate Email is an optional fourth email: Not personal, preferred, or work email.</description>
Expand All @@ -19,54 +11,6 @@
<type>Email</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Class_Standing__c</fullName>
<externalId>false</externalId>
<label>Class Standing</label>
<picklist>
<picklistValues>
<fullName>Freshman</fullName>
<default>false</default>
</picklistValues>
<picklistValues>
<fullName>Sophomore</fullName>
<default>false</default>
</picklistValues>
<picklistValues>
<fullName>Junior</fullName>
<default>false</default>
</picklistValues>
<picklistValues>
<fullName>Senior</fullName>
<default>false</default>
</picklistValues>
<sorted>false</sorted>
</picklist>
<trackFeedHistory>false</trackFeedHistory>
<type>Picklist</type>
</fields>
<fields>
<fullName>Credits_Attempted__c</fullName>
<externalId>false</externalId>
<label>Credits Attempted</label>
<precision>5</precision>
<required>false</required>
<scale>3</scale>
<trackFeedHistory>false</trackFeedHistory>
<type>Number</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Credits_Earned__c</fullName>
<externalId>false</externalId>
<label>Credits Earned</label>
<precision>5</precision>
<required>false</required>
<scale>3</scale>
<trackFeedHistory>false</trackFeedHistory>
<type>Number</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Current_Address__c</fullName>
<deleteConstraint>SetNull</deleteConstraint>
Expand Down Expand Up @@ -111,14 +55,6 @@
<trackFeedHistory>false</trackFeedHistory>
<type>Checkbox</type>
</fields>
<fields>
<fullName>Eligible_to_Enroll__c</fullName>
<defaultValue>false</defaultValue>
<externalId>false</externalId>
<label>Eligible to Enroll</label>
<trackFeedHistory>false</trackFeedHistory>
<type>Checkbox</type>
</fields>
<fields>
<fullName>Exclude_from_Household_Formal_Greeting__c</fullName>
<defaultValue>false</defaultValue>
Expand Down Expand Up @@ -166,25 +102,22 @@
<type>Checkbox</type>
</fields>
<fields>
<fullName>GPA__c</fullName>
<fullName>Gender__c</fullName>
<externalId>false</externalId>
<label>GPA</label>
<precision>3</precision>
<required>false</required>
<scale>2</scale>
<label>Gender</label>
<picklist>
<picklistValues>
<fullName>Female</fullName>
<default>false</default>
</picklistValues>
<picklistValues>
<fullName>Male</fullName>
<default>false</default>
</picklistValues>
<sorted>false</sorted>
</picklist>
<trackFeedHistory>false</trackFeedHistory>
<type>Number</type>
<unique>false</unique>
</fields>
<fields>
<fullName>HHId__c</fullName>
<externalId>false</externalId>
<formula>if(Account.SYSTEM_AccountType__c==&apos;Household Account&apos;,CASESAFEID(AccountId),null)</formula>
<inlineHelpText>holds the ID of the current Household Account.</inlineHelpText>
<label>HHId</label>
<required>false</required>
<type>Text</type>
<unique>false</unique>
<type>Picklist</type>
</fields>
<fields>
<fullName>HIPPA_Detail__c</fullName>
Expand Down Expand Up @@ -231,6 +164,23 @@ if(ISPICKVAL(Secondary_Address_Type__c,&quot;Home&quot;),
<type>Text</type>
<unique>false</unique>
</fields>
<fields>
<fullName>Military_Background__c</fullName>
<externalId>false</externalId>
<label>Military Background</label>
<length>32768</length>
<trackFeedHistory>false</trackFeedHistory>
<type>LongTextArea</type>
<visibleLines>4</visibleLines>
</fields>
<fields>
<fullName>Military_Service__c</fullName>
<defaultValue>false</defaultValue>
<externalId>false</externalId>
<label>Military Service</label>
<trackFeedHistory>false</trackFeedHistory>
<type>Checkbox</type>
</fields>
<fields>
<fullName>Naming_Exclusions__c</fullName>
<externalId>false</externalId>
Expand Down Expand Up @@ -395,14 +345,6 @@ if(ISPICKVAL(Secondary_Address_Type__c,&quot;Other&quot;),
<trackFeedHistory>false</trackFeedHistory>
<type>Lookup</type>
</fields>
<fields>
<fullName>Program_of_Study__c</fullName>
<externalId>false</externalId>
<label>Program of Study</label>
<required>false</required>
<trackFeedHistory>false</trackFeedHistory>
<type>TextArea</type>
</fields>
<fields>
<fullName>Secondary_Address_Type__c</fullName>
<description>What type of address is the other address?</description>
Expand Down Expand Up @@ -437,26 +379,6 @@ if(ISPICKVAL(Secondary_Address_Type__c,&quot;Other&quot;),
<required>false</required>
<type>EncryptedText</type>
</fields>
<fields>
<fullName>Start_Date__c</fullName>
<externalId>false</externalId>
<label>Start Date</label>
<required>false</required>
<trackFeedHistory>false</trackFeedHistory>
<type>Date</type>
</fields>
<fields>
<fullName>Type_of_Account__c</fullName>
<description>Formula: &quot;Individual&quot; or &quot;Organization&quot; depending on Account setting.</description>
<externalId>false</externalId>
<formula>IF(Account.SYSTEMIsIndividual__c,&quot;Individual&quot;,&quot;Organization&quot;)</formula>
<formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
<inlineHelpText>Formula: &quot;Individual&quot; or &quot;Organization&quot; depending on Account setting.</inlineHelpText>
<label>Type of Account</label>
<required>false</required>
<type>Text</type>
<unique>false</unique>
</fields>
<fields>
<fullName>UniversityEmail__c</fullName>
<description>Official University email address.</description>
Expand Down
Loading

0 comments on commit 6ce8a67

Please sign in to comment.