Repository navigation
Scope billing data to the locations a user is allowed - #3
Open
drizzentic wants to merge 1 commit into
Open
drizzentic wants to merge 1 commit into
drizzentic wants to merge 1 commit into
Conversation
Adds billing_locationBasedBillingFilter, a hibernate filter declared on the billing mappings and enabled per session by the datafilter module, which it discovers through filters/hibernate/billing_location.json. Bills and everything hanging off them are scoped through the location of the cash point they were created at, which is what BillSearch.locationUuid already filters on, and billable services, billable drugs and their prices through their own location. A catalogue entry with no location is global and stays visible everywhere, the way the includeGlobal searches and the billing strategies' fallback treat it. Which locations a user is allowed is not decided here: the allowedlocation module resolves them from the allowed_location user property it also scopes the login location picker with, so one user property and one set of allowedlocation.* global properties drive both. The only setting added here is billing.dataFilter.enabled, which defaults to false, so an existing installation behaves exactly as it did until an administrator turns it on. datafilter and allowedlocation are provided-scope dependencies, kept off the test classpath: datafilter's BeanFactoryPostProcessor is picked up by core's component scan of org.openmrs, so its presence alone would enable the filter in every context sensitive test while no module is started to register the listener that sets its parameter, and hibernate rejects the next query on an enabled filter whose parameter is unset. BillingLocationFilterTest enables the filter on the session itself instead, which needs neither module. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds billing_locationBasedBillingFilter, a hibernate filter declared on the billing mappings and enabled per session by the datafilter module, which it discovers through filters/hibernate/billing_location.json. Bills and everything hanging off them are scoped through the location of the cash point they were created at, which is what BillSearch.locationUuid already filters on, and billable services, billable drugs and their prices through their own location. A catalogue entry with no location is global and stays visible everywhere, the way the includeGlobal searches and the billing strategies' fallback treat it.
Which locations a user is allowed is not decided here: the allowedlocation module resolves them from the allowed_location user property it also scopes the login location picker with, so one user property and one set of allowedlocation.* global properties drive both. The only setting added here is billing.dataFilter.enabled, which defaults to false, so an existing installation behaves exactly as it did until an administrator turns it on.
datafilter and allowedlocation are provided-scope dependencies, kept off the test classpath: datafilter's BeanFactoryPostProcessor is picked up by core's component scan of org.openmrs, so its presence alone would enable the filter in every context sensitive test while no module is started to register the listener that sets its parameter, and hibernate rejects the next query on an enabled filter whose parameter is unset. BillingLocationFilterTest enables the filter on the session itself instead, which needs neither module.