Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4
-
Fix Version/s: 3.4.5
-
Component/s: Core CiviCRM
-
Labels:None
Description
we ran into an issue where a contact had about 45 activities connected to their record, but when they viewed the activity tab, none would show up. it turned out the problem was a result of also having a large number of case activities (>500). here's why:
CRM_Activity_BAO_Activity::getActivities()
...retrieves a contacts activities in the following way:
1) build temp table for activities where the contact is source
2) build temp table for activities where the contact is target
3) build temp table for activities where the contact is assignee
4) combine all three temp tables
5) exclude case activities
the problem was that we apply the limit clause to the first step (contact as source). so when the final combination takes place – after excluding case activities – we are working with a small subset of the total activities, which is then passed to the display. in the case of this contact, it just so happened that the 50 records pulled from each temp table were all case activities, resulting in an empty set passed to the browser.
I believe the limit clause should only be applied to the final combination query. see attached patch.