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 062a52fbe7..52590e892c 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 @@
-

- OpenRoad +
+ OpenRoad +

{!$Label.c.RD2_EnablementDisabledHeader}

@@ -77,7 +78,9 @@ -

{!$Label.c.RD2_EnablementPrepTitle}

+ +

{!$Label.c.RD2_EnablementPrepTitle}

+
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 4853052a48..06f1524d7e 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,16 @@ helper.handleBatchEvent(component, event, 'v.dryRunBatch'); helper.refreshDryRun(component); helper.refreshEnable(component); + var status = event.Hp.batchProgress.status; + var dryRunJob = component.find("dryRunJob"); + if (["Completed", "Aborted"].includes(status)) { + if(dryRunJob){ + helper.setFocus(component, 'dryRunJob'); + } + else{ + helper.setFocus(component, 'dryRun2Job'); + } + } }, handleDryRunError: function (component, event, helper) { helper.handleBatchError(component, event, 'dryRun'); @@ -44,6 +54,10 @@ handleMigrationStatusChange: function (component, event, helper) { helper.handleBatchEvent(component, event, 'v.migrationBatch'); helper.refreshMigration(component); + var status = event.Hp.batchProgress.status; + if (["Completed", "Aborted"].includes(status)) { + helper.setFocus(component, 'migrationJob'); + } }, 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 45f96989f3..9a18f91f26 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); + } }) diff --git a/force-app/main/default/classes/BDI_DataImportService.cls b/force-app/main/default/classes/BDI_DataImportService.cls index a7b46310d3..46dffa4d66 100644 --- a/force-app/main/default/classes/BDI_DataImportService.cls +++ b/force-app/main/default/classes/BDI_DataImportService.cls @@ -94,9 +94,13 @@ global with sharing class BDI_DataImportService { '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 @@ -619,6 +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; + } + } + } + } + } // do any performance optimizations to avoid unnecessary code disableAllOppRollups(); diff --git a/force-app/main/default/classes/BDI_DataImport_API.cls b/force-app/main/default/classes/BDI_DataImport_API.cls index 3435df5d6c..e373744b0d 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 02055ffab6..d11d68bc26 100644 --- a/force-app/main/default/classes/GiftBatchForQueueable.cls +++ b/force-app/main/default/classes/GiftBatchForQueueable.cls @@ -149,10 +149,17 @@ 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); } + 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/GiftBatchService_TEST.cls b/force-app/main/default/classes/GiftBatchService_TEST.cls index 3a2ee3c627..cb1ea23c17 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'); diff --git a/force-app/main/default/classes/GiftEntryProcessorQueue.cls b/force-app/main/default/classes/GiftEntryProcessorQueue.cls index c470c44ae3..6599551d38 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) { @@ -64,7 +66,10 @@ public with sharing class GiftEntryProcessorQueue implements Queueable, Database queueableGiftBatch.captureElevateBatches(); queueableGiftBatch.updateGiftsInChunk(); queueableGiftBatch.preprocessRecurringGifts(); - queueableGiftBatch.processChunk(); + 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()) { diff --git a/force-app/main/default/labels/CustomLabels.labels-meta.xml b/force-app/main/default/labels/CustomLabels.labels-meta.xml index 1ddb49a99d..70d5aacec3 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_US true Message 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 diff --git a/force-app/main/default/lwc/batchProgress/batchProgress.html b/force-app/main/default/lwc/batchProgress/batchProgress.html index 0c9ebd6d1c..7adc593fc7 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}