Merge pull request #701 from shreesh-webkul/gli-1145

Resolve: Address not updating on admin address and order page.
This commit is contained in:
Rohit Jain
2023-04-14 16:48:20 +05:30
committed by GitHub
2 changed files with 12 additions and 4 deletions

View File

@@ -251,10 +251,13 @@ class AddressCore extends ObjectModel
$errors = parent::validateController($htmlentities);
// for customer address we need to check of customer address already exists.
if ($idCustomer = Tools::getValue('id_customer')) {
if ($id_address = Customer::getCustomerIdAddress($idCustomer)) {
// if we are editing an address we do not need to validate already created address.
if (!Validate::isLoadedObject($this)) {
if ($idCustomer = Tools::getValue('id_customer')) {
if ($id_address = Customer::getCustomerIdAddress($idCustomer)) {
$errors[] = sprintf(Tools::displayError('Customer address already exists. Id address: #%d'), $id_address);
$errors[] = sprintf(Tools::displayError('Customer address already exists. Id address: #%d'), $id_address);
}
}
}

View File

@@ -366,7 +366,12 @@ class AdminAddressesControllerCore extends AdminController
$this->redirect_after = false;
}
$address = new Address();
if ($idAddress = Tools::getValue('id_address')) {
$address = new Address($idAddress);
} else {
$address = new Address();
}
$this->errors = $address->validateController();
// Transform e-mail in id_customer for parent processing