From fc047037cb03502b917ab0991d038d6d838b2577 Mon Sep 17 00:00:00 2001 From: p-upadhyay_sfemu Date: Wed, 8 May 2024 18:18:16 +0530 Subject: [PATCH] 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();