Don't crash when all action tasks are disabled #20940
Closed
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
This was found following release 1.2 of exportpermissions extension which supports disabling export/print/pdf/labels tasks. It turns out that disabling all of these can cause the advanced search to fail because some "modules" do not have any search tasks - see progressivetech/net.ourpowerbase.exportpermission#6.
Specifically Activities and Mailings trigger a "Network error" because when there are no tasks defined a "null" page gets added which then triggers a
require_once('.php')
here https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Controller.php#L452 because$className
is not defined.Before
When a search task has no actions (eg. Activity, Mailings) and it is expanded in Advanced Search it crashes.
After
All tasks can be disabled and everything continues working!
Technical Details
Explained above. Most of the task code changes here are fixing PHP notices - the change in CRM/Contact/StateMachine/Search.php is what stops the crash.
Comments