Skip to content

Commit

Permalink
Update BDI_DataImportService.cls
Browse files Browse the repository at this point in the history
  • Loading branch information
enzigma-pratishtha-upadhyay committed May 8, 2024
1 parent cb3e71c commit fc04703
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions force-app/main/default/classes/BDI_DataImportService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit fc04703

Please sign in to comment.