Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work NPSP MultiCurrency Customers on the One-to-One Account Model May Receive Null Pointer Exceptions When Inserting a Contact on Hyperforce Instances #6950

Merged
merged 5 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions force-app/main/default/classes/RLLP_OppRollup_TEST2.cls
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ public with sharing class RLLP_OppRollup_TEST2 {
npe01__Enable_Opportunity_Contact_Role_Trigger__c = true,
npe01__Opportunity_Contact_Role_Default_role__c = CAO_Constants.OCR_DONOR_ROLE
));

//exercise internal multicurrency helper methods, check currency conversion
decimal d = UTIL_CurrencyConversion.convertFromCorporateUsingStandardRates('USD', 55.00);
d = UTIL_CurrencyConversion.convertAmountUsingStandardRates('USD', 'USD', 55.00);
Expand Down Expand Up @@ -439,6 +440,29 @@ public with sharing class RLLP_OppRollup_TEST2 {

// UNDONE: THERE ARE NO ASSERTS!!!!
}

/*********************************************************************************************************
* @description For new Falcon instances, an aggregate query that returns no results is not returning an empty
* list but is returning a single record where the properties are null. This tests that scenario.
*/
@IsTest
static void getISOCodeWithNullRollupFieldSetDoesNotThrowException() {
if (!UTIL_Currency.getInstance().isMultiCurrencyOrganization()) {
return;
}

List<SObject> opportunitiesWithRollupFieldSets = [SELECT MAX(npo02__CombinedRollupFieldset__c) RollupFieldSet
FROM Opportunity
WHERE Id != NULL];
Exception findCurrencyISOException;
try {
RLLP_OppRollup_UTIL.rcfFindCurrency(opportunitiesWithRollupFieldSets);
} catch (Exception ex) {
findCurrencyISOException = ex;
}
System.assertEquals(null, findCurrencyISOException, 'Retrieving the ISO codes for opportunities with define ' +
'rollup field sets populated should not throw an exception when the rollup field set is null.');
}
/*********************************************************************************************************
* @description Runs testRollupAlls test method for the One to One account processor.
*/
Expand Down
7 changes: 4 additions & 3 deletions force-app/main/default/classes/RLLP_OppRollup_UTIL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,10 @@ public without sharing class RLLP_OppRollup_UTIL {
//iterate over objects provided to us
for (sobject r : objectList){
//pull Id from rollup field and add to set
string[] rcf = ((string)(r.get('RollupFieldset'))).split(';\\|;',-4);
if(rcf.size() > 1 && rcf[1] != '')
opptysForCurrency.add((Id)rcf[4]);
List<String> rollupFieldSet = ((String)(r.get('RollupFieldset')))?.split(';\\|;',-4);
if (rollupFieldSet?.size() > 1 && rollupFieldSet?.get(1) != '') {
opptysForCurrency.add((Id)rollupFieldSet[4]);
}
}

if (!objectlist.isEmpty()){
Expand Down