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

EncounterService.getEncounters should use Person not User for providers

    XMLWordPrintable

    Details

    • Complexity:
      Low

      Description

      When troubleshooting a bug, we came across an apparent bug in the 1.7.x and 1.8.x releases. The getEncounters method in HibernateEncounterDAO.java, passes in Collection<User> providers. However, providers are actually persons in the encounter table so the following code is passing in the wrong ids:

      if (providers != null && providers.size() > 0) {
        crit.add(Expression.in("provider", providers));
      }
      

      Instead of passing a list of person ids, like it should, it is passing a list of user ids. As of version 1.7.x, I believe, User no longer extended Person, so the user_id and person_id were no longer guaranteed to be the same. The fix for this issue, I believe, is to change the method so the parameter is Collection<Person> providers. Since, according to the wiki, 1.7.x and 1.8.x are both still support versions, bug fixes needs to be backported to these two versions.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            tmdugan Tammy Dugan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: