From a03a6344041230528a36195cc19b2722bfedee80 Mon Sep 17 00:00:00 2001 From: Suyash More Date: Tue, 19 Nov 2024 16:15:35 +0530 Subject: [PATCH 1/4] Replace fieldname with label for 'First installment paid' checkbox Replaced hard-coded fieldname with label for 'First installment paid' checkbox, since batch-Defaults contains field labels as keys --- force-app/main/default/classes/GiftBatch.cls | 2 +- force-app/main/default/lwc/geBatchWizard/geBatchWizard.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/force-app/main/default/classes/GiftBatch.cls b/force-app/main/default/classes/GiftBatch.cls index 8ba4bd57881..6bebe41045a 100644 --- a/force-app/main/default/classes/GiftBatch.cls +++ b/force-app/main/default/classes/GiftBatch.cls @@ -47,7 +47,7 @@ public inherited sharing class GiftBatch implements IGiftBatch { private GiftTemplate giftTemplate; private Boolean shouldPayFirstInstallment = false; - private static final String AllowFirstInstallmentPaid = 'AllowFirstInstallment__f'; + private static final String AllowFirstInstallmentPaid = 'First installment paid'; @TestVisible private GiftBatchSelector giftBatchSelector { diff --git a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js index 3c31935f607..3aa4bc15fcc 100755 --- a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js +++ b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js @@ -131,8 +131,8 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) { if (this.isEditMode && this._allowRecurringDonations) { let batchLevelDefaults = JSON.parse(this.dataImportBatchRecord.fields[DATA_IMPORT_BATCH_DEFAULTS_INFO.fieldApiName].value); - return batchLevelDefaults['AllowFirstInstallment__f'] ? - batchLevelDefaults['AllowFirstInstallment__f'].value : + return batchLevelDefaults['First installment paid'] ? + batchLevelDefaults['First installment paid'].value : false; } From f883e18ad429163aa9864d261204f161ab07838b Mon Sep 17 00:00:00 2001 From: Suyash More Date: Thu, 28 Nov 2024 18:32:01 +0530 Subject: [PATCH 2/4] Removed the hard-coded label to allow for translations of the 'First installment paid' checkbox --- force-app/main/default/classes/GiftBatch.cls | 2 +- force-app/main/default/lwc/geBatchWizard/geBatchWizard.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/force-app/main/default/classes/GiftBatch.cls b/force-app/main/default/classes/GiftBatch.cls index 6bebe41045a..5ea7e71840b 100644 --- a/force-app/main/default/classes/GiftBatch.cls +++ b/force-app/main/default/classes/GiftBatch.cls @@ -47,7 +47,7 @@ public inherited sharing class GiftBatch implements IGiftBatch { private GiftTemplate giftTemplate; private Boolean shouldPayFirstInstallment = false; - private static final String AllowFirstInstallmentPaid = 'First installment paid'; + private static final String AllowFirstInstallmentPaid = Label.get('', 'geRD2FirstInstallmentPaid', UserInfo.getLanguage()); @TestVisible private GiftBatchSelector giftBatchSelector { diff --git a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js index 3aa4bc15fcc..00b3c6c86fd 100755 --- a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js +++ b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js @@ -26,6 +26,7 @@ import { } from 'c/utilCommon'; import GeLabelService from 'c/geLabelService'; import psPaymentGateway from '@salesforce/label/c.psPaymentGateway'; +import geRD2FirstInstallmentPaid from '@salesforce/label/c.geRD2FirstInstallmentPaid'; import getAllFormTemplates from '@salesforce/apex/GE_GiftEntryController.getAllFormTemplates'; import getDonationMatchingValues from '@salesforce/apex/GE_GiftEntryController.getDonationMatchingValues'; @@ -131,8 +132,8 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) { if (this.isEditMode && this._allowRecurringDonations) { let batchLevelDefaults = JSON.parse(this.dataImportBatchRecord.fields[DATA_IMPORT_BATCH_DEFAULTS_INFO.fieldApiName].value); - return batchLevelDefaults['First installment paid'] ? - batchLevelDefaults['First installment paid'].value : + return batchLevelDefaults[geRD2FirstInstallmentPaid] ? + batchLevelDefaults[geRD2FirstInstallmentPaid].value : false; } From 8809a6e3833e0d9d46dd093ac3961af0b3344cd4 Mon Sep 17 00:00:00 2001 From: Suyash More Date: Fri, 29 Nov 2024 19:56:47 +0530 Subject: [PATCH 3/4] Set the namespace parameter to null, allowing it to default to the package namespace --- force-app/main/default/classes/GiftBatch.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/main/default/classes/GiftBatch.cls b/force-app/main/default/classes/GiftBatch.cls index 5ea7e71840b..e27243c5255 100644 --- a/force-app/main/default/classes/GiftBatch.cls +++ b/force-app/main/default/classes/GiftBatch.cls @@ -47,7 +47,7 @@ public inherited sharing class GiftBatch implements IGiftBatch { private GiftTemplate giftTemplate; private Boolean shouldPayFirstInstallment = false; - private static final String AllowFirstInstallmentPaid = Label.get('', 'geRD2FirstInstallmentPaid', UserInfo.getLanguage()); + private static final String AllowFirstInstallmentPaid = Label.get(null, 'geRD2FirstInstallmentPaid', UserInfo.getLanguage()); @TestVisible private GiftBatchSelector giftBatchSelector { From 320654f87bf27a7b97a94db8b417369291977e3d Mon Sep 17 00:00:00 2001 From: Suyash More Date: Fri, 6 Dec 2024 17:38:15 +0530 Subject: [PATCH 4/4] fieldApiName for 'First installment paid' checkbox is stored in Batch_Defaults to avoid translation issue --- force-app/main/default/classes/GiftBatch.cls | 2 +- .../main/default/lwc/geBatchWizard/geBatchWizard.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/force-app/main/default/classes/GiftBatch.cls b/force-app/main/default/classes/GiftBatch.cls index e27243c5255..8ba4bd57881 100644 --- a/force-app/main/default/classes/GiftBatch.cls +++ b/force-app/main/default/classes/GiftBatch.cls @@ -47,7 +47,7 @@ public inherited sharing class GiftBatch implements IGiftBatch { private GiftTemplate giftTemplate; private Boolean shouldPayFirstInstallment = false; - private static final String AllowFirstInstallmentPaid = Label.get(null, 'geRD2FirstInstallmentPaid', UserInfo.getLanguage()); + private static final String AllowFirstInstallmentPaid = 'AllowFirstInstallment__f'; @TestVisible private GiftBatchSelector giftBatchSelector { diff --git a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js index 00b3c6c86fd..f863fc2f98d 100755 --- a/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js +++ b/force-app/main/default/lwc/geBatchWizard/geBatchWizard.js @@ -26,7 +26,6 @@ import { } from 'c/utilCommon'; import GeLabelService from 'c/geLabelService'; import psPaymentGateway from '@salesforce/label/c.psPaymentGateway'; -import geRD2FirstInstallmentPaid from '@salesforce/label/c.geRD2FirstInstallmentPaid'; import getAllFormTemplates from '@salesforce/apex/GE_GiftEntryController.getAllFormTemplates'; import getDonationMatchingValues from '@salesforce/apex/GE_GiftEntryController.getDonationMatchingValues'; @@ -132,8 +131,8 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) { if (this.isEditMode && this._allowRecurringDonations) { let batchLevelDefaults = JSON.parse(this.dataImportBatchRecord.fields[DATA_IMPORT_BATCH_DEFAULTS_INFO.fieldApiName].value); - return batchLevelDefaults[geRD2FirstInstallmentPaid] ? - batchLevelDefaults[geRD2FirstInstallmentPaid].value : + return batchLevelDefaults['AllowFirstInstallment__f'] ? + batchLevelDefaults['AllowFirstInstallment__f'].value : false; } @@ -460,11 +459,16 @@ export default class geBatchWizard extends NavigationMixin(LightningElement) { if (dataImportBatch.apiName === formElement.objectApiName) { dataImportBatch.fields[formElement.fieldApiName] = formElement.value; } else { - batchDefaults[formElement.label] = { + const fieldElementData = { objectApiName: formElement.objectApiName, fieldApiName: formElement.fieldApiName, value: isNotEmpty(formElement.value) ? formElement.value : undefined }; + if (formElement.fieldApiName === 'AllowFirstInstallment__f'){ + batchDefaults[formElement.fieldApiName] = fieldElementData; + } else { + batchDefaults[formElement.label] = fieldElementData; + } } }