diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts index d9a2c7b43f..513922528e 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts @@ -3518,14 +3518,13 @@ export class AddEditExpensePage implements OnInit { const isAdvanceWalletEnabled = res.orgSettings?.advances?.advance_wallets_enabled; let customProperties = res.customProperties; customProperties = customProperties.map((customProperty) => { + if (!customProperty.value) { + this.customFieldsService.setDefaultValue(customProperty, customProperty.type); + } if (customProperty.type === 'DATE') { customProperty.value = customProperty.value ? this.dateService.getUTCDate(new Date(customProperty.value as string)) : null; - } else if (customProperty.type === 'LOCATION' && !customProperty.value) { - customProperty.value = {}; - } else if (customProperty.type === 'BOOLEAN' && !customProperty.value) { - customProperty.value = false; } return customProperty; }); diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts index eeade6fa19..c784bba396 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.setup.spec.ts @@ -103,7 +103,10 @@ describe('AddEditExpensePage', () => { 'addExpenses', ]); const customInputsServiceSpy = jasmine.createSpyObj('CustomInputsService', ['getAll', 'filterByCategory']); - const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', ['standardizeCustomFields']); + const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', [ + 'standardizeCustomFields', + 'setDefaultValue', + ]); const transactionServiceSpy = jasmine.createSpyObj('TransactionService', [ 'delete', 'getRemoveCardExpenseDialogBody', diff --git a/src/app/fyle/add-edit-mileage/add-edit-mileage.page.setup.spec.ts b/src/app/fyle/add-edit-mileage/add-edit-mileage.page.setup.spec.ts index 176123e784..b529d6704b 100644 --- a/src/app/fyle/add-edit-mileage/add-edit-mileage.page.setup.spec.ts +++ b/src/app/fyle/add-edit-mileage/add-edit-mileage.page.setup.spec.ts @@ -108,7 +108,10 @@ describe('AddEditMileagePage', () => { const advanceWalletsServiceSpy = jasmine.createSpyObj('AdvanceWalletsService', ['getAllAdvanceWallets']); const spenderServiceSpy = jasmine.createSpyObj('SpenderService', ['get', 'post']); const customInputsServiceSpy = jasmine.createSpyObj('CustomInputsService', ['getAll', 'filterByCategory']); - const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', ['standardizeCustomFields']); + const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', [ + 'standardizeCustomFields', + 'setDefaultValue', + ]); const transactionServiceSpy = jasmine.createSpyObj('TransactionService', [ 'delete', 'getRemoveCardExpenseDialogBody', diff --git a/src/app/fyle/add-edit-mileage/add-edit-mileage.page.ts b/src/app/fyle/add-edit-mileage/add-edit-mileage.page.ts index 7f0044cc4c..f13f959c9f 100644 --- a/src/app/fyle/add-edit-mileage/add-edit-mileage.page.ts +++ b/src/app/fyle/add-edit-mileage/add-edit-mileage.page.ts @@ -2415,6 +2415,9 @@ export class AddEditMileagePage implements OnInit { const formValue = this.getFormValues(); let customProperties = res.customProperties; customProperties = customProperties?.map((customProperty) => { + if (!customProperty.value) { + this.customFieldsService.setDefaultValue(customProperty, customProperty.type); + } if (customProperty.type === 'DATE') { customProperty.value = customProperty.value && this.dateService.getUTCDate(new Date(customProperty.value as string)); diff --git a/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.setup.spec.ts b/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.setup.spec.ts index 185bebd754..9334bd1d5d 100644 --- a/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.setup.spec.ts +++ b/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.setup.spec.ts @@ -57,7 +57,10 @@ describe('AddEditPerDiemPage', () => { ]); const perDiemServiceSpy = jasmine.createSpyObj('PerDiemService', ['getRates', 'getAllowedPerDiems']); const customInputsServiceSpy = jasmine.createSpyObj('CustomInputsService', ['getAll', 'filterByCategory']); - const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', ['standardizeCustomFields']); + const customFieldsServiceSpy = jasmine.createSpyObj('CustomFieldsService', [ + 'standardizeCustomFields', + 'setDefaultValue', + ]); const currencyServiceSpy = jasmine.createSpyObj('CurrencyService', [ 'getHomeCurrency', 'getAmountWithCurrencyFraction', diff --git a/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.ts b/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.ts index ee9a115bfe..2dae6ea4c5 100644 --- a/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.ts +++ b/src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.ts @@ -1697,6 +1697,9 @@ export class AddEditPerDiemPage implements OnInit { const isAdvanceWalletEnabled = res.orgSettings?.advances?.advance_wallets_enabled; let customProperties = res.customProperties; customProperties = customProperties.map((customProperty) => { + if (!customProperty.value) { + this.customFieldsService.setDefaultValue(customProperty, customProperty.type); + } if (customProperty.type === 'DATE') { customProperty.value = customProperty.value && this.dateService.getUTCDate(new Date(customProperty.value as string));