magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Configuration fields not disabled when setting options in config.php #23014

Open dverkade opened 5 years ago

dverkade commented 5 years ago

Preconditions

  1. Magento 2.3.1

Steps to reproduce

  1. In the config.php file overwrite a config setting of a fields which is dependent on another field. So the field you're trying to set the configuration variable on is only visible when another field is enabled.
  2. Go into the Magento backend and verify that the field is set and can no longer be changed by the user.

system.xml file

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="tax">
            <group id="avatax" translate="label" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
                <label>AvaTax Settings</label>
                <comment><![CDATA[For complete and up-to-date documentation, please visit <a href="http://www.classyllama.com/documentation/extensions/avatax-magento-2-module" target="_blank">www.classyllama.com/documentation/extensions/avatax-magento-2-module</a>.</p>
                    ]]></comment>
                <field id="enabled" translate="label" type="select" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Enable AvaTax</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="tax_settings_header" translate="label" type="label" sortOrder="1001" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label><![CDATA[<strong>Tax Calculation Settings</strong>]]></label>
                </field>
                <field id="tax_mode" translate="label" type="select" sortOrder="1002" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Tax Mode</label>
                    <source_model>ClassyLlama\AvaTax\Model\Config\Source\TaxMode</source_model>
                    <comment><![CDATA[<ul><li><strong>Disabled</strong> — AvaTax tax estimation will be disabled and native Magento tax estimation will be used. Only use this option if you want to use Address Validation without tax estimation.</li><li><strong>Estimate Tax</strong> — AvaTax tax estimation will run during checkout, but completed orders will not be submitted to AvaTax.</li><li><strong>Estimate Tax & Submit Transactions to AvaTax</strong> — AvaTax tax estimation will run during checkout and invoices and credit memos will be submitted to AvaTax.</li></ul>]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                    </depends>
                </field>
                <field id="commit_submitted_transactions" translate="label" type="select" sortOrder="1004" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Commit Submitted Transactions</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[Should transactions sent to AvaTax be committed? Only change to <strong>No</strong> if you have specific reason to do so.]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                        <field id="tax_mode">3</field>
                    </depends>
                </field>
                <field id="tax_calculation_countries_enabled" translate="label comment" type="multiselect" sortOrder="1005" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Taxable Countries</label>
                    <source_model>ClassyLlama\AvaTax\Model\Config\Source\TaxCalculationCountries</source_model>
                    <comment><![CDATA[Select which countries to enable for tax calculation (address verification countries are <a href="#row_tax_avatax_address_validation_header">configured below</a>).]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                        <field id="tax_mode" negative="1">1</field>
                    </depends>
                </field>
                <field id="filter_tax_by_region" translate="label" type="select" sortOrder="1006" showInDefault="1" showInWebsite="1" showInStore="1">
                    <label>Filter Tax Calculation By Region</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                    <comment><![CDATA[Should tax calculation only apply to certain regions? Only change this to <strong>Yes</strong> if you have a specific reason to do so. See the [documentation](https://github.com/classyllama/ClassyLlama_AvaTax/blob/develop/docs/sales-tax.md#filter_by_region) for more details.]]></comment>
                    <depends>
                        <field id="enabled">1</field>
                        <field id="tax_mode" negative="1">1</field>
                    </depends>
                </field>
            </group>
        </section>
    </system>
</config>

app/etc/config.php

<?php
return [
    'system' => [
        'default' => [
            'tax' => [
                'avatax' => [
                    'enabled' => 1,
                    'tax_mode' => 3,
                    'commit_submitted_transactions' => 1,
                    'tax_calculation_countries_enabled' => 'US',
                    'filter_tax_by_region' => 0,
                    'upc_attribute' => 'upc'
                ]
            ]
        ]
    ]
];

Expected result

  1. The field "Tax mode" should be disabled and should not be able to get changed by the user.

Actual result

  1. Fields can be changed in the stores -> configuration section of the Magento backend, see screenshot: image
m2-assistant[bot] commented 5 years ago

Hi @dverkade. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@dverkade do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 5 years ago

Hi @engcom-backlog-nazar. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

ghost commented 5 years ago

Hi @dverkade thank you for you report, this is not best practice to change app/etc/config.php https://devdocs.magento.com/guides/v2.3/config-guide/prod/config-reference-configphp.html https://devdocs.magento.com/guides/v2.3/config-guide/config/config-php.html

hostep commented 5 years ago

@engcom-backlog-nazar: have you ever tried executing: bin/magento app:config:dump? Check the app/etc/config.php and app/etc/env.php files before and after doing so, you might be surprised 🙂

Documentation: https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-config-mgmt-export.html

m2-assistant[bot] commented 5 years ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

magento-engcom-team commented 5 years ago

:white_check_mark: Confirmed by @engcom-Delta Thank you for verifying the issue. Based on the provided information internal tickets MC-18263 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

yrobag commented 5 years ago

mm19pl

magento-engcom-team commented 5 years ago

@yrobag thank you for joining. Please accept team invitation here and self-assign the issue.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

dverkade commented 3 years ago

Confirmed issue should not automatically be closed and should stay on the backlog. Posting comment here to disable the stale bot.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

dverkade commented 3 years ago

Confirmed issue should not automatically be closed and should stay on the backlog. Posting comment here to disable the stale bot.

m2-assistant[bot] commented 4 months ago

Hi @engcom-Delta. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction: