From da2eabcbd54ddd9f0294faf0da02c5ed8f59baa1 Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Wed, 29 Nov 2023 14:57:53 +0100 Subject: [PATCH] fix: enrollment date not assigned on init --- .../DataEntries/Enrollment/actions/open.actionBatchs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core_modules/capture-core/components/DataEntries/Enrollment/actions/open.actionBatchs.js b/src/core_modules/capture-core/components/DataEntries/Enrollment/actions/open.actionBatchs.js index 2507d1c474..8e120d4beb 100644 --- a/src/core_modules/capture-core/components/DataEntries/Enrollment/actions/open.actionBatchs.js +++ b/src/core_modules/capture-core/components/DataEntries/Enrollment/actions/open.actionBatchs.js @@ -71,6 +71,7 @@ export const openDataEntryForNewEnrollmentBatchAsync = async ({ const formId = getDataEntryKey(dataEntryId, itemId); const addFormDataActions = addFormData(`${dataEntryId}-${itemId}`, formValues); const firstStageDataEntryPropsToInclude = firstStage && getDataEntryPropsToInclude(firstStage.stageForm); + const defaultDataEntryValues = { enrolledAt: convertDateObjectToDateFormatString(new Date()) }; const dataEntryPropsToInclude = [ ...enrollmentDataEntryPropsToInclude, ...extraDataEntryProps, @@ -88,7 +89,7 @@ export const openDataEntryForNewEnrollmentBatchAsync = async ({ dataEntryId, itemId, dataEntryPropsToInclude, - { enrolledAt: convertDateObjectToDateFormatString(new Date()) }, + defaultDataEntryValues, ); const effects = getApplicableRuleEffectsForTrackerProgram({ @@ -96,6 +97,7 @@ export const openDataEntryForNewEnrollmentBatchAsync = async ({ orgUnit, stage: firstStage, attributeValues: clientValues, + enrollmentData: defaultDataEntryValues, formFoundation, });