-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCHR-3376: Update T&A Administer Menu Items #325
Merged
mickadoo
merged 3 commits into
PCHR-3162-configurability-changes
from
PCHR-3376-update-permissions
Mar 13, 2018
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,7 +723,7 @@ public function upgrade_1032() { | |
'return' => ['id'], | ||
'name' => ['IN' => ['Probation', 'Activity_Custom_Fields']], | ||
]); | ||
|
||
foreach ($result['values'] as $value) { | ||
civicrm_api3('CustomGroup', 'create', [ | ||
'id' => $value['id'], | ||
|
@@ -734,6 +734,30 @@ public function upgrade_1032() { | |
return TRUE; | ||
} | ||
|
||
/** | ||
* Update permissions and set the weight for the "Tasks" menu item. | ||
* | ||
* @return bool | ||
*/ | ||
public function upgrade_1033() { | ||
$params = ['return' => 'id', 'name' => 'tasksassignments_administer']; | ||
$parentId = (int) civicrm_api3('Navigation', 'getvalue', $params); | ||
$params = ['return' => 'id', 'name' => 'ta_settings']; | ||
$taSettingsId = (int) civicrm_api3('Navigation', 'getvalue', $params); | ||
$permission = 'administer CiviCase'; | ||
|
||
// Update permissions | ||
foreach ([$parentId, $taSettingsId] as $navId) { | ||
$params = ['permission' => $permission, 'id' => $navId]; | ||
civicrm_api3('Navigation', 'create', $params); | ||
} | ||
|
||
// Update parent weight | ||
civicrm_api3('Navigation', 'create', ['id' => $parentId, 'weight' => -97]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can actually update permission and weight of the parentID in one call and the permission of taSettingsId in another call, which means we will call the API two times rather than three. |
||
|
||
return TRUE; | ||
} | ||
|
||
public function uninstall() { | ||
CRM_Core_DAO::executeQuery("DELETE FROM `civicrm_navigation` WHERE name IN ('tasksassignments', 'ta_dashboard_tasks', 'ta_dashboard_documents', 'ta_dashboard_calendar', 'ta_dashboard_keydates', 'tasksassignments_administer', 'ta_settings')"); | ||
CRM_Core_BAO_Navigation::resetNavigation(); | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we just call the Navigation API once to get the ids of the menu's rather than twice?