Display error instead of fatal error when trying to view a case that you don't have permission to access #13505
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.
Overview
The fatal error page is not user-friendly and suggests something has gone wrong with the system - it is also deprecated. In this case the fatal error page is shown if you click "Manage" on a case which you don't have permission to access - this PR changes that to
statusBounce()
so the user remains on the case dashboard and is shown an error popup instead.Before
Fatal error page when trying to access case from dashboard with filter set to "All cases" and clicking "Manage" on a case that you do not have access to.
After
"Friendly error" when trying to access case from dashboard with filter set to "All cases" and clicking "Manage" on a case that you do not have access to.
![portal gaddumcentre co uk_civicrm_case_reset 1](https://user-images.githubusercontent.com/2052161/51744842-fd66c780-2098-11e9-8c1e-874b0bdc33a9.png)
Technical Details
In general swapping
CRM_Core_Error::fatal()
forCRM_Core_Error::statusBounce()
is ok for forms when something "normal" is happening. An SQL query failure for example you might expect to see the fatal error screen as that is not a "normal" situation.Comments