Skip to content

Commit

Permalink
Merge pull request #9637 from omarabuhussein/CRM-19832-searchtask-hook
Browse files Browse the repository at this point in the history
CRM-19832: Ensure that searchTasks hook get invoked once
  • Loading branch information
colemanw authored Jan 11, 2017
2 parents f044c46 + 4d73a5a commit 1158b3d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 19 deletions.
6 changes: 4 additions & 2 deletions CRM/Activity/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ public static function &tasks() {
if (!CRM_Core_Permission::check('delete activities')) {
unset(self::$_tasks[1]);
}

CRM_Utils_Hook::searchTasks('activity', self::$_tasks);
asort(self::$_tasks);
}
CRM_Utils_Hook::searchTasks('activity', self::$_tasks);
asort(self::$_tasks);

return self::$_tasks;
}

Expand Down
7 changes: 3 additions & 4 deletions CRM/Campaign/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ public static function &tasks() {
'result' => FALSE,
),
);
}

CRM_Utils_Hook::searchTasks('campaign', self::$_tasks);

asort(self::$_tasks);
CRM_Utils_Hook::searchTasks('campaign', self::$_tasks);
asort(self::$_tasks);
}

return self::$_tasks;
}
Expand Down
6 changes: 4 additions & 2 deletions CRM/Case/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ public static function &tasks() {
'result' => FALSE,
),
);

//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete in CiviCase')) {
unset(self::$_tasks[1]);
}

CRM_Utils_Hook::searchTasks('case', self::$_tasks);
asort(self::$_tasks);
}

CRM_Utils_Hook::searchTasks('case', self::$_tasks);
asort(self::$_tasks);
return self::$_tasks;
}

Expand Down
1 change: 1 addition & 0 deletions CRM/Contribute/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public static function tasks() {
if (!$invoicing) {
unset(self::$_tasks[9]);
}

CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
asort(self::$_tasks);
}
Expand Down
4 changes: 2 additions & 2 deletions CRM/Event/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ public static function &tasks() {
if (!CRM_Core_Permission::check('edit event participants')) {
unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]);
}
}

CRM_Utils_Hook::searchTasks('event', self::$_tasks);
CRM_Utils_Hook::searchTasks('event', self::$_tasks);
}

return self::$_tasks;
}
Expand Down
13 changes: 8 additions & 5 deletions CRM/Grant/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ public static function &tasks() {
'result' => FALSE,
),
);

if (!CRM_Core_Permission::check('delete in CiviGrant')) {
unset(self::$_tasks[1]);
}

CRM_Utils_Hook::searchTasks('grant', self::$_tasks);
asort(self::$_tasks);
}
if (!CRM_Core_Permission::check('delete in CiviGrant')) {
unset(self::$_tasks[1]);
}
CRM_Utils_Hook::searchTasks('grant', self::$_tasks);
asort(self::$_tasks);

return self::$_tasks;
}

Expand Down
6 changes: 4 additions & 2 deletions CRM/Member/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ public static function &tasks() {
if (!CRM_Core_Permission::check('edit memberships')) {
unset(self::$_tasks[5]);
}

CRM_Utils_Hook::searchTasks('membership', self::$_tasks);
asort(self::$_tasks);
}
CRM_Utils_Hook::searchTasks('membership', self::$_tasks);
asort(self::$_tasks);

return self::$_tasks;
}

Expand Down
6 changes: 4 additions & 2 deletions CRM/Pledge/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ public static function &tasks() {
if (!CRM_Core_Permission::check('delete in CiviPledge')) {
unset(self::$_tasks[1]);
}

CRM_Utils_Hook::searchTasks('pledge', self::$_tasks);
asort(self::$_tasks);
}
CRM_Utils_Hook::searchTasks('pledge', self::$_tasks);
asort(self::$_tasks);

return self::$_tasks;
}

Expand Down

0 comments on commit 1158b3d

Please sign in to comment.