Sort permittedActivityTypes
authoreileen <emcnaughton@wikimedia.org>
Sun, 12 Jul 2020 10:58:48 +0000 (22:58 +1200)
committereileen <emcnaughton@wikimedia.org>
Sun, 12 Jul 2020 10:58:48 +0000 (22:58 +1200)
When determining whether to add a clause filtering activity types the permitted types
are compared to all types. If all are permitted no clause is needed.

However, without this sort it is incorrectly seeing them as not matching and adding extraneous joins

CRM/Activity/BAO/Activity.php

index cea9b5335563ab4345c81826129bf032bf8e8f11..a4065942ca0985398024d3802cbd6e94b9a0ace2 100644 (file)
@@ -2455,6 +2455,7 @@ INNER JOIN  civicrm_option_group grp ON (grp.id = option_group_id AND grp.name =
       foreach ($types as $type) {
         $permittedActivityTypes[$type['activity_type_id']] = (int) $type['activity_type_id'];
       }
+      asort($permittedActivityTypes);
       Civi::$statics[__CLASS__]['permitted_activity_types'][$userID] = $permittedActivityTypes;
     }
     return Civi::$statics[__CLASS__]['permitted_activity_types'][$userID];