-
Notifications
You must be signed in to change notification settings - Fork 461
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
1 feature request migrate hardcoded states dropdown #6832
1 feature request migrate hardcoded states dropdown #6832
Conversation
I been wanting to do this for a while let me test it and merge |
src/Include/StateDropDown.php
Outdated
else { | ||
$lowerCountryCode=strtolower($Country->getCountryCode()); | ||
// Must cast to lowercase because ultimately this looks up files with lc names | ||
$TheStates=new States($lowerCountryCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DawoudIO - one of the questions I had is: If the CountryCode that is being used throughout the code is uppercase (e.g. US), then wouldn't it be better to change the locale/states/us.json file to be local/states/US.json, rather than force the name to lowercase here? I would think the filename should match the CountryCode, whatever the case is.
Hmm.. I'm not sure where it gets pulled in, but I now see ChurchCRM/Dashboard/CurrentLocaleMetadata.php is setting a 'countryFlagCode' to be the lowercase version of the CountryCode - so maybe the filename is appropriate, but I'm not sure if that should be referenced are used within this function somehow.
Somewhat separate question -- but it didn't look like FamilyEditor.php was using the StateDropDown class (as PersonEditor is) -- but it seems to pull up the correct list -- so I'd like to understand how that is happening... but Also, when I tried to make a change to the State for an entry, using the FamilyEditor - I got this error:
which I think is possibly due to FamilyEditor.php:1103 where I think "NULL" may be quoted and it shouldn't be? This appears to be a change about 3 weeks ago by @DAcodedBEAT , as part of "converting tedious sql strings to safer orm representation" - but I could be wrong. I did verify that removing the double-quotes around NULL solved the issue... I suppose I should open a new issue for that. |
Great find, I think you might be right. |
Created issue #6833 to address the FamilyEditor problem. Will have an initial pull request for that soon. |
…ded-states-dropdown
… github.com:grayeul/CRM into 1-feature-request-migrate-hardcoded-states-dropdown
…ded-states-dropdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I like what I see and it works in my test system
Hi @grayeul |
Description & Issue number it closes
This should be considered a DRAFT Pull Request for Issue #6644. It was chosen because of the 'good first issue' tag, and I was looking for a relatively simple fix that would help me navigate the waters for future contributions. The main purpose of this fix is to consolidate where State DropDown options are presented, and use them in a consistent way.
Screenshots (if appropriate)
I don't think this (as it currently stands...) should affect anything related to screenshots. Though there could be later changes after discussions that might make some small changes.
How to test the changes?
What I've been doing to test this is just going into the view of "Active People" and selecting someone to edit, which goes through the PersonEditor.php. With the 'old' hard-coded way from the original StateDropDown.php, the list of States provided (for US) started with Alabama, Alaska, Arizona..... After the change, you should see: Alabama, Alaska, American Samoa, ... as this comes from the list in
src/locale/states/us.json
Type of change
How Has This Been Tested?
See above on "How to test the changes". Note that I have only tested this running in a Dev environment, using docker -- but I don't think that matters for this type of change.
Checklist:
I wanted to initiate this Pull Request to get some formal code review here. This is my first time contributing on GitHub, so I'm not sure how this will go, but I would like to see review-comments on my existing changes, and I have a couple of followup questions I'd like to discuss before this is considered by me ready-to-merge. I'm hoping that can be done in the form of comments in the GitHub issues somehow -- but as this is my first, waiting to see how that works out.