Skip to content

Commit

Permalink
fix: [ANDROAPP-6705] allow future dates
Browse files Browse the repository at this point in the history
Signed-off-by: Manu Muñoz <[email protected]>
  • Loading branch information
mmmateos committed Dec 16, 2024
1 parent fa5d302 commit 8933d80
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions form/src/main/java/org/dhis2/form/ui/FormViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,16 @@ class FormViewModel(
private fun saveLastFocusedItem(rowAction: RowAction) = getLastFocusedTextItem()?.let {
if (previousActionItem == null) previousActionItem = rowAction
if (previousActionItem?.value != it.value && previousActionItem?.id == it.uid) {
val error = checkFieldError(it.valueType, it.value, it.fieldMask)
val error = checkFieldError(it.valueType, it.value, it.fieldMask, it.allowFutureDates)
if (error != null) {
val action = rowActionFromIntent(
FormIntent.OnSave(it.uid, it.value, it.valueType, it.fieldMask),
FormIntent.OnSave(
it.uid,
it.value,
it.valueType,
it.fieldMask,
it.allowFutureDates
),
)
repository.updateErrorList(action)
StoreResult(
Expand All @@ -355,7 +361,13 @@ class FormViewModel(
)
} else {
checkAutoCompleteForLastFocusedItem(it)
val intent = FormIntent.OnSave(it.uid, it.value, it.valueType, it.fieldMask)
val intent = FormIntent.OnSave(
it.uid,
it.value,
it.valueType,
it.fieldMask,
it.allowFutureDates
)
val action = rowActionFromIntent(intent)
val result = repository.save(it.uid, it.value, action.extraData)
repository.updateValueOnList(it.uid, it.value, it.valueType)
Expand Down

0 comments on commit 8933d80

Please sign in to comment.