orderentryui - provider is undefined in order-entry.js

@mksd , I think the confusion may be what Mike mentioned in his first reply to you (but I will expand, because it’s not obvious).

Prior to OpenMRS 1.9, you indicated that a user was a provider by giving the “Provider” Role to that User. This is what you are showing in the REST result. However things changed in OpenMRS 1.9, and the code no longer looks for this.

Since OpenMRS 1.9 there is a Provider domain object, which is not directly linked to User. Rather a Person can have 0…n User accounts, and 0…n Provider accounts. The Reference Application does some simple logic that you can see here:


You need to make sure that the currently-logged in user has a Provider account, i.e. that the user’s person has a matching row in the provider table.

In the REST response you should be seeing a “currentProvider” property, as generated here:

Does this make sense?

*** = I notice one possible bug: the UiSessionContext constructor code uses the VIEW_PROVIDERS proxy privilege, which could be buggy if the appui module was compiled against OpenMRS < 1.11, but is run against 1.11+ (however looking further, this should be okay, since appui inherits its versions from the distro, so it should be building against the same openmrs-core version).