Closes #200 - Address fix

This commit is contained in:
Yura 2020-11-25 10:54:38 +03:00 committed by GitHub
parent fb7290f865
commit 75fc11c6f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -315,10 +315,17 @@ class ModelExtensionRetailcrmHistory extends Model {
$this->customers_history->handleCustomer($customer_data, $customer); $this->customers_history->handleCustomer($customer_data, $customer);
$this->customers_history->handleCustomFields($customer_data, $customer); $this->customers_history->handleCustomFields($customer_data, $customer);
$updateAddress = $this->customers_history->handleAddress($customer, array(), $customer_data['address_id']); if (empty($customer_data['address_id'])) {
$addresses = $this->model_customer_customer->getAddresses($customer_id); $address = $this->customers_history->handleAddress($customer, array());
$addresses[$customer_data['address_id']] = $updateAddress; $addresses = $this->model_customer_customer->getAddresses($customer_id);
$customer_data['address'] = $addresses; $addresses[] = $address;
$customer_data['address'] = $addresses;
} else {
$updateAddress = $this->customers_history->handleAddress($customer, array(), $customer_data['address_id']);
$addresses = $this->model_customer_customer->getAddresses($customer_id);
$addresses[$customer_data['address_id']] = $updateAddress;
$customer_data['address'] = $addresses;
}
$this->model_customer_customer->editCustomer($customer_id, $customer_data); $this->model_customer_customer->editCustomer($customer_id, $customer_data);
} }

View File

@ -53,7 +53,9 @@ class Customer {
if ($address_id) { if ($address_id) {
$customer_address = $this->customer_repository->getAddress($address_id); $customer_address = $this->customer_repository->getAddress($address_id);
} else { } else {
$customer_address = array(); $customer_address = array(
'address_id' => ''
);
} }
if (isset($customer['address']['countryIso'])) { if (isset($customer['address']['countryIso'])) {