Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bulk adding custom fields with logging on #21019

Merged
merged 1 commit into from
Aug 5, 2021

Conversation

ejegg
Copy link
Contributor

@ejegg ejegg commented Aug 5, 2021

Overview

Fixes a SQL error when adding fields to logging tables after bulk saving new CustomFields

To replicate: on a wmff build, turn logging on, check out
https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/crm/+/709873
and run drush update-custom-fields

Before

SQL syntax error message and new field not added to logging table

After

No error message, field added to logging table

Technical Details

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. By sending the 'name' instead of the 'column_name'
the _getColumnQuery's grep was not finding anything matching in the
main table create statement
https://github.com/civicrm/civicrm-core/blob/master/CRM/Logging/Schema.php#L520

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.
@civibot
Copy link

civibot bot commented Aug 5, 2021

(Standard links)

@civibot civibot bot added the master label Aug 5, 2021
@seamuslee001
Copy link
Contributor

This looks fine to me merging

@seamuslee001 seamuslee001 merged commit 5d24525 into civicrm:master Aug 5, 2021
@ejegg ejegg deleted the customFieldBulkLog branch August 10, 2021 18:35
ahed-compucorp added a commit to compucorp/civicrm-core that referenced this pull request Nov 24, 2022
ahed-compucorp added a commit to compucorp/civicrm-core that referenced this pull request Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants