Skip to content

Commit

Permalink
fix: [ANDROAPP-6707] Unable to complete event (#3930)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balcan authored Dec 18, 2024
1 parent fe8afe2 commit bbb2ccd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions form/src/main/java/org/dhis2/form/ui/FormView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import org.dhis2.ui.ErrorFieldList
import org.dhis2.ui.dialogs.bottomsheet.BottomSheetDialog
import org.dhis2.ui.dialogs.bottomsheet.BottomSheetDialogUiModel
import org.dhis2.ui.dialogs.bottomsheet.FieldWithIssue
import org.dhis2.ui.dialogs.bottomsheet.IssueType
import org.hisp.dhis.android.core.arch.helpers.FileResourceDirectoryHelper
import org.hisp.dhis.android.core.common.ValueType
import org.hisp.dhis.android.core.common.ValueTypeRenderingType
Expand Down Expand Up @@ -467,9 +466,7 @@ class FormView : Fragment() {
isEventCompleted: Boolean,
bottomSheetDialog: BottomSheetDialog,
) {
val errorsInField =
fieldsWithIssues.isNotEmpty() || fieldsWithIssues.any { it.issueType == IssueType.ERROR }
if (errorsInField) {
if (fieldsWithIssues.any { it.issueType.shouldShowError() }) {
bottomSheetDialog.dismiss()
} else if (isEventCompleted) {
onFinishDataEntry?.invoke()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ enum class IssueType {
WARNING,
ERROR_ON_COMPLETE,
WARNING_ON_COMPLETE,
;

fun shouldShowError() = this == ERROR || this == ERROR_ON_COMPLETE || this == MANDATORY
}

0 comments on commit bbb2ccd

Please sign in to comment.