mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Fixed resetting customer's fields in Prestashop in case of it deleting in RetailCRM
This commit is contained in:
parent
114ae5efd1
commit
54959b7a15
@ -87,7 +87,10 @@ class RetailcrmHistory
|
||||
$customerBuilder->setDataCrm($customerHistory);
|
||||
|
||||
if (isset($customerHistory['externalId'])) {
|
||||
|
||||
$customerData = self::$api->customersGet($customerHistory['externalId'], 'externalId');
|
||||
if (isset($customerData['customer']) && $customerData['customer']) {
|
||||
|
||||
$foundCustomer = new Customer($customerHistory['externalId']);
|
||||
$customerAddress = new Address(RetailcrmTools::searchIndividualAddress($foundCustomer));
|
||||
$addressBuilder = new RetailcrmCustomerAddressBuilder();
|
||||
@ -115,6 +118,8 @@ class RetailcrmHistory
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$customerBuilder->build();
|
||||
|
||||
|
@ -171,7 +171,6 @@ class RetailcrmHistoryHelper {
|
||||
|
||||
if (isset($change['deleted'])
|
||||
&& $change['deleted']
|
||||
&& isset($customers[$change['customer']['id']])
|
||||
) {
|
||||
$customers[$change['customer']['id']]['deleted'] = true;
|
||||
continue;
|
||||
|
@ -47,6 +47,19 @@ class RetailcrmHistoryTest extends RetailcrmTestCase
|
||||
)
|
||||
);
|
||||
|
||||
$this->apiMock->expects($this->any())
|
||||
->method('customersGet')
|
||||
->willReturn(
|
||||
new RetailcrmApiResponse(
|
||||
'200',
|
||||
json_encode(
|
||||
array(
|
||||
'customer' => $this->getApiCustomer()
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
RetailcrmHistory::$default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
RetailcrmHistory::$api = $this->apiMock;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user