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

252 Release #7240

Merged
merged 31 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1ff3fb0
Commit -- BDI_DataImport_BATCH is queued on GE Processor Queue
enzigma-pratishtha-upadhyay Mar 29, 2024
7d9107c
commit -- Gift Entry - process - batch- fixes
enzigma-pratishtha-upadhyay Apr 4, 2024
c79af4e
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay Apr 8, 2024
743fd08
Revert "Update BDI_DataImportService.cls"
enzigma-pratishtha-upadhyay Apr 8, 2024
4585e8d
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay Apr 10, 2024
ac63dcb
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay Apr 10, 2024
1d43b58
Update GiftBatchService_TEST.cls
enzigma-pratishtha-upadhyay Apr 11, 2024
073ae35
Update GiftEntryProcessorQueue.cls
enzigma-pratishtha-upadhyay Apr 15, 2024
34ace95
Merge 234d8f9fd980a7837048c99b2ac67bcb57b1c9a2 into feature/238
salesforce-org-metaci[bot] Apr 17, 2024
829ccd8
Merge 34ace95c7e31108586d2e47242ce0b36ac3074f5 into feature/252
salesforce-org-metaci[bot] Apr 17, 2024
1caa6ed
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay Apr 25, 2024
a76bdfa
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay Apr 26, 2024
cb3e71c
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay May 2, 2024
fc04703
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay May 8, 2024
34c33d5
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay May 9, 2024
10e76c6
Update GiftEntryProcessorQueue_TEST.cls
enzigma-pratishtha-upadhyay May 9, 2024
b4779d9
Update GiftEntryProcessorQueue_TEST.cls
enzigma-pratishtha-upadhyay May 10, 2024
afdd2b5
Update BDI_DataImportService.cls
enzigma-pratishtha-upadhyay May 10, 2024
594f62c
Minor formating fixes
lparrott May 13, 2024
d6c12e3
Merge pull request #7232 from SalesforceFoundation/feature/250__field…
daniel-fuller May 14, 2024
6c69ebb
changes to mark 'Upgrade process complete' in a headings tag
salesforce-suyash-more Jun 26, 2024
fef85cb
Changes to mark 'Data Migration Run' in a explicit heading tag
salesforce-suyash-more Jun 26, 2024
96368d7
Changes in RD2_EnablementDelegate.cmp to maintain well-formed markup …
salesforce-suyash-more Jun 26, 2024
d6932a8
Changes in RD2_EnablementDelegateController.js to move focus
salesforce-suyash-more Jul 1, 2024
9b9096f
Merge pull request #7237 from SalesforceFoundation/feature/252__W-953…
ptewson-sfdo Jul 1, 2024
b8dbc59
Merge 9b9096f75310a8ee95bb35ffb5dcf73c6cef6a53 into feature/252__W-95…
salesforce-org-metaci[bot] Jul 1, 2024
9a1ab8a
Merge 9b9096f75310a8ee95bb35ffb5dcf73c6cef6a53 into feature/252__W-95…
salesforce-org-metaci[bot] Jul 1, 2024
dde36c5
moved focus logic to RD2 _EnablementDelegateHelper.js
salesforce-suyash-more Jul 2, 2024
7fa0bb8
Merge pull request #7238 from SalesforceFoundation/feature/252__W-953…
ptewson-sfdo Jul 2, 2024
784c9b5
Merge 7fa0bb82026c9035875ee04e70b9a0142b566dff into feature/252__W-95…
salesforce-org-metaci[bot] Jul 2, 2024
f76a09b
Merge pull request #7239 from SalesforceFoundation/feature/252__W-953…
ptewson-sfdo Jul 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
<lightning:layout horizontalAlign="spread" multipleRows="true" class="slds-hide" aura:id="enablementDisabled">
<lightning:layoutItem padding="horizontal-large" size="10">
<div class="slds-illustration slds-illustration_large">
<br /><br />
<img src="/img/chatter/OpenRoad.svg" class="slds-illustration__svg" alt="OpenRoad" />
<div class="slds-m-vertical_medium">
<img src="/img/chatter/OpenRoad.svg" class="slds-illustration__svg" alt="OpenRoad" />
</div>
<div class="slds-text-longform">
<h3 class="slds-text-heading_medium">{!$Label.c.RD2_EnablementDisabledHeader}</h3>
<p>
Expand All @@ -77,7 +78,9 @@

<lightning:layoutItem padding="horizontal-large" class="slds-p-top_large" size="12">
<lightning:layout multipleRows="true">
<h2 class="title slds-text-heading_small">{!$Label.c.RD2_EnablementPrepTitle}</h2>
<lightning:layoutItem size="12">
<h2 class="title slds-text-heading_small">{!$Label.c.RD2_EnablementPrepTitle}</h2>
</lightning:layoutItem>
<lightning:layoutItem class="slds-p-top_small" size="12">
<lightning:formattedRichText class="slds-text-longform"
value="{!$Label.c.RD2_EnablementPrepIntro}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})
25 changes: 24 additions & 1 deletion force-app/main/default/classes/BDI_DataImportService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ global with sharing class BDI_DataImportService {
'Status__c != \'' + BDI_DataImport_API.bdiImported + '\'',
'Id =: dataImportIds'
};
List<String> selectClause = new List<String>{
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
Expand Down Expand Up @@ -619,6 +623,25 @@ global with sharing class BDI_DataImportService {

this.listDI = checkRDFields(listDI);

if (apexJobId != null && listDI.size() > 0) {
List<DataImportBatch__c> 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();

Expand Down
22 changes: 22 additions & 0 deletions force-app/main/default/classes/BDI_DataImport_API.cls
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,28 @@ global with sharing class BDI_DataImport_API {
return apexJobId;
}

global static Id processDataImportRecords(Data_Import_Settings__c diSettings,
List<Id> 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()
*/
Expand Down
9 changes: 8 additions & 1 deletion force-app/main/default/classes/GiftBatchForQueueable.cls
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,17 @@ public inherited sharing class GiftBatchForQueueable {

public void processChunk() {
List<DataImport__c> dataImports = gifts.asDataImports();
BDI_DataImport_API.processDataImportRecords(dataImportSettings, dataImports, false);
List<Id> lstDataImportIds = new List<Id>(new Map<Id, DataImport__c>(dataImports).keySet());
BDI_DataImport_API.processDataImportRecords(dataImportSettings, lstDataImportIds, false);
chunkedIds.remove(0);
}

public void processChunk(Id batchId) {
List<DataImport__c> dataImports = gifts.asDataImports();
List<Id> lstDataImportIds = new List<Id>(new Map<Id, DataImport__c>(dataImports).keySet());
BDI_DataImport_API.processDataImportRecords(dataImportSettings, lstDataImportIds, false, batchId);
chunkedIds.remove(0);
}
public void chunkGiftsThatCanBeProcessed() {
List<SObject> results = giftsSelector.getGiftsReadyToMoveToProcessing(giftBatchId);
if (results.size() > 0) {
Expand Down
4 changes: 3 additions & 1 deletion force-app/main/default/classes/GiftBatchService_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion force-app/main/default/classes/GiftEntryProcessorQueue.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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()) {
Expand Down
8 changes: 4 additions & 4 deletions force-app/main/default/labels/CustomLabels.labels-meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2152,15 +2152,15 @@
<language>en_US</language>
<protected>true</protected>
<shortDescription>Message displayed on a successful migration</shortDescription>
<value>&lt;b&gt;Upgrade process complete!&lt;/b&gt;&lt;br/&gt;
&lt;br/&gt;Before your organization starts using Enhanced Recurring Donations:&lt;br/&gt;
&lt;ul&gt;&lt;li&gt;Turn on workflows, processes, validation rules and triggers that you disabled prior to upgrade.&lt;/li&gt;
<value>&lt;h4&gt;Upgrade process complete!&lt;/h4&gt;
&lt;p&gt;Before your organization starts using Enhanced Recurring Donations:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Turn on workflows, processes, validation rules, and triggers that you disabled prior to upgrade.&lt;/li&gt;
&lt;li&gt;Assign the Enhanced Recurring Donations page layout to all user profiles and remove the old Recurring Donations page layout.&lt;/li&gt;
&lt;li&gt;Assign the NPSP Recurring Donation Lightning record page as the Org Default.&lt;/li&gt;
&lt;li&gt;Assign the RD2_VisualizeScheduleController Apex class to your custom profiles.&lt;/li&gt;
&lt;li&gt;Adjust field-level security for Recurring Donations fields as necessary for your profiles and permission sets.&lt;/li&gt;
&lt;li&gt;Adjust Recurring Donations reports to work with Enhanced Recurring Donations.&lt;/li&gt;
&lt;li&gt;Educate your staff about Enhanced Recurring Donations.&lt;/li&gt;</value>
&lt;li&gt;Educate your staff about Enhanced Recurring Donations.&lt;/li&gt;&lt;/ul&gt;</value>
</labels>
<labels>
<fullName>RD2_EnablementMigrationErrorMessage</fullName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<lightning-layout-item size="8">
<div title={title}>
<span class="slds-truncate"><strong>{title}</strong></span>
<span class="slds-truncate"><h2><strong>{title}</strong></h2></span>
</div>
</lightning-layout-item>

Expand Down
Loading