Skip to content
Snippets Groups Projects
Commit 4ec2000d authored by Oleksii Korshenko's avatar Oleksii Korshenko
Browse files

MAGETWO-86205: Handle multiple errors in customer address validation when...

MAGETWO-86205: Handle multiple errors in customer address validation when shown in adminhtml customer edit page #12922

 - Merge Pull Request magento/magento2#12922 from adrian-martinez-interactiv4/magento2:FR22#ADMINHTML-CUSTOMER-SAVE-MULTIPLE-ERROR-MESSAGES
 - Merged commits:
   1. 6ebb7d94
   2. 141e293e
parents b09ab2aa 141e293e
No related merge requests found
......@@ -13,6 +13,9 @@ use Magento\Customer\Model\EmailNotificationInterface;
use Magento\Customer\Model\Metadata\Form;
use Magento\Framework\Exception\LocalizedException;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Save extends \Magento\Customer\Controller\Adminhtml\Index
{
/**
......@@ -268,6 +271,15 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index
$this->_addSessionErrorMessages($messages);
$this->_getSession()->setCustomerFormData($originalRequestData);
$returnToEdit = true;
} catch (\Magento\Framework\Exception\AbstractAggregateException $exception) {
$errors = $exception->getErrors();
$messages = [];
foreach ($errors as $error) {
$messages[] = $error->getMessage();
}
$this->_addSessionErrorMessages($messages);
$this->_getSession()->setCustomerFormData($originalRequestData);
$returnToEdit = true;
} catch (LocalizedException $exception) {
$this->_addSessionErrorMessages($exception->getMessage());
$this->_getSession()->setCustomerFormData($originalRequestData);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment