Disallowed checking out components to different companies and fixed number remaining counts #15229
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.
Description
This PR fixes two issues when full multiple company support was enabled:
The scenario in pictures...
Two companies with the ids of 9 and 10:
Two components, one for each company:
Three assets assigned to three companies, including one that is not associated with a component above:
The
component_assets
table that shows components assigned to assets.Acting as a super admin I can accurately see the remaining counts before and after this PR:
But as an admin for Company A (id:9) I see there are 4 remaining (should be 2):
After this PR the user sees the correct amount:
In addition, we can no longer check out a component to an asset that is not part of the same company when FMCS is enabled:
Should address the issues mentioned in #15212.
Fixes #15212
Type of change