Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4757

Inconsistent error messages reported about new patient's age

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: OpenMRS 1.9.2
    • Component/s: None
    • Labels:
      None

      Description

      In PersonValidator.java, it has the following code:
      Calendar c = Calendar.getInstance();
      c.setTime(new Date());
      c.add(Calendar.YEAR, -120);
      if (birthDate.before(c.getTime())) {
      errors.rejectValue("birthdate", "error.date.nonsensical");

      which will show error if the year entered is before current year-120 (i.e., the patient has an age >= 120)

      However, in addPersonForm.jsp, we have:
      if (age.value != "") {
      if (isInteger(age.value) == false)

      { showError("birthdateError"); result = false; } else if (age.value < 0 || age.value > 120) { showError("birthdateError"); result = false; }

      which will show error if age > 120. Therefore when age==120 it will not report any error.

      I request a pull for changing the jsp codes to age.value>=120

        Attachments

          Activity

            People

            • Assignee:
              xiangli2 Xiang Li
              Reporter:
              xiangli2 Xiang Li
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: