Details
-
Type: Bug
-
Status: Open
-
Priority: Trivial
-
Resolution: Unresolved
-
Affects Version/s: 4.7.10
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
Steps to reproduce on dmaster:
1. Enable logging (to create log_tables)
2. Disable logging
3. Create new contact
4. Enable logging
5. Modify contact
6. Go to Change Log and try to view the first details for the first update
Backtrace:
#0 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Error.php(182): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/drupal/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/drupal/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#4 /var/www/drupal/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#5 /var/www/drupal/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...", "DB_Error", TRUE)
#6 /var/www/drupal/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'contact_id' in 'where clause'")
#7 /var/www/drupal/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /var/www/drupal/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#9 /var/www/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(2438): DB_common->query("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#10 /var/www/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php(1627): DB_DataObject->_query("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#11 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(335): DB_DataObject->query("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...")
#12 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(1268): CRM_Core_DAO->query("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...", TRUE)
#13 /var/www/drupal/sites/all/modules/civicrm/CRM/Logging/Differ.php(159): CRM_Core_DAO::executeQuery("\nSELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt\n\nWHERE lt.log...", (Array:2))
#14 /var/www/drupal/sites/all/modules/civicrm/CRM/Logging/ReportDetail.php(172): CRM_Logging_Differ->diffsInTable("civicrm_batch", "216778")
#15 /var/www/drupal/sites/all/modules/civicrm/CRM/Logging/ReportDetail.php(159): CRM_Logging_ReportDetail->diffsInTable("civicrm_batch")
#16 /var/www/drupal/sites/all/modules/civicrm/CRM/Logging/ReportDetail.php(144): CRM_Logging_ReportDetail->getDiffs()
#17 /var/www/drupal/sites/all/modules/civicrm/CRM/Report/Form.php(3285): CRM_Logging_ReportDetail->buildRows(NULL, (Array:0))
#18 /var/www/drupal/sites/all/modules/civicrm/CRM/Report/Form.php(828): CRM_Report_Form->postProcess()
#19 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Form.php(519): CRM_Report_Form->preProcess()
#20 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
#21 /var/www/drupal/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Report_Form_Contact_LoggingDetail), "display")
#22 /var/www/drupal/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Report_Form_Contact_LoggingDetail), "display")
#23 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
#24 /var/www/drupal/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
#25 /var/www/drupal/sites/all/modules/civicrm/CRM/Report/Page/Instance.php(89): CRM_Utils_Wrapper->run("CRM_Report_Form_Contact_LoggingDetail", NULL, NULL)
#26 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Report_Page_Instance->run((Array:4), NULL)
#27 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:14))
#28 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:4))
#29 /var/www/drupal/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:4))
#30 [internal function](): civicrm_invoke("report", "instance", "60")
#31 /var/www/drupal/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
#32 /var/www/drupal/index.php(21): menu_execute_active_handler()
#33
SELECT DISTINCT lt.id FROM `civicrm`.`log_civicrm_batch` lt WHERE lt.log_conn_id = '57b41efd7ddbc' AND contact_id = 216778
Creating a contact while having logging temporarily disabled does not create a 'Initialization' or 'Insert' row in the logging tables and therefore getDiffs() gets invoked which will fail for multiple log tables.