Skip to content

Fixes Mage_Eav_Model_Attribute_Data_Date and Mage_Core_Controller_Varien_Action date validations and empty value handling #4605

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

Conversation

massa-man
Copy link
Contributor

Description (*)

Fix to allow clearing the customer DOB in the admin. This PR also fixes some similar issues with other admin controller date management such as Product controller, which does not use a form, but use the _filterDate() and _filterDateTime() helpers in Mage_Core_Controller_Varien_Action, aligning that code with the fixes I did in PR 3752 to the from filters.

Related Pull Requests

Fixed Issues (if relevant)

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added Component: Core Relates to Mage_Core Component: Eav Relates to Mage_Eav labels Feb 5, 2025
@sreichel sreichel added the bug label Feb 10, 2025
@sreichel
Copy link
Contributor

Bug confirmed,

Just did a quick ckeck. To solve the issue it only requieres changes to app/code/core/Mage/Eav/Model/Attribute/Data/Date.php.

Why change app/code/core/Mage/Core/Controller/Varien/Action.php?

@massa-man
Copy link
Contributor Author

massa-man commented Feb 26, 2025

Bug confirmed,

Just did a quick ckeck. To solve the issue it only requieres changes to app/code/core/Mage/Eav/Model/Attribute/Data/Date.php.

Why change app/code/core/Mage/Core/Controller/Varien/Action.php?

Yes, the specific issue of customer DOB only requires update to app/code/core/Mage/Eav/Model/Attribute/Data/Date.php. The other changes to the Action controller are two fold:

  1. To align the use of Date and DateTime filters for input data to using the same filters for all input (the current Varien Action Date and DateTime filters duplicate the code in Varien_Data_Form_Filter_Date and Varien_Data_Form_Filter_DateTime, which were patched and updated in PR: Fixed Varien_Data_Form_Filter_Date::inputFilter() and Varien_Data_Form_Filter_Datetime::inputFilter() dealing with empty values #3752. This is more of a code improvement/cleanup to consolidate the use of the same filters across the application.

  2. The EAV form is only used for the customer entity, all other EAV entities in the admin console (i.e. Catalog Product, etc) seem to use the varien Action _filterDates and _filterDateTime methods to process the attributes input data.

@kiatng
Copy link
Contributor

kiatng commented Feb 27, 2025

Validation on required-entry doesn't work. Steps to reproduce:

  1. UPDATE `eav_attribute` SET `is_required` = '1' WHERE `eav_attribute`.`attribute_code` = 'dob'
  2. Clear DOB in backend, and in developer console, remove required-entry in the class attribute.
  3. Save. Expected error message is not thrown.

@kiatng
Copy link
Contributor

kiatng commented Feb 28, 2025

I committed a fix for the required-entry validation and push it here: riseart/openmage@bugfix/fix-date-filters-in-varien-action-controller...OpenMage:magento-lts:bugfix/fix-date-filters-in-varien-action-controller I am not sure how to incorporate that into this PR. Any idea?

@massa-man
Copy link
Contributor Author

I committed a fix for the required-entry validation and push it here: riseart/openmage@bugfix/fix-date-filters-in-varien-action-controller...OpenMage:magento-lts:bugfix/fix-date-filters-in-varien-action-controller I am not sure how to incorporate that into this PR. Any idea?

I can merge this change into my branch so it is all part of this PR. Besides that, are you guys happy to approve and merge this fix?

…-action-controller

Fix required entry bug
@massa-man
Copy link
Contributor Author

Hi all, can we get a second approver on this one so we can merge it? Thanks!

@addison74 addison74 merged commit 1c84649 into OpenMage:main Mar 12, 2025
19 checks passed
fballiano added a commit to MahoCommerce/maho that referenced this pull request Mar 12, 2025
@sreichel sreichel changed the title Fixes Mage_Eav_Model_Attribute_Data_Date and Mage_Core_Controller_Varien_Action date validations and empty value handling Fixes Mage_Eav_Model_Attribute_Data_Date and Mage_Core_Controller_Varien_Action date validations and empty value handling Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Core Relates to Mage_Core Component: Eav Relates to Mage_Eav
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to clear/remove customer DOB via admin console
4 participants