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.56k stars 9.32k forks source link

Dynamic row system config default values were reset, lost when Enabled/disabled by dependencies fields #32695

Open tuyennn opened 3 years ago

tuyennn commented 3 years ago

Preconditions (*)

  1. Magento 2.4.2

Steps to reproduce (*)

  1. Add a dynamic row system config depends on a main Yes/No configuration
  2. Add values for dynamic row system config
  3. main Yes/No configuration set: Yes => Save configuration. Check the database: core_config_data
  4. main Yes/No configuration set: No => Save configuration. Check the database: core_config_data
  5. main Yes/No configuration set: Yes => See the values for dynamic row

Expected result (*)

  1. the values for dynamic row after set back to Yes must remain the values that were set before

Actual result (*)

  1. Lost values for dynamic row config, the values on core_config_data is []

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 3 years ago

Hi @tuyennn. 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.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

lano-vargas commented 3 years ago

I get the same issue with when adding new column to an existing and all previous data row doesn't get rendered, not lost it still in core_config_data table but I assume because the new column isn't in the array it just won't rendered at all is this another issue can anyone confirm ? Thanks

tuyennn commented 3 years ago

@lano-vargas The problem is the fields are not gonna send the values to database while it was disabled. For now I set another template based on vendor/magento/module-config/view/adminhtml/templates/system/config/form/field/array.phtml for the Block extended Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray.

And remove the id from the <table class="admin__control-table"> so it still sends value even with its dependencies disabled Not sure the problem but just a workaround

m2-assistant[bot] commented 3 years ago

Hi @engcom-Bravo. 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:

engcom-Bravo commented 3 years ago

We are able to reproduce the issue and hence confirming the issue.

On creation of dependant field dynamic row system config:

image

core_config_data table status at this point:

image



Disable the controlling field(parent field) from admin panel and save config:

image

database table:

image



Enable the controlling field again in admin panel:

image

database table:

image

magento-engcom-team commented 3 years ago

@engcom-Bravo Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again. Thanks!

magento-engcom-team commented 3 years ago

@m2-community-project[bot] Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again. Thanks!

magento-engcom-team commented 3 years ago

@m2-community-project[bot] Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again. Thanks!

magento-engcom-team commented 3 years ago

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

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

Kannakiraj123 commented 1 year ago

This js issue.While I was noticed the input fields are disabled when dependent is applied to field.but input hidden field is not disabled.That's why dynamic row's input hidden field value passed to controller save action.

This issue fixed when change below code from vendor/magento/module-config/view/adminhtml/templates/system/config/form/field/array.phtml in line no.41

<input type="hidden" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>[__empty]" value=""/>

to

<input type="text" name="<?= $block->escapeHtmlAttr($block->getElement()->getName()) ?>[__empty]" value="" style="display: none;"/>

engcom-November commented 1 month ago

SInce this is quite a old issue, we tried to verify this on latest 2.4-develop and it is still reproducible.

Created a dynamic row system config field dependent on main Yes/No configuration. Please take a look at the screenshot below: 1. Added data into dynamic row when enable field is set to yes.

Screenshot 2024-10-14 at 3 14 49 PM

Same can be seen in core_config_data table.

Screenshot 2024-10-14 at 3 16 59 PM

2. Once the enable field is set to yes after setting it to no, the old data is been reset.

Screenshot 2024-10-14 at 3 18 36 PM

And the core_config_data is empty.

Screenshot 2024-10-14 at 3 18 17 PM

Please find the custom module used to reproduce this issue. DrVendor.zip

Hence reconfirming this.

Thank you.

github-jira-sync-bot commented 1 month ago

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-803