CRM-19832: Backporting #9637 to 4.6
authoromar abu hussein <opetmar91@gmail.com>
Thu, 5 Jan 2017 10:03:03 +0000 (10:03 +0000)
committeromar abu hussein <opetmar91@gmail.com>
Thu, 5 Jan 2017 11:06:28 +0000 (11:06 +0000)
CRM/Activity/Task.php
CRM/Campaign/Task.php
CRM/Case/Task.php
CRM/Contribute/Task.php
CRM/Event/Task.php
CRM/Grant/Task.php
CRM/Member/Task.php
CRM/Pledge/Task.php

index 1a07d53b155a509a41988ca1286189425136a688..1a4e20ffc7aba7c469fe97a2207e1863097e7c30 100644 (file)
@@ -137,9 +137,11 @@ class CRM_Activity_Task {
       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;
   }
 
index 033772253c905961e6b688e4e77d5f3fb492f32c..642577c609be42a7838baace56a3fe69ac649597 100755 (executable)
@@ -94,11 +94,10 @@ class CRM_Campaign_Task {
           '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;
   }
index 0b6205fd43be148afd2606b0473762b7649002bc..7cd4726483fdf127bc9ca503001a766c9c064785 100644 (file)
@@ -93,10 +93,11 @@ class CRM_Case_Task {
       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;
   }
 
index d4d095a46d8c305738492170eb168306dbbbdf6e..b4c6a5dcdf451bbf43162e450512dffb2aef9b61 100644 (file)
@@ -133,6 +133,7 @@ class CRM_Contribute_Task {
       if (!$invoicing) {
         unset(self::$_tasks[9]);
       }
+
       CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
       asort(self::$_tasks);
     }
index fcf13dd9173fe3159f022756cc38a8a333a9f406..8df11e500d8f80faaf1515b055adccd3507412bc 100644 (file)
@@ -140,10 +140,11 @@ class CRM_Event_Task {
       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);
+      asort(self::$_tasks);
     }
 
-    CRM_Utils_Hook::searchTasks('event', self::$_tasks);
-    asort(self::$_tasks);
     return self::$_tasks;
   }
 
index c08bc27714abea1f127d21ec1b4dda1961aba498..8b3d72660410055ecc5d848a5c292b9802ad4a78 100644 (file)
@@ -89,12 +89,15 @@ class CRM_Grant_Task {
           '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;
   }
 
index 19bc954e984f9480896a203bec37af38ba9e8992..f9321ddf77dad809a7183590aa89d8ab2aab1c52 100644 (file)
@@ -119,9 +119,11 @@ class CRM_Member_Task {
       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;
   }
 
index 4d166216892465bb60d3ae3b9c8ebe7dd88632b4..75330fd0cf161bcc78c2f0cdbb9e73f023441bc5 100644 (file)
@@ -89,9 +89,11 @@ class CRM_Pledge_Task {
       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;
   }