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

dev/core#1817 - Editing a custom field option value from the custom field admin screen changes the name field #17681

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

demeritcowboy
Copy link
Contributor

Overview

https://lab.civicrm.org/dev/core/-/issues/1817

  1. Create a custom field that has a choice list, like a select field.
  2. Add some options. Save the field.
  3. Go to the custom field admin screen where you can edit one of the option values. The screen I'm talking about has a url like /civicrm/admin/custom/group/field/option?reset=1&action=browse&fid=18&gid=7. Administer - Customize Data and Screens - Custom Fields - View and Edit Custom fields - Edit Multiple Choice Options.
  4. Edit one of the option choices and change the label. Save it.
  5. If you look in the database or use api explorer to do optionvalue get for the option value, you'll see the name field has changed.

Note that if you edit the option from Administer - System Settings - Option Groups, it's a different form and it works ok.

Before

name field gets changed so you need to edit your code whereever you use name to access it whenever the label is changed.

After

name only gets set for new option values

Technical Details

I think there are two separate forms to do the same thing because of history. A future todo might be to consolidate and figure out what else one might be doing that the other isn't doing.

Comments

Has test.

@civibot
Copy link

civibot bot commented Jun 22, 2020

(Standard links)

@civibot civibot bot added the master label Jun 22, 2020
@colemanw
Copy link
Member

I've reviewed the code and run this and the fix looks good.

I'd 100% support consolidating the two different option edit forms. Agree that it was a historical thing to have two of them. Fun fact - there used to be a third until I got rid of it.

@colemanw colemanw merged commit 33cfb2b into civicrm:master Jun 23, 2020
@demeritcowboy
Copy link
Contributor Author

Thanks!

"Happiness comes in many forms"

@demeritcowboy demeritcowboy deleted the customfieldoption-name-label branch June 23, 2020 14:17
@colemanw
Copy link
Member

I think happiness can also come from deleting forms :)

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