-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Fix] Do not modify current list of countries with require states during setup upgrade #16885
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] Do not modify current list of countries with require states during setup upgrade #16885
Conversation
…ing setup upgrade. Also mark getCountriesWithRequiredStates() as deprecated because is no longer needed
Hi @jalogut. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@@ -41,10 +41,10 @@ public function __construct(Data $directoryData) | |||
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | |||
{ | |||
if (version_compare($context->getVersion(), '2.0.1', '<')) { | |||
$this->addCountryRegions($setup, $this->getDataForCroatia()); | |||
$this->addCountryRegions($setup, 'IN', $this->getDataForCroatia()); |
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.
I believe IN and HR should be swapped here
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.
I have 1 question on this review and there is still one outstanding from FooMan.
@@ -34,10 +34,6 @@ | |||
<type name="Magento\Directory\Model\ResourceModel\Country\Collection" shared="false"> | |||
<arguments> | |||
<argument name="helperData" xsi:type="object">DirectoryHelperDataProxy</argument> | |||
<argument name="countriesWithNotRequiredStates" xsi:type="array"> | |||
<item name="FR" xsi:type="string">FR</item> |
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.
What was the reasoning behind making this change?
Hi @jalogut do you have time to look into the feedback on this pull request? Thanks |
0c29018
to
875c394
Compare
Hi, sorry that was a mistake. I updated the PR with some changes. It should be ok now. Thanks for checking. |
During testing we had the following cases fail
@jalogut could you please look at these failures for us. Thank you. |
What do you mean with failing? That is right behaviour. This setup scripts are depending on the current version of
|
@jalogut are IN and HR added to "general/region/state_required" in earlier versions? Just going from your description:
If it was reported as a failure as in two cases it is modified. |
Well I meant “do not overwrite current value”. Before this PR, the current value is overwritten with the default magento one. This PR adds the new countries (IN, HR) while keeping previous value. Should I update the PR title? |
Ah I see @jalogut thanks for the clarification. |
…re states during setup upgrade #16885
Hi @jalogut. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
Upgrading from any version
<2.2.0
to any version>=2.2.0
results in modifications ofgeneral/region/state_required
value.How to reproduce
<2.2.0
core_config_data
forgeneral/region/state_required
>=2.2.0
Expected result
general/region/state_required
is not modifiedActual result
general/region/state_required
is overridden with all enabled countries ingeneral/country/allow
Fixed Issues
Contribution checklist