Skip to content

Fixes DOB & customer account save validations#5146

Merged
sreichel merged 13 commits into
OpenMage:mainfrom
sreichel:fix/validation
Dec 12, 2025
Merged

Fixes DOB & customer account save validations#5146
sreichel merged 13 commits into
OpenMage:mainfrom
sreichel:fix/validation

Conversation

@sreichel
Copy link
Copy Markdown
Contributor

@sreichel sreichel commented Dec 9, 2025

Description (*)

Bugfixes.

Related Pull Requests

Fixed Issues (if relevant)

  • validation for DOB was wrong (no/optional/required)
    • see admin save customer
    • see admin create order
    • see frontend save customer
  • frontend customer password validation
    • was triggered always, only needed when password changes

- NotBlank check is optional for Date & DateTime now
- validate password only when user changes the password
- updated NotBlank check for DOB
- fixes DOB validation, customer uses Date format, but create order uses DateTime format
- updated NotBlank check
@sreichel sreichel added the bug label Dec 9, 2025
@github-actions github-actions Bot added Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Eav Relates to Mage_Eav Component: Adminhtml Relates to Mage_Adminhtml phpunit labels Dec 9, 2025
Hanmac
Hanmac previously approved these changes Dec 11, 2025
@sreichel sreichel marked this pull request as ready for review December 11, 2025 20:17
Copilot AI review requested due to automatic review settings December 11, 2025 20:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes validation issues related to Date of Birth (DOB) and customer account password validation. The main changes address: (1) incorrect DOB validation that didn't properly handle required/optional states, (2) password validation being triggered unnecessarily when passwords weren't being changed, and (3) proper handling of datetime values in date validation.

Key Changes:

  • Enhanced DOB validation to properly support optional, required, and no validation states by adding empty and emptyMessage parameters to date/datetime validators
  • Added password change detection via isChangePassword flag to prevent password validation when only other customer data is being updated
  • Fixed date validation to automatically handle datetime values when a time component is present

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/code/core/Mage/Core/Helper/Validate.php Added empty and emptyMessage parameters to validateDate and validateDateTime methods to control NotBlank constraint application
app/code/core/Mage/Eav/Model/Attribute/Data/Abstract.php Updated date/datetime validation to pass empty parameter based on attribute's required state and added automatic datetime detection
app/code/core/Mage/Customer/Model/Customer.php Modified validate() to check isChangePassword flag before validating passwords, updated DOB validation to use new empty parameter, added missing exception docblocks
app/code/core/Mage/Customer/Model/Form.php Added @method docblock for getSystemAttributes() return type
app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Form/Account.php Removed redundant inline type hint comment (now covered by Form.php docblock)
tests/unit/Traits/DataProvider/Mage/Customer/CustomerTrait.php Added getIsChangePassword to test data provider
cypress/e2e/openmage/frontend/customer/account.cy.js Fixed test name from "invalid" to "valid" form submission
cypress/e2e/openmage/backend/customer/customer.cy.js Added test for saving existing customer to verify validation fix

Comment thread app/code/core/Mage/Eav/Model/Attribute/Data/Abstract.php
Comment thread app/code/core/Mage/Customer/Model/Customer.php Outdated
@github-actions github-actions Bot added the translations Relates to app/locale label Dec 11, 2025
@sreichel sreichel requested a review from Hanmac December 11, 2025 20:49
@sonarqubecloud
Copy link
Copy Markdown

@sreichel sreichel merged commit 446eff7 into OpenMage:main Dec 12, 2025
40 of 41 checks passed
@sreichel sreichel deleted the fix/validation branch December 13, 2025 22:25
@sreichel sreichel added this to the 20.17.0 milestone Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Component: Adminhtml Relates to Mage_Adminhtml Component: Core Relates to Mage_Core Component: Customer Relates to Mage_Customer Component: Eav Relates to Mage_Eav cypress phpunit translations Relates to app/locale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants