Skip to content

Commit

Permalink
Merge pull request #1375 from bcgov/EDRD-PH1_HotFixBranch
Browse files Browse the repository at this point in the history
Changes Related to EDRD -1010 & 1015
  • Loading branch information
deepakmulamalla authored Oct 18, 2024
2 parents eeea016 + 74b0190 commit 678c2a5
Show file tree
Hide file tree
Showing 26 changed files with 178 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
15 Jan - EDRD-525 - Accenture - Update AC Recommendation Review
19 Jan- EDRD-338 - Accenture - Update Funding Expiry Date
20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number
08 Aug- EDRD-679 - Accenture - Generate FY forecasting records
08 Aug- EDRD-679 - Accenture - Generate FY forecasting records
17 Oct- EDRD-1010 - Accenture - Update Provider's - EDRD Checkbox On EDRD Case Insert
***********************************************************************************************/

@isTest
Expand Down Expand Up @@ -416,4 +417,29 @@ public class ESA_cls_caseTriggerHandlerTest {
Assert.areEqual(7, forecastRecords.size(), 'FY-MedicationDispense records should be created');
Assert.areNotEqual(0, forecastRecords.size(), 'Forecast records should not be created');
}

/**
* @author: Deepak
* @date: 17 Oct 2024
* @description: The purpose of this method is to cover Testcoverage of delete UpdateProviderOnEDRDCase
* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description]
*/
@isTest
public static void UpdateProviderOnEDRDCaseTest(){
Account providerAccount = TestFactory.newProvider('Provider Test');
providerAccount.Is_EDRD_Provider__pc = FALSE;
insert providerAccount;
Id recordTypeCaseEDRD = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('EDRD').getRecordTypeId();
List<Contact> conList = [SELECT Id FROM Contact WHERE accountID =: providerAccount.Id LIMIT 1];
List<Case> caseRec = TestFactory.createEDRDCase(1, recordTypeCaseEDRD, providerAccount.Id);
caseRec.get(0).provider__c = conList.get(0).Id;

Test.startTest();
insert caseRec;
Test.stopTest();

List<Account> providerRecords = [SELECT Id, Is_EDRD_Provider__pc FROM Account WHERE Id =: providerAccount.Id];
Assert.areEqual(TRUE, providerRecords.get(0).Is_EDRD_Provider__pc, 'Is EDRD Provider Field should be True');
Assert.areNotEqual(FALSE, providerRecords.get(0).Is_EDRD_Provider__pc, 'Is EDRD Provider Field cannot be False');
}
}
44 changes: 44 additions & 0 deletions force-app/main/default/classes/ESA_cls_caseTriggerHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
19 Jan- EDRD-382 - Accenture - Validate Eligibility Form Sign date and Eligibility form Attachment
20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number
07 Jun- EDRD-679 - Accenture - Generate FY forecasting records
17 Oct- EDRD-1010 - Accenture - Collect set of caseId's and pass it to future method
17 Oct- EDRD-1010 - Accenture - Future method(Private) is to update EDRD Provider field on Person Account.
***********************************************************************************************/

public with sharing class ESA_cls_caseTriggerHandler {
Expand Down Expand Up @@ -342,4 +344,46 @@ public with sharing class ESA_cls_caseTriggerHandler {
Database.delete(caseRelatedFYF, true);
}
}

/**
* @author: Deepak
* @date: 17 Oct 2024
* @description: The purpose of this method collect set of caseId's and pass it to future method.
* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description]
*/
public static void UpdateProviderOnEDRDCase(List<Case> newCaseList) {
Set<Id> caseIdSet = new Set<Id>();

for (Case caseObj : newCaseList) {
if (caseObj.RecordTypeId == recordTypeCaseEDRD) {
caseIdSet.add(caseObj.Id);
}
}

if (!caseIdSet.isEmpty()) {
UpdateProviderAccountsAsync(caseIdSet);
}
}

/**
* @author: Deepak
* @date: 17 Oct 2024
* @description: The purpose of this future method is to update EDRD Provider field on Person Account.
* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description]
*/
@future
private static void UpdateProviderAccountsAsync(Set<Id> caseIdSet) {
Map<Id, Account> accIdVsRecToUpdate = new Map<Id, Account>();

List<Case> caseList = [SELECT Id, Provider__r.AccountId FROM Case WHERE Id IN :caseIdSet AND Provider__c != NULL
AND Provider__r.Account.Is_EDRD_Provider__pc = FALSE];

for (Case caseObj : caseList) {
accIdVsRecToUpdate.put(caseObj.Provider__r.AccountId, new Account(Id = caseObj.Provider__r.AccountId, Is_EDRD_Provider__pc = TRUE));
}

if (!accIdVsRecToUpdate.isEmpty()) {
Database.Update(accIdVsRecToUpdate.values(), true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<operation>equals</operation>
<value>PersonAccount.Committee_Reviewer</value>
</filters>
<label>All EDRD Committees</label>
<label>EDRD - All Committee Reviewers</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>All_EDRD_Patients</fullName>
<columns>ACCOUNT.NAME</columns>
<columns>EDRD_Ref_No__pc</columns>
<columns>Patient_Identifier__pc</columns>
<columns>ACCOUNT.PHONE1</columns>
<columns>ACCOUNT.PHONE2</columns>
Expand All @@ -13,7 +14,7 @@
<operation>equals</operation>
<value>PersonAccount.Patient</value>
</filters>
<label>All EDRD Patients</label>
<label>EDRD - All Patients</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinates>EDRD_Admin</roleAndSubordinates>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<operation>equals</operation>
<value>PersonAccount.Provider</value>
</filters>
<label>All EDRD Providers</label>
<label>EDRD - All Providers</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<operation>equals</operation>
<value>Account.Manufacturer</value>
</filters>
<label>All EDRD Manufacturers</label>
<label>EDRD - All Drug Manufacturers</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>EDRD_Enrolled_Patients</fullName>
<columns>ACCOUNT.NAME</columns>
<columns>EDRD_Ref_No__pc</columns>
<columns>Patient_Identifier__pc</columns>
<columns>ACCOUNT.PHONE1</columns>
<columns>ACCOUNT.PHONE2</columns>
<columns>PC_ADDRESS2_CITY</columns>
<columns>PC_ADDRESS2_ZIP</columns>
<filterScope>Everything</filterScope>
<filters>
<field>ACCOUNT.RECORDTYPE</field>
<operation>equals</operation>
<value>PersonAccount.Patient</value>
</filters>
<filters>
<field>EDRD_Ref_No__pc</field>
<operation>notEqual</operation>
</filters>
<label>EDRD - Enrolled Patients</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
</sharedTo>
</ListView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<ListView xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>EDRD_Related_Providers</fullName>
<columns>ACCOUNT.NAME</columns>
<columns>Provider_Type__pc</columns>
<columns>Provider_Identifier__pc</columns>
<columns>ACCOUNT.PHONE1</columns>
<columns>ACCOUNT.PHONE2</columns>
<columns>PC_ADDRESS2_CITY</columns>
<columns>PC_ADDRESS2_ZIP</columns>
<filterScope>Everything</filterScope>
<filters>
<field>ACCOUNT.RECORDTYPE</field>
<operation>equals</operation>
<value>PersonAccount.Provider</value>
</filters>
<filters>
<field>Is_EDRD_Provider__pc</field>
<operation>equals</operation>
<value>1</value>
</filters>
<label>EDRD - Related Providers</label>
<sharedTo>
<role>Developer</role>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
</sharedTo>
</ListView>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<operation>equals</operation>
<value>0</value>
</filters>
<label>EDRD AC Review</label>
<label>EDRD Cases - In AC Review</label>
<sharedTo>
<roleAndSubordinates>EDRD_Admin</roleAndSubordinates>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<operation>equals</operation>
<value>Case.EDRD</value>
</filters>
<label>All EDRD Cases</label>
<label>EDRD - All Cases</label>
<sharedTo>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<operation>equals</operation>
<value>Case.EDRD</value>
</filters>
<label>EDRD MOH Queue</label>
<label>EDRD MOH Queue - Cases</label>
<queue>EDRD_Ministry_Queue</queue>
<sharedTo>
<role>Developer</role>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<operation>equals</operation>
<value>Funding Approved,Cancelled,Funding Denied</value>
</filters>
<label>EDRD PSP Closed Queue</label>
<label>EDRD PSP Queue - Closed Cases</label>
<queue>EDRD_PSP_Queue</queue>
<sharedTo>
<roleAndSubordinatesInternal>Developer</roleAndSubordinatesInternal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<operation>equals</operation>
<value>SC Review,AC Review,MOH Review,Received - Awaiting Verification</value>
</filters>
<label>EDRD PSP Open Queue</label>
<label>EDRD PSP Queue - Open Cases</label>
<queue>EDRD_PSP_Queue</queue>
<sharedTo>
<role>Developer</role>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<operation>equals</operation>
<value>Case.EDRD</value>
</filters>
<label>EDRD MOH Review</label>
<label>EDRD Cases - In MOH Review</label>
<sharedTo>
<roleAndSubordinates>EDRD_Admin</roleAndSubordinates>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<operation>equals</operation>
<value>1</value>
</filters>
<label>My EDRD Closed Cases</label>
<label>EDRD - My Closed Cases</label>
<sharedTo>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<operation>equals</operation>
<value>1</value>
</filters>
<label>My EDRD Closed Cases-Provider</label>
<label>EDRD Provider - My Closed Cases</label>
<sharedTo>
<group>EDRD_Physicians</group>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<operation>equals</operation>
<value>Case.EDRD</value>
</filters>
<label>My EDRD Open Cases</label>
<label>EDRD - My Open Cases</label>
<sharedTo>
<roleAndSubordinatesInternal>EDRD_Admin</roleAndSubordinatesInternal>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<operation>equals</operation>
<value>1</value>
</filters>
<label>My EDRD Open Cases-Provider</label>
<label>EDRD Provider - My Open Cases</label>
<sharedTo>
<group>EDRD_Physicians</group>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<operation>equals</operation>
<value>0</value>
</filters>
<label>EDRD SC Review</label>
<label>EDRD Cases - In SC Review</label>
<sharedTo>
<roleAndSubordinates>EDRD_Admin</roleAndSubordinates>
</sharedTo>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>Is_EDRD_Provider__c</fullName>
<defaultValue>false</defaultValue>
<description>This field will be true when Provider has Cases which is of recordtype = EDRD</description>
<externalId>false</externalId>
<label>Is EDRD Provider</label>
<trackFeedHistory>false</trackFeedHistory>
<trackHistory>false</trackHistory>
<type>Checkbox</type>
</CustomField>
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@
<field>Contact.Fax</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Is_EDRD_Provider__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Contact.Legacy_EDRD_Ref_No__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,11 @@
<field>Contact.Fax</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Is_EDRD_Provider__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Legacy_EDRD_Ref_No__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@
<field>Contact.Fax</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Is_EDRD_Provider__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Contact.Legacy_EDRD_Ref_No__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@
<field>Contact.Fax</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Contact.Is_EDRD_Provider__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Contact.Legacy_EDRD_Ref_No__c</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,11 @@
<field>Contact.Fax</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Is_EDRD_Provider__c</field>
<readable>true</readable>
</fieldPermissions>
<fieldPermissions>
<editable>true</editable>
<field>Contact.Legacy_EDRD_Ref_No__c</field>
Expand Down
2 changes: 2 additions & 0 deletions force-app/main/default/triggers/CaseTrigger.trigger
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
19 Jan - EDRD-338 - Accenture - Update Funding Expiry and Extension Date
19 Jan- EDRD-382 - Accenture - Validate Eligibility Form Sign date and Eligibility form Attachment
20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number
17 Oct- EDRD-1010 - Accenture - Update Provider's - EDRD Checkbox On EDRD Case Insert
***********************************************************************************************/
trigger CaseTrigger on Case (before insert, before update, after insert, after update) {

Expand All @@ -27,6 +28,7 @@ trigger CaseTrigger on Case (before insert, before update, after insert, after u
}
}
}
ESA_cls_caseTriggerHandler.UpdateProviderOnEDRDCase(trigger.new);
}

if(trigger.isBefore){
Expand Down

0 comments on commit 678c2a5

Please sign in to comment.