From 1ff3fb0fae3276697a0ccad8b3decacb27fff57f Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Fri, 29 Mar 2024 14:13:33 +0530
Subject: [PATCH 01/22] Commit -- BDI_DataImport_BATCH is queued on GE
Processor Queue
Executing the BDI_DataImport_BATCH batch on GiftEntryProcessorQueue to update the NPSP Data Import batch record fields.
---
force-app/main/default/classes/GiftBatchForQueueable.cls | 3 ++-
force-app/main/default/classes/GiftEntryProcessorQueue.cls | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/force-app/main/default/classes/GiftBatchForQueueable.cls b/force-app/main/default/classes/GiftBatchForQueueable.cls
index 02055ffab66..a36b748373f 100644
--- a/force-app/main/default/classes/GiftBatchForQueueable.cls
+++ b/force-app/main/default/classes/GiftBatchForQueueable.cls
@@ -149,7 +149,8 @@ public inherited sharing class GiftBatchForQueueable {
public void processChunk() {
List dataImports = gifts.asDataImports();
- BDI_DataImport_API.processDataImportRecords(dataImportSettings, dataImports, false);
+ List lstDataImportIds = new List(new Map(dataImports).keySet());
+ BDI_DataImport_API.processDataImportRecords(dataImportSettings, lstDataImportIds, false);
chunkedIds.remove(0);
}
diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue.cls b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
index c470c44ae3d..310c09550be 100644
--- a/force-app/main/default/classes/GiftEntryProcessorQueue.cls
+++ b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
@@ -38,6 +38,7 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database
private final String ABORTED = 'ABORTED';
private GiftBatchForQueueable queueableGiftBatch;
private AsyncApexJobId queueableId;
+ private GiftBatchId giftBatchId;
@TestVisible
private GiftBatchService giftBatchService {
@@ -52,6 +53,7 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database
public GiftEntryProcessorQueue(GiftBatchForQueueable giftBatchForProcessing) {
this.queueableGiftBatch = giftBatchForProcessing;
+ this.giftBatchId = giftBatchForProcessing.id();
}
public void execute(QueueableContext queueableContext) {
@@ -67,6 +69,8 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database
queueableGiftBatch.processChunk();
}
+ BDI_DataImport_BATCH batch = new BDI_DataImport_BATCH(giftBatchId.value(), false);
+ String jobId = Database.executeBatch(batch, Integer.valueOf(batch.diSettings.Batch_Size__c));
if (queueableGiftBatch.hasChunksToProcess()) {
chainNextQueueable();
} else {
From 7d9107c27c36c7d6ac458ae49fa144b2ed1f091a Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Thu, 4 Apr 2024 17:52:22 +0530
Subject: [PATCH 02/22] commit -- Gift Entry - process - batch- fixes
Removed BDI_DataImport_BATCH batch call from GiftEntryProcessorQueue and added overloaded processChunk method.
---
.../default/classes/BDI_DataImport_API.cls | 22 +++++++++++++++++++
.../default/classes/GiftBatchForQueueable.cls | 6 +++++
.../classes/GiftEntryProcessorQueue.cls | 4 +---
3 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImport_API.cls b/force-app/main/default/classes/BDI_DataImport_API.cls
index 3435df5d6c4..e373744b0d3 100644
--- a/force-app/main/default/classes/BDI_DataImport_API.cls
+++ b/force-app/main/default/classes/BDI_DataImport_API.cls
@@ -158,6 +158,28 @@ global with sharing class BDI_DataImport_API {
return apexJobId;
}
+ global static Id processDataImportRecords(Data_Import_Settings__c diSettings,
+ List dataImportIds,
+ Boolean isDryRun, Id batchId) {
+ Id apexJobId;
+ if (dataImportIds != null && dataImportIds.size() > 0) {
+ // Use configured data import settings if none provided.
+ if (diSettings == null) {
+ diSettings = UTIL_CustomSettingsFacade.getDataImportSettings();
+ }
+ Savepoint sp = Database.setSavepoint();
+ try {
+ BDI_DataImport_BATCH batch = new BDI_DataImport_BATCH(batchId, dataImportIds, new BDI_DataImportService(isDryRun, BDI_DataImportService.getDefaultMappingService()));
+ apexJobId = Database.executeBatch(batch, integer.valueOf(diSettings.Batch_Size__c));
+ } catch (Exception ex) {
+ Database.rollback(sp);
+ ex.setMessage(System.label.bdiAPISelectedError + ' ' + ex.getMessage());
+ throw ex;
+ }
+ }
+ return apexJobId;
+ }
+
/*******************************************************************************************************
* @description The return result object for each batch that is provided to processDataImportBatches()
*/
diff --git a/force-app/main/default/classes/GiftBatchForQueueable.cls b/force-app/main/default/classes/GiftBatchForQueueable.cls
index a36b748373f..d11d68bc266 100644
--- a/force-app/main/default/classes/GiftBatchForQueueable.cls
+++ b/force-app/main/default/classes/GiftBatchForQueueable.cls
@@ -154,6 +154,12 @@ public inherited sharing class GiftBatchForQueueable {
chunkedIds.remove(0);
}
+ public void processChunk(Id batchId) {
+ List dataImports = gifts.asDataImports();
+ List lstDataImportIds = new List(new Map(dataImports).keySet());
+ BDI_DataImport_API.processDataImportRecords(dataImportSettings, lstDataImportIds, false, batchId);
+ chunkedIds.remove(0);
+ }
public void chunkGiftsThatCanBeProcessed() {
List results = giftsSelector.getGiftsReadyToMoveToProcessing(giftBatchId);
if (results.size() > 0) {
diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue.cls b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
index 310c09550be..26530e96d77 100644
--- a/force-app/main/default/classes/GiftEntryProcessorQueue.cls
+++ b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
@@ -66,11 +66,9 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database
queueableGiftBatch.captureElevateBatches();
queueableGiftBatch.updateGiftsInChunk();
queueableGiftBatch.preprocessRecurringGifts();
- queueableGiftBatch.processChunk();
+ queueableGiftBatch.processChunk(giftBatchId.value());
}
- BDI_DataImport_BATCH batch = new BDI_DataImport_BATCH(giftBatchId.value(), false);
- String jobId = Database.executeBatch(batch, Integer.valueOf(batch.diSettings.Batch_Size__c));
if (queueableGiftBatch.hasChunksToProcess()) {
chainNextQueueable();
} else {
From c79af4e713bf986e539f52d17c63c5848c5db61e Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Mon, 8 Apr 2024 18:37:01 +0530
Subject: [PATCH 03/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 3 +++
1 file changed, 3 insertions(+)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index a7b46310d30..82370e60c70 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -974,6 +974,9 @@ global with sharing class BDI_DataImportService {
Map mapS = Schema.SObjectType.DataImport__c.fields.getMap();
listStrDataImportFields = new List();
listStrDataImportFields.addAll(mapS.keySet());
+ listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Name');
+ listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Batch_Number__c');
+
}
return listStrDataImportFields;
}
From 743fd0893f562b973eab617d88c6a628e0b8d266 Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Mon, 8 Apr 2024 20:53:24 +0530
Subject: [PATCH 04/22] Revert "Update BDI_DataImportService.cls"
This reverts commit c79af4e713bf986e539f52d17c63c5848c5db61e.
---
force-app/main/default/classes/BDI_DataImportService.cls | 3 ---
1 file changed, 3 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 82370e60c70..a7b46310d30 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -974,9 +974,6 @@ global with sharing class BDI_DataImportService {
Map mapS = Schema.SObjectType.DataImport__c.fields.getMap();
listStrDataImportFields = new List();
listStrDataImportFields.addAll(mapS.keySet());
- listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Name');
- listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Batch_Number__c');
-
}
return listStrDataImportFields;
}
From 4585e8d78d6e731502126bafd3beb7846e09b623 Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Wed, 10 Apr 2024 16:06:43 +0530
Subject: [PATCH 05/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index a7b46310d30..85c15249f2f 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -52,6 +52,7 @@ global with sharing class BDI_DataImportService {
public static final String ACH_PAYMENT_METHOD = 'ACH';
public static final String DI_WITH_RD_FIELDS_NO_RD2 = System.label.RD2_DisabledRD2Error;
public static final String DI_WITH_RD_FIELDS_NO_ADV_MAPPING = System.label.RD2_DisabledAdvancedMappingError;
+ public static boolean isForBatchProcess = true;
public BDI_MappingService mappingService;
@@ -90,6 +91,7 @@ global with sharing class BDI_DataImportService {
* @return String the soql String
*/
public static String strSoqlForDataImportProcess(List dataImportIds) {
+ isForBatchProcess = false;
List whereClauses = new List{
'Status__c != \'' + BDI_DataImport_API.bdiImported + '\'',
'Id =: dataImportIds'
@@ -111,6 +113,7 @@ global with sharing class BDI_DataImportService {
* @return String the soql String
*/
public static String strSoqlForBatchProcess(Id batchId) {
+ isForBatchProcess = true;
List selectClause = new List{
String.join(listStrDataImportFields, ','),
DATAIMPORT_BATCH_NUMBER_FIELD
@@ -974,6 +977,10 @@ global with sharing class BDI_DataImportService {
Map mapS = Schema.SObjectType.DataImport__c.fields.getMap();
listStrDataImportFields = new List();
listStrDataImportFields.addAll(mapS.keySet());
+ if (isForBatchProcess == false) {
+ listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Name');
+ listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Batch_Number__c');
+ }
}
return listStrDataImportFields;
}
From ac63dcb8efc8a9cafbc8550dd6bf0afb33c2fe25 Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Wed, 10 Apr 2024 19:29:25 +0530
Subject: [PATCH 06/22] Update BDI_DataImportService.cls
---
.../default/classes/BDI_DataImportService.cls | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 85c15249f2f..1e8a081246c 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -52,7 +52,6 @@ global with sharing class BDI_DataImportService {
public static final String ACH_PAYMENT_METHOD = 'ACH';
public static final String DI_WITH_RD_FIELDS_NO_RD2 = System.label.RD2_DisabledRD2Error;
public static final String DI_WITH_RD_FIELDS_NO_ADV_MAPPING = System.label.RD2_DisabledAdvancedMappingError;
- public static boolean isForBatchProcess = true;
public BDI_MappingService mappingService;
@@ -91,14 +90,17 @@ global with sharing class BDI_DataImportService {
* @return String the soql String
*/
public static String strSoqlForDataImportProcess(List dataImportIds) {
- isForBatchProcess = false;
List whereClauses = new List{
'Status__c != \'' + BDI_DataImport_API.bdiImported + '\'',
'Id =: dataImportIds'
};
-
+ List selectClause = new List{
+ String.join(listStrDataImportFields, ','),
+ DATAIMPORT_BATCH_NUMBER_FIELD
+ };
+
return new UTIL_Query()
- .withSelectFields(listStrDataImportFields)
+ .withSelectFields(selectClause)
.withFrom(DataImport__c.SObjectType)
.withWhere(whereClauses)
// this ensures consistency for our test code, but also should
@@ -113,7 +115,6 @@ global with sharing class BDI_DataImportService {
* @return String the soql String
*/
public static String strSoqlForBatchProcess(Id batchId) {
- isForBatchProcess = true;
List selectClause = new List{
String.join(listStrDataImportFields, ','),
DATAIMPORT_BATCH_NUMBER_FIELD
@@ -977,10 +978,6 @@ global with sharing class BDI_DataImportService {
Map mapS = Schema.SObjectType.DataImport__c.fields.getMap();
listStrDataImportFields = new List();
listStrDataImportFields.addAll(mapS.keySet());
- if (isForBatchProcess == false) {
- listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Name');
- listStrDataImportFields.add('NPSP_Data_Import_Batch__r.Batch_Number__c');
- }
}
return listStrDataImportFields;
}
From 1d43b5885660a415f897706e8390b53a6b22e3b1 Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Thu, 11 Apr 2024 19:48:22 +0530
Subject: [PATCH 07/22] Update GiftBatchService_TEST.cls
---
force-app/main/default/classes/GiftBatchService_TEST.cls | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/force-app/main/default/classes/GiftBatchService_TEST.cls b/force-app/main/default/classes/GiftBatchService_TEST.cls
index 3a2ee3c6271..cb1ea23c175 100644
--- a/force-app/main/default/classes/GiftBatchService_TEST.cls
+++ b/force-app/main/default/classes/GiftBatchService_TEST.cls
@@ -70,8 +70,10 @@ private class GiftBatchService_TEST {
Test.stopTest();
// Assert
- Integer jobsCount = [SELECT count() FROM AsyncApexJob];
+ Integer jobsCount = [SELECT count() FROM AsyncApexJob WHERE JobType = 'Queueable'];
System.assertEquals(1, jobsCount, 'Should have enqueued a job');
+ Integer batchjobsCount = [SELECT count() FROM AsyncApexJob WHERE JobType = 'BatchApex'];
+ System.assertEquals(1, batchjobsCount, 'Should have one batch apex job');
Integer opportunitiesCount = [SELECT count() FROM Opportunity];
System.assertEquals(10, opportunitiesCount, 'Should have created 10 opportunities');
From 073ae355e64314601c613b04e684119ddba548cf Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Mon, 15 Apr 2024 17:10:05 +0530
Subject: [PATCH 08/22] Update GiftEntryProcessorQueue.cls
---
force-app/main/default/classes/GiftEntryProcessorQueue.cls | 3 +++
1 file changed, 3 insertions(+)
diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue.cls b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
index 26530e96d77..6599551d381 100644
--- a/force-app/main/default/classes/GiftEntryProcessorQueue.cls
+++ b/force-app/main/default/classes/GiftEntryProcessorQueue.cls
@@ -67,6 +67,9 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database
queueableGiftBatch.updateGiftsInChunk();
queueableGiftBatch.preprocessRecurringGifts();
queueableGiftBatch.processChunk(giftBatchId.value());
+ } else {
+ BDI_DataImport_BATCH batch = new BDI_DataImport_BATCH(giftBatchId.value(), false);
+ String jobId = Database.executeBatch(batch, Integer.valueOf(batch.diSettings.Batch_Size__c));
}
if (queueableGiftBatch.hasChunksToProcess()) {
From 1caa6ed198d3b7f456a4c880d94cccfccc19a247 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Thu, 25 Apr 2024 20:13:46 +0530
Subject: [PATCH 09/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 1e8a081246c..0c9da69c8b0 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -622,7 +622,12 @@ global with sharing class BDI_DataImportService {
this.listDI = flsService.getValidRecords();
this.listDI = checkRDFields(listDI);
-
+ for(DataImport__c dataImport : listDI){
+ if(apexJobId!= null && dataImport.Recurring_Donation_Recurring_Type__c !=null) {
+ dataImport.Donation_Date__c = null;
+ dataImport.Donation_Amount__c = null;
+ }
+ }
// do any performance optimizations to avoid unnecessary code
disableAllOppRollups();
From a76bdfa1d8e40fdcb0495ee0abb24b1bca6e63bb Mon Sep 17 00:00:00 2001
From: enzigma-pratishtha-upadhyay
Date: Fri, 26 Apr 2024 12:38:38 +0530
Subject: [PATCH 10/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 0c9da69c8b0..9abd48fc60b 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -622,12 +622,14 @@ global with sharing class BDI_DataImportService {
this.listDI = flsService.getValidRecords();
this.listDI = checkRDFields(listDI);
+ if(apexJobId != null) {
for(DataImport__c dataImport : listDI){
- if(apexJobId!= null && dataImport.Recurring_Donation_Recurring_Type__c !=null) {
+ if(dataImport.Recurring_Donation_Recurring_Type__c !=null) {
dataImport.Donation_Date__c = null;
dataImport.Donation_Amount__c = null;
}
}
+ }
// do any performance optimizations to avoid unnecessary code
disableAllOppRollups();
From cb3e71c2ef09beff300301f3ee722d153f015523 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Thu, 2 May 2024 17:40:12 +0530
Subject: [PATCH 11/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 1 -
1 file changed, 1 deletion(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 9abd48fc60b..0e48407696f 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -626,7 +626,6 @@ global with sharing class BDI_DataImportService {
for(DataImport__c dataImport : listDI){
if(dataImport.Recurring_Donation_Recurring_Type__c !=null) {
dataImport.Donation_Date__c = null;
- dataImport.Donation_Amount__c = null;
}
}
}
From fc047037cb03502b917ab0991d038d6d838b2577 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Wed, 8 May 2024 18:18:16 +0530
Subject: [PATCH 12/22] Update BDI_DataImportService.cls
---
.../default/classes/BDI_DataImportService.cls | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 0e48407696f..d42c5d2c10e 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -622,13 +622,23 @@ global with sharing class BDI_DataImportService {
this.listDI = flsService.getValidRecords();
this.listDI = checkRDFields(listDI);
- if(apexJobId != null) {
- for(DataImport__c dataImport : listDI){
- if(dataImport.Recurring_Donation_Recurring_Type__c !=null) {
- dataImport.Donation_Date__c = null;
+
+ DataImportBatch__c batch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
+ Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c,
+ Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate
+ FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1];
+ GiftBatch giftBatch = new GiftBatch(batch);
+ Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment();
+ if(apexJobId != null) {
+ for (DataImport__c dataImport : listDI) {
+ if(dataImport.Recurring_Donation_Recurring_Type__c != null) {
+ dataImport.Donation_Date__c = null;
+ if(!firstInstallmentPaid) {
+ dataImport.Donation_Amount__c = null;
+ }
+ }
}
}
- }
// do any performance optimizations to avoid unnecessary code
disableAllOppRollups();
From 34c33d52e9b09860106b536c61b0fe1839843446 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Thu, 9 May 2024 15:37:46 +0530
Subject: [PATCH 13/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index d42c5d2c10e..d74c71ff653 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -623,13 +623,14 @@ global with sharing class BDI_DataImportService {
this.listDI = checkRDFields(listDI);
+ if(apexJobId != null && listDI.size() > 0) {
DataImportBatch__c batch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c,
Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate
FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1];
GiftBatch giftBatch = new GiftBatch(batch);
Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment();
- if(apexJobId != null) {
+
for (DataImport__c dataImport : listDI) {
if(dataImport.Recurring_Donation_Recurring_Type__c != null) {
dataImport.Donation_Date__c = null;
From 10e76c638d5d40c96b8188a345f851ed57959ccc Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Thu, 9 May 2024 15:58:07 +0530
Subject: [PATCH 14/22] Update GiftEntryProcessorQueue_TEST.cls
---
.../classes/GiftEntryProcessorQueue_TEST.cls | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls b/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
index 16c86f1e588..41745d68f87 100644
--- a/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
+++ b/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
@@ -197,6 +197,59 @@ private class GiftEntryProcessorQueue_TEST {
System.assertEquals(true, mockService.failGiftsInProcessingWasCalled);
}
+ @IsTest
+ static void shouldUpdateDataImportBatchFieldsOnGiftBatchProcess() {
+ DataImportBatch__c giftBatch = new DataImportBatch__c();
+ insert giftBatch;
+
+ List giftsToInsert = new List();
+ giftsToInsert.addAll(buildGifts(2, BDI_DataImport_API.bdiImported, giftBatch.Id, false));
+ giftsToInsert.addAll(buildGifts(5, BDI_DataImport_API.bdiDryRunValidated, giftBatch.Id, false));
+ insert giftsToInsert;
+
+ GiftBatchForQueueable giftBatchForProcessing = new GiftBatchForQueueable(new GiftBatchId(giftBatch.Id), new GiftBatchSelector());
+ giftBatchForProcessing.chunkGiftsThatCanBeProcessed();
+ GiftEntryProcessorQueue processorQueue = new GiftEntryProcessorQueue(giftBatchForProcessing);
+ GiftBatchServiceMock mockService = new GiftBatchServiceMock();
+ processorQueue.giftBatchService = stubFor(mockService);
+
+ Test.startTest();
+ processorQueue.execute(null);
+ Test.stopTest();
+
+ DataImportBatch__c processedGiftBatch = [SELECT Name, Batch_Status__c, Last_Processed_On__c,
+ Records_Successfully_Processed__c, Records_Failed__c
+ FROM DataImportBatch__c WHERE Id = :giftBatch.Id LIMIT 1];
+ System.assertEquals(5, processedGiftBatch.Records_Successfully_Processed__c, '5 gifts should be processed in this batch.');
+ System.assertEquals(0, processedGiftBatch.Records_Failed__c, '0 gifts should be failed in this batch.');
+ }
+
+ @IsTest
+ static void shouldOverrideDataImportBatchFieldsOnEmptyGiftBatchProcess() {
+ DataImportBatch__c giftBatch = new DataImportBatch__c();
+ insert giftBatch;
+
+ List giftsToInsert = new List();
+ giftsToInsert.addAll(buildGifts(2, BDI_DataImport_API.bdiImported, giftBatch.Id, false));
+ insert giftsToInsert;
+
+ GiftBatchForQueueable giftBatchForProcessing = new GiftBatchForQueueable(new GiftBatchId(giftBatch.Id), new GiftBatchSelector());
+ giftBatchForProcessing.chunkGiftsThatCanBeProcessed();
+ GiftEntryProcessorQueue processorQueue = new GiftEntryProcessorQueue(giftBatchForProcessing);
+ GiftBatchServiceMock mockService = new GiftBatchServiceMock();
+ processorQueue.giftBatchService = stubFor(mockService);
+
+ Test.startTest();
+ processorQueue.execute(null);
+ Test.stopTest();
+
+ DataImportBatch__c processedGiftBatch = [SELECT Name, Batch_Status__c, Last_Processed_On__c,
+ Records_Successfully_Processed__c, Records_Failed__c
+ FROM DataImportBatch__c WHERE Id = :giftBatch.Id LIMIT 1];
+ System.assertEquals(0, processedGiftBatch.Records_Successfully_Processed__c, '0 gifts should be processed in this batch.');
+ System.assertEquals(0, processedGiftBatch.Records_Failed__c, '0 gifts should be failed in this batch.');
+ }
+
public class GiftBatchServiceMock implements StubProvider {
public String asyncApexJobStatus = 'COMPLETED';
public Boolean clearLatestJobIdFromWasCalled = false;
From b4779d9f18fb6a78f3f996ab7d872c611f512b20 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Fri, 10 May 2024 14:02:18 +0530
Subject: [PATCH 15/22] Update GiftEntryProcessorQueue_TEST.cls
---
.../classes/GiftEntryProcessorQueue_TEST.cls | 53 -------------------
1 file changed, 53 deletions(-)
diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls b/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
index 41745d68f87..16c86f1e588 100644
--- a/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
+++ b/force-app/main/default/classes/GiftEntryProcessorQueue_TEST.cls
@@ -197,59 +197,6 @@ private class GiftEntryProcessorQueue_TEST {
System.assertEquals(true, mockService.failGiftsInProcessingWasCalled);
}
- @IsTest
- static void shouldUpdateDataImportBatchFieldsOnGiftBatchProcess() {
- DataImportBatch__c giftBatch = new DataImportBatch__c();
- insert giftBatch;
-
- List giftsToInsert = new List();
- giftsToInsert.addAll(buildGifts(2, BDI_DataImport_API.bdiImported, giftBatch.Id, false));
- giftsToInsert.addAll(buildGifts(5, BDI_DataImport_API.bdiDryRunValidated, giftBatch.Id, false));
- insert giftsToInsert;
-
- GiftBatchForQueueable giftBatchForProcessing = new GiftBatchForQueueable(new GiftBatchId(giftBatch.Id), new GiftBatchSelector());
- giftBatchForProcessing.chunkGiftsThatCanBeProcessed();
- GiftEntryProcessorQueue processorQueue = new GiftEntryProcessorQueue(giftBatchForProcessing);
- GiftBatchServiceMock mockService = new GiftBatchServiceMock();
- processorQueue.giftBatchService = stubFor(mockService);
-
- Test.startTest();
- processorQueue.execute(null);
- Test.stopTest();
-
- DataImportBatch__c processedGiftBatch = [SELECT Name, Batch_Status__c, Last_Processed_On__c,
- Records_Successfully_Processed__c, Records_Failed__c
- FROM DataImportBatch__c WHERE Id = :giftBatch.Id LIMIT 1];
- System.assertEquals(5, processedGiftBatch.Records_Successfully_Processed__c, '5 gifts should be processed in this batch.');
- System.assertEquals(0, processedGiftBatch.Records_Failed__c, '0 gifts should be failed in this batch.');
- }
-
- @IsTest
- static void shouldOverrideDataImportBatchFieldsOnEmptyGiftBatchProcess() {
- DataImportBatch__c giftBatch = new DataImportBatch__c();
- insert giftBatch;
-
- List giftsToInsert = new List();
- giftsToInsert.addAll(buildGifts(2, BDI_DataImport_API.bdiImported, giftBatch.Id, false));
- insert giftsToInsert;
-
- GiftBatchForQueueable giftBatchForProcessing = new GiftBatchForQueueable(new GiftBatchId(giftBatch.Id), new GiftBatchSelector());
- giftBatchForProcessing.chunkGiftsThatCanBeProcessed();
- GiftEntryProcessorQueue processorQueue = new GiftEntryProcessorQueue(giftBatchForProcessing);
- GiftBatchServiceMock mockService = new GiftBatchServiceMock();
- processorQueue.giftBatchService = stubFor(mockService);
-
- Test.startTest();
- processorQueue.execute(null);
- Test.stopTest();
-
- DataImportBatch__c processedGiftBatch = [SELECT Name, Batch_Status__c, Last_Processed_On__c,
- Records_Successfully_Processed__c, Records_Failed__c
- FROM DataImportBatch__c WHERE Id = :giftBatch.Id LIMIT 1];
- System.assertEquals(0, processedGiftBatch.Records_Successfully_Processed__c, '0 gifts should be processed in this batch.');
- System.assertEquals(0, processedGiftBatch.Records_Failed__c, '0 gifts should be failed in this batch.');
- }
-
public class GiftBatchServiceMock implements StubProvider {
public String asyncApexJobStatus = 'COMPLETED';
public Boolean clearLatestJobIdFromWasCalled = false;
From afdd2b59d25f409159bf7b787e50c4c6a617a080 Mon Sep 17 00:00:00 2001
From: p-upadhyay_sfemu
Date: Fri, 10 May 2024 16:56:36 +0530
Subject: [PATCH 16/22] Update BDI_DataImportService.cls
---
force-app/main/default/classes/BDI_DataImportService.cls | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index d74c71ff653..3963becd7d8 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -624,11 +624,12 @@ global with sharing class BDI_DataImportService {
this.listDI = checkRDFields(listDI);
if(apexJobId != null && listDI.size() > 0) {
- DataImportBatch__c batch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
+ List listBatch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c,
Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate
FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1];
- GiftBatch giftBatch = new GiftBatch(batch);
+ if(listBatch.size() > 0 ){
+ GiftBatch giftBatch = new GiftBatch(listBatch[0]);
Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment();
for (DataImport__c dataImport : listDI) {
@@ -640,6 +641,7 @@ global with sharing class BDI_DataImportService {
}
}
}
+ }
// do any performance optimizations to avoid unnecessary code
disableAllOppRollups();
From 594f62c1294204653e04963ee5300f5a69f8b39e Mon Sep 17 00:00:00 2001
From: Luke Parrott
Date: Mon, 13 May 2024 11:58:26 -0500
Subject: [PATCH 17/22] Minor formating fixes
---
.../default/classes/BDI_DataImportService.cls | 34 +++++++++----------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls
index 3963becd7d8..46dffa4d66c 100644
--- a/force-app/main/default/classes/BDI_DataImportService.cls
+++ b/force-app/main/default/classes/BDI_DataImportService.cls
@@ -98,7 +98,7 @@ global with sharing class BDI_DataImportService {
String.join(listStrDataImportFields, ','),
DATAIMPORT_BATCH_NUMBER_FIELD
};
-
+
return new UTIL_Query()
.withSelectFields(selectClause)
.withFrom(DataImport__c.SObjectType)
@@ -623,25 +623,25 @@ global with sharing class BDI_DataImportService {
this.listDI = checkRDFields(listDI);
- if(apexJobId != null && listDI.size() > 0) {
- List listBatch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
- Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c,
- Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate
- FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1];
- if(listBatch.size() > 0 ){
- GiftBatch giftBatch = new GiftBatch(listBatch[0]);
- Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment();
-
- for (DataImport__c dataImport : listDI) {
- if(dataImport.Recurring_Donation_Recurring_Type__c != null) {
- dataImport.Donation_Date__c = null;
- if(!firstInstallmentPaid) {
- dataImport.Donation_Amount__c = null;
+ if (apexJobId != null && listDI.size() > 0) {
+ List listBatch = [SELECT Name, Batch_Number__c, Batch_Status__c, Batch_Defaults__c,
+ Form_Template__c, RequireTotalMatch__c, Expected_Count_of_Gifts__c,
+ Expected_Total_Batch_Amount__c, Batch_Table_Columns__c, LastModifiedDate
+ FROM DataImportBatch__c WHERE Id= :listDI[0].NPSP_Data_Import_Batch__c LIMIT 1];
+ if (listBatch.size() > 0 ) {
+ GiftBatch giftBatch = new GiftBatch(listBatch[0]);
+ Boolean firstInstallmentPaid = giftBatch.shouldPayFirstInstallment();
+
+ for (DataImport__c dataImport : listDI) {
+ if(dataImport.Recurring_Donation_Recurring_Type__c != null) {
+ dataImport.Donation_Date__c = null;
+ if (!firstInstallmentPaid) {
+ dataImport.Donation_Amount__c = null;
+ }
}
- }
+ }
}
}
- }
// do any performance optimizations to avoid unnecessary code
disableAllOppRollups();
From 6c69ebb0c5215c34a9d321d06388966a1b6a59aa Mon Sep 17 00:00:00 2001
From: salesforce-suyash-more
Date: Wed, 26 Jun 2024 12:21:09 +0530
Subject: [PATCH 18/22] changes to mark 'Upgrade process complete' in a
headings tag
'Upgrade process complete' heading is marked with a heading tag
to overcome accessibility issue.
---
.../main/default/labels/CustomLabels.labels-meta.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/force-app/main/default/labels/CustomLabels.labels-meta.xml b/force-app/main/default/labels/CustomLabels.labels-meta.xml
index 1ddb49a99db..70d5aacec35 100644
--- a/force-app/main/default/labels/CustomLabels.labels-meta.xml
+++ b/force-app/main/default/labels/CustomLabels.labels-meta.xml
@@ -2152,15 +2152,15 @@
en_UStrueMessage displayed on a successful migration
- <b>Upgrade process complete!</b><br/>
- <br/>Before your organization starts using Enhanced Recurring Donations:<br/>
- <ul><li>Turn on workflows, processes, validation rules and triggers that you disabled prior to upgrade.</li>
+ <h4>Upgrade process complete!</h4>
+ <p>Before your organization starts using Enhanced Recurring Donations:</p>
+ <ul><li>Turn on workflows, processes, validation rules, and triggers that you disabled prior to upgrade.</li>
<li>Assign the Enhanced Recurring Donations page layout to all user profiles and remove the old Recurring Donations page layout.</li>
<li>Assign the NPSP Recurring Donation Lightning record page as the Org Default.</li>
<li>Assign the RD2_VisualizeScheduleController Apex class to your custom profiles.</li>
<li>Adjust field-level security for Recurring Donations fields as necessary for your profiles and permission sets.</li>
<li>Adjust Recurring Donations reports to work with Enhanced Recurring Donations.</li>
- <li>Educate your staff about Enhanced Recurring Donations.</li>
+ <li>Educate your staff about Enhanced Recurring Donations.</li></ul>RD2_EnablementMigrationErrorMessage
From fef85cbcc8c45c6724f2b9fadcd374b59c880439 Mon Sep 17 00:00:00 2001
From: salesforce-suyash-more
Date: Wed, 26 Jun 2024 12:58:26 +0530
Subject: [PATCH 19/22] Changes to mark 'Data Migration Run' in a explicit
heading tag
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
'Data Migration Run' was only styled to look like headings but wasn’t marked as such, hence added h2 heading tag explicitly.
---
force-app/main/default/lwc/batchProgress/batchProgress.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/force-app/main/default/lwc/batchProgress/batchProgress.html b/force-app/main/default/lwc/batchProgress/batchProgress.html
index 0c9ebd6d1c7..7adc593fc74 100644
--- a/force-app/main/default/lwc/batchProgress/batchProgress.html
+++ b/force-app/main/default/lwc/batchProgress/batchProgress.html
@@ -11,7 +11,7 @@
- {title}
+
{title}
From 96368d7767841fa7667a98e041470b6d71c684d3 Mon Sep 17 00:00:00 2001
From: salesforce-suyash-more
Date: Wed, 26 Jun 2024 18:02:09 +0530
Subject: [PATCH 20/22] Changes in RD2_EnablementDelegate.cmp to maintain
well-formed markup structure.
In RD2_EnablementDelegate.cmp elements are reformed to maintain consistency and proper HTML structure.
---
.../RD2_EnablementDelegate/RD2_EnablementDelegate.cmp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegate.cmp b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegate.cmp
index 062a52fbe75..52590e892c7 100644
--- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegate.cmp
+++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegate.cmp
@@ -55,8 +55,9 @@
-
-
+
+
+
{!$Label.c.RD2_EnablementDisabledHeader}
@@ -77,7 +78,9 @@
-
{!$Label.c.RD2_EnablementPrepTitle}
+
+
{!$Label.c.RD2_EnablementPrepTitle}
+
From d6932a845dc87566daa6d0c58e3df6fe9a5327d1 Mon Sep 17 00:00:00 2001
From: salesforce-suyash-more
Date: Mon, 1 Jul 2024 14:45:18 +0530
Subject: [PATCH 21/22] Changes in RD2_EnablementDelegateController.js to move
focus
To ensure that focus moves to new content when it updates, changes has been added to the RD2_EnablementDelegateController.js file for the Validate and Run Migration buttons.
---
.../RD2_EnablementDelegateController.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
index 4853052a48e..2bce9583561 100644
--- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
+++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
@@ -28,6 +28,13 @@
helper.handleBatchEvent(component, event, 'v.dryRunBatch');
helper.refreshDryRun(component);
helper.refreshEnable(component);
+ window.setTimeout(function() {
+ var dryRunJob = component.find("dryRun2Job");
+ if (event.Hp.batchProgress.status === "Completed") {
+ dryRunJob.getElement().setAttribute('tabindex', '0');
+ dryRunJob.getElement().focus();
+ }
+ }, 0);
},
handleDryRunError: function (component, event, helper) {
helper.handleBatchError(component, event, 'dryRun');
@@ -44,6 +51,13 @@
handleMigrationStatusChange: function (component, event, helper) {
helper.handleBatchEvent(component, event, 'v.migrationBatch');
helper.refreshMigration(component);
+ window.setTimeout(function() {
+ var migrationJob = component.find("migrationJob");
+ if (event.Hp.batchProgress.status === "Completed") {
+ migrationJob.getElement().setAttribute('tabindex', '0');
+ migrationJob.getElement().focus();
+ }
+ }, 0);
},
handleMigrationError: function (component, event, helper) {
helper.handleBatchError(component, event, 'migration');
From dde36c5675c7c4a366743f53ce94993af1952565 Mon Sep 17 00:00:00 2001
From: salesforce-suyash-more
Date: Tue, 2 Jul 2024 19:36:19 +0530
Subject: [PATCH 22/22] moved focus logic to RD2 _EnablementDelegateHelper.js
added he 'setFocus' method in RD2 _EnablementDelegateHelper.js and invoked it from RD2_EnablementDelegateController.js.
---
.../RD2_EnablementDelegateController.js | 24 +++++++++----------
.../RD2_EnablementDelegateHelper.js | 19 ++++++++++++++-
2 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
index 2bce9583561..06f1524d7e3 100644
--- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
+++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateController.js
@@ -28,13 +28,16 @@
helper.handleBatchEvent(component, event, 'v.dryRunBatch');
helper.refreshDryRun(component);
helper.refreshEnable(component);
- window.setTimeout(function() {
- var dryRunJob = component.find("dryRun2Job");
- if (event.Hp.batchProgress.status === "Completed") {
- dryRunJob.getElement().setAttribute('tabindex', '0');
- dryRunJob.getElement().focus();
+ var status = event.Hp.batchProgress.status;
+ var dryRunJob = component.find("dryRunJob");
+ if (["Completed", "Aborted"].includes(status)) {
+ if(dryRunJob){
+ helper.setFocus(component, 'dryRunJob');
}
- }, 0);
+ else{
+ helper.setFocus(component, 'dryRun2Job');
+ }
+ }
},
handleDryRunError: function (component, event, helper) {
helper.handleBatchError(component, event, 'dryRun');
@@ -51,13 +54,10 @@
handleMigrationStatusChange: function (component, event, helper) {
helper.handleBatchEvent(component, event, 'v.migrationBatch');
helper.refreshMigration(component);
- window.setTimeout(function() {
- var migrationJob = component.find("migrationJob");
- if (event.Hp.batchProgress.status === "Completed") {
- migrationJob.getElement().setAttribute('tabindex', '0');
- migrationJob.getElement().focus();
+ var status = event.Hp.batchProgress.status;
+ if (["Completed", "Aborted"].includes(status)) {
+ helper.setFocus(component, 'migrationJob');
}
- }, 0);
},
handleMigrationError: function (component, event, helper) {
helper.handleBatchError(component, event, 'migration');
diff --git a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js
index 45f96989f3c..9a18f91f260 100644
--- a/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js
+++ b/force-app/main/default/aura/RD2_EnablementDelegate/RD2_EnablementDelegateHelper.js
@@ -599,5 +599,22 @@
hideSpinner: function (component, element) {
var spinner = component.find(element);
$A.util.addClass(spinner, 'slds-hide');
- }
+ },
+ /**
+ * @description: Autofocus
+ */
+ setFocus: function (component, elementId) {
+ window.setTimeout(() => {
+ try { var element = component.find(elementId);
+ if (element) {
+ element.getElement().setAttribute('tabindex', '0');
+ element.getElement().focus();
+ element.getElement().setAttribute('tabindex', '-1');
+ }
+ } catch (error) {
+ console.error('Error setting focus on element:', error);
+
+ }
+ }, 0);
+ }
})