Contact Logging Detail report can crash if it tries to query change records from log tables that don't have a contact_id field
There might be a couple issues so trying to collect some info.
CRM_Logging_Differ has both diffsInTable and diffsInTableForId. When CRM_Report_Form_Contact_LoggingDetail starts up it calls the second one. If that succeeds in getting some rows, which is usually the case, it never calls diffsInTable, but if it returns 0 rows then in CRM_Logging_ReportDetail::buildRows it tries again using diffsInTable. That's when the crash can occur. However, the only way at the moment I can reproduce this situation is when the first run of diffsInTableForId hits this line regarding updates which is never supposed to happen. But I do seem to have some such data, I just don't know how.
- So one issue might be how is this data happening.
- A second issue is why are there two functions that do things differently for this report depending on when they get called.
- A third issue is if diffsInTable is necessary, the
switchmight be replaceable with data collected via DAO::referenceColumns() which happens early on in CRM_Report_Form_Contact_LoggingDetail but then that part of the info is discarded at this point so would need to be kept or looked up again.