Multilingual installation with logging enabled gives error when custom field is changed
Logging of custom fields on a multilingual installation does not work, which makes it impossible to view changes if one of the changes is a custom field.
Steps to reproduce:
- install a fresh CiviCRM installation: 5.0 (the issue also existed in versions before)
- enable Multiple Languages Support on http://example.org/civicrm/admin/setting/localization?reset=1
- enable logging on http://example.org/civicrm/admin/setting/misc?reset=1
- change a custom field of a contact
- view the changelog of that contact and click on the change
This results in follwing Database error:
Database Error Code: Table 'databasename.log_civicrm_custom_group_en_US' doesn't exist, 1146 Additional Details: Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle )
[code] => -18 [message] => DB Error: no such table [mode] => 16 [debug_info] => SELECT id, title FROM `databasename`.log_civicrm_custom_group_en_US WHERE log_date <= '2018-04-09 17:40:29' AND table_name = 'civicrm_value_constituent_information_1' ORDER BY log_date DESC LIMIT 1 [nativecode=1146 ** Table 'databasename.log_civicrm_custom_group_en_US' doesn't exist] [type] => DB_Error [user_info] => SELECT id, title FROM `databasename`.log_civicrm_custom_group_en_US WHERE log_date <= '2018-04-09 17:40:29' AND table_name = 'civicrm_value_constituent_information_1' ORDER BY log_date DESC LIMIT 1 [nativecode=1146 ** Table 'databasename.log_civicrm_custom_group_en_US' doesn't exist] [to_string] => [db_error: message="DB Error: no such table" code=-18 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT id, title FROM `databasename`.log_civicrm_custom_group_en_US WHERE log_date <= '2018-04-09 17:40:29' AND table_name = 'civicrm_value_constituent_information_1' ORDER BY log_date DESC LIMIT 1 [nativecode=1146 ** Table 'databasename.log_civicrm_custom_group_en_US' doesn't exist]"]
)
I replaced the actual database name with 'databasename' in the error message above