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

CustomerAddressFormCore validation was not working fine with hook… #8261

Merged
merged 1 commit into from Oct 9, 2017

Conversation

Projects
None yet
3 participants
@yuxblank
Contributor

yuxblank commented Aug 21, 2017

Questions Answers
Branch? develop
Description? CustomerAddressFormCore validation was not working fine with hooks provided by modules for custom validation.
Type? bug fix
Category? CO
BC breaks? No
Deprecations? No
Fixed ticket?
How to test? Create a module with ActionValidateCustomerAddressForm hook that validate one of the form fields. at the submit will be possible to proceed to addresses page which shows the error message set in context-controller.

In modules you can validate fields adding errors to be validated by AbstractFormCore::validate() allowing core methods to be improved thus reflecting modules validation.

public function hookActionValidateCustomerAddressForm($params)
    {
        /** @var CustomerAddressForm $form */
        $form = $params['form'];
        $field= $form->getField("fieldname") ? $form->getField('fieldname')->getValue() : null;
        if (!$this->validateModuleHookFunction($field)) {
            $form->getField('fieldname')->addError($this->l('Invalid field label'));
        }
    }
@prestonBot

This comment has been minimized.

Show comment
Hide comment
@prestonBot

prestonBot Aug 21, 2017

Collaborator

Hello yuxblank!

This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community!

Collaborator

prestonBot commented Aug 21, 2017

Hello yuxblank!

This is your first pull request on the PrestaShop project. Thank you, and welcome to this Open Source community!

@Quetzacoalt91

This comment has been minimized.

Show comment
Hide comment
@Quetzacoalt91

Quetzacoalt91 Aug 22, 2017

Member

Thanks for the module example! The context is easier to understand.

Member

Quetzacoalt91 commented Aug 22, 2017

Thanks for the module example! The context is easier to understand.

@Quetzacoalt91 Quetzacoalt91 added this to the 1.7.3.0 milestone Aug 22, 2017

@Quetzacoalt91 Quetzacoalt91 changed the title from CO: CustomerAddressFormCore validation was not working fine with hook… to CustomerAddressFormCore validation was not working fine with hook… Aug 22, 2017

@Quetzacoalt91 Quetzacoalt91 merged commit c7321f4 into PrestaShop:develop Oct 9, 2017

2 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Quetzacoalt91

This comment has been minimized.

Show comment
Hide comment
@Quetzacoalt91
Member

Quetzacoalt91 commented Oct 9, 2017

Thank you @yuxblank

@yuxblank yuxblank deleted the yuxblank:hookAddressValidation branch Feb 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment