Uploaded image for project: 'HTML Form Entry Module'
  1. HTML Form Entry Module
  2. HTML-593

PatientDetailSubmissionElement fails to validate patient identifiers

    Details

    • Type: Bug
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: HTML Form Entry 2.4
    • Fix Version/s: HTML Form Entry 2.5
    • Labels:
      None
    • Complexity:
      Low

      Description

      PatientDetailSubmissionElement fails to create the appropriate submission error when an attempt is made to use a patient identifier that's already in use.

      In line 515 of PatientDetailSubmissionElement.java https://github.com/openmrs/openmrs-module-htmlformentry/blob/master/api/src/main/java/org/openmrs/module/htmlformentry/element/PatientDetailSubmissionElement.java#L515, the validateIdentifier method is called as follows:

      validateIdentifier(Integer.getInteger(identifierTypeId), identifierValue);

      Looking at the documentation for Integer.getInteger here: https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#getInteger(java.lang.String), I am persuaded that this was NOT the intention of the original author. I think something like Integer.valueOf or Integer.parseInt was intended instead.

      As it is now, Integer.getInteger(identifierTypeId) will sometimes (probably always) return null even when there does indeed exist an identifier type with the given ID.

      Mark Goodrich, I am happy to fix the issue and submit a PR.

        Attachments

          Activity

            People

            • Assignee:
              mogoodrich Mark Goodrich
              Reporter:
              gitahi86 Gitahi Ng'ang'a
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: