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

Use str_ends_with function over strpos to fix false notice #1036

Merged
merged 1 commit into from
Feb 15, 2025

Conversation

pradpnayak
Copy link
Contributor

Overview

When deleting a custom field, the UI erroneously displays the message “This field is used in the following webforms:” even when the field isn't actually used.

This issue arises in rare scenarios where there are over 100 custom fields in the system. For example, if a webform includes the field custom_354 and you attempt to delete custom_35, the warning appears because the code mistakenly matches the substring custom_35 within identifiers like civicrm_1_contact_1_cg42_custom_358 or civicrm_1_contact_1_cg42_custom_359. This PR resolves the issue by using the str_ends_with function for precise matching.

@KarinG
Copy link
Collaborator

KarinG commented Feb 15, 2025

Ah - brilliant! Test fails are due to civicrm.org extensions dir not running at the moment. Going to merge that - then rebase this.

@KarinG KarinG merged commit 67d2dd2 into colemanw:6.x Feb 15, 2025
0 of 4 checks passed
@pradpnayak
Copy link
Contributor Author

Thank you @KarinG

@KarinG
Copy link
Collaborator

KarinG commented Feb 15, 2025

I have one project with a custom_692 - so it was easy to test :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants