From 0cb10002bc0bcff349bacf923b347422a82dc2fe Mon Sep 17 00:00:00 2001 From: Elliott Eggleston Date: Wed, 4 Aug 2021 21:23:29 -0400 Subject: [PATCH] Fix adding many custom fields with logging on This code is only triggered in the 'bulk' writeRecords codepath, not in the createField codepath which is used for creating custom fields via the UI. To replicate: on a wmff build, turn loggin on, check out https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/709873 and run drush update-custom-fields Result prior to this patch: SQL syntax error message and new field not added to logging table Result with this patch: no error message, new field created on log table. --- CRM/Core/BAO/CustomField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 4664efbf0d..d79cf9747e 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -154,7 +154,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customField->custom_group_id, 'table_name'); $sql[$tableName][] = $fieldSQL; - $addedColumns[$tableName][] = $customField->name; + $addedColumns[$tableName][] = $customField->column_name; $customFields[$index] = $customField; } -- 2.25.1