add reset in customer bulder and bump version
This commit is contained in:
parent
cec1dafd36
commit
2689836c65
@ -1,3 +1,6 @@
|
||||
## 2021-03-23 v.5.6.3
|
||||
* Исправлена передача полей от одного пользователя к другому в момент загрузки истории из CRM
|
||||
|
||||
## 2021-01-14 v.5.6.2
|
||||
* Исправлено формирование картинок в ICML при включеном CDN
|
||||
* Убрана некорректная запись внешнего идентификатора платежа для новых платежей по истории
|
||||
|
@ -67,4 +67,9 @@ class AddressBuilder extends AbstractBuilder implements RetailcrmBuilderInterfac
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->customerAddress = new CustomerAddress();
|
||||
}
|
||||
}
|
||||
|
@ -35,21 +35,22 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
$this->customerAddress = new CustomerAddress();
|
||||
$this->addressBuilder = new AddressBuilder();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Customer $customer
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomer($customer)
|
||||
public function setCustomer(Customer $customer): CustomerBuilder
|
||||
{
|
||||
$this->customer = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Customer
|
||||
*/
|
||||
public function getCustomer()
|
||||
public function getCustomer(): Customer
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
@ -58,7 +59,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param CustomerAddress $customerAddress
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomerAddress($customerAddress)
|
||||
public function setCustomerAddress($customerAddress): CustomerBuilder
|
||||
{
|
||||
$this->customerAddress = $customerAddress;
|
||||
return $this;
|
||||
@ -67,7 +68,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
/**
|
||||
* @return CustomerAddress
|
||||
*/
|
||||
public function getCustomerAddress()
|
||||
public function getCustomerAddress(): CustomerAddress
|
||||
{
|
||||
return $this->customerAddress;
|
||||
}
|
||||
@ -76,9 +77,10 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param array $dataCrm
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataCrm($dataCrm)
|
||||
public function setDataCrm($dataCrm): CustomerBuilder
|
||||
{
|
||||
$this->dataCrm = $dataCrm;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -86,26 +88,28 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param array $user
|
||||
* @return $this
|
||||
*/
|
||||
public function setUser($user)
|
||||
public function setUser($user): CustomerBuilder
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $registeredUserID
|
||||
* @return $this
|
||||
*/
|
||||
public function setRegisteredUserID($registeredUserID)
|
||||
public function setRegisteredUserID(int $registeredUserID): CustomerBuilder
|
||||
{
|
||||
$this->registeredUserID = $registeredUserID;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRegisteredUserID()
|
||||
public function getRegisteredUserID(): int
|
||||
{
|
||||
return $this->registeredUserID;
|
||||
}
|
||||
@ -113,7 +117,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getRegisterNewUser()
|
||||
public function getRegisterNewUser(): bool
|
||||
{
|
||||
return $this->registerNewUser;
|
||||
}
|
||||
@ -134,8 +138,8 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
|
||||
if (isset($this->dataCrm['phones'])) {
|
||||
foreach ($this->dataCrm['phones'] as $phone) {
|
||||
if (isset($phone['old_number']) && in_array($phone['old_number'], $this->user)) {
|
||||
$key = array_search($phone['old_number'], $this->user);
|
||||
if (isset($phone['old_number']) && in_array($phone['old_number'], $this->user, true)) {
|
||||
$key = array_search($phone['old_number'], $this->user, true);
|
||||
|
||||
if (isset($phone['number'])) {
|
||||
$this->user[$key] = $phone['number'];
|
||||
@ -145,14 +149,14 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
}
|
||||
|
||||
if (isset($phone['number'])) {
|
||||
if ((!isset($this->user['PERSONAL_PHONE']) || strlen($this->user['PERSONAL_PHONE']) == 0)
|
||||
if ((!isset($this->user['PERSONAL_PHONE']) || '' == $this->user['PERSONAL_PHONE'])
|
||||
&& $this->user['PERSONAL_MOBILE'] != $phone['number']
|
||||
) {
|
||||
$this->customer->setPersonalPhone($phone['number']);
|
||||
$this->user['PERSONAL_PHONE'] = $phone['number'];
|
||||
continue;
|
||||
}
|
||||
if ((!isset($this->user['PERSONAL_MOBILE']) || strlen($this->user['PERSONAL_MOBILE']) == 0)
|
||||
if ((!isset($this->user['PERSONAL_MOBILE']) || '' == $this->user['PERSONAL_MOBILE'])
|
||||
&& $this->user['PERSONAL_PHONE'] != $phone['number']
|
||||
) {
|
||||
$this->customer->setPersonalMobile($phone['number']);
|
||||
@ -213,26 +217,33 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
$this->customerAddress = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $login
|
||||
* @return $this
|
||||
*/
|
||||
public function setLogin($login)
|
||||
public function setLogin(string $login): CustomerBuilder
|
||||
{
|
||||
$this->customer->setLogin($login);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail($email)
|
||||
public function setEmail(string $email): CustomerBuilder
|
||||
{
|
||||
$this->customer->setEmail($email);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->customer = new Customer();
|
||||
$this->customerAddress = new CustomerAddress();
|
||||
$this->addressBuilder->reset();
|
||||
}
|
||||
}
|
||||
|
@ -45,155 +45,155 @@ class CustomerAddress extends BaseModel
|
||||
|
||||
/**@var string $text */
|
||||
protected $text;
|
||||
|
||||
|
||||
/**
|
||||
* @param string $index
|
||||
* @return $this
|
||||
*/
|
||||
public function setIndex($index)
|
||||
public function setIndex(string $index): CustomerAddress
|
||||
{
|
||||
$this->index = $index;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $country
|
||||
* @return $this
|
||||
*/
|
||||
public function setCountry($country)
|
||||
public function setCountry(string $country): CustomerAddress
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $region
|
||||
* @return $this
|
||||
*/
|
||||
public function setRegion($region)
|
||||
public function setRegion(string $region): CustomerAddress
|
||||
{
|
||||
$this->region = $region;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $city
|
||||
* @return $this
|
||||
*/
|
||||
public function setCity($city)
|
||||
public function setCity(string $city): CustomerAddress
|
||||
{
|
||||
$this->city = $city;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $street
|
||||
* @return $this
|
||||
*/
|
||||
public function setStreet($street)
|
||||
public function setStreet(string $street): CustomerAddress
|
||||
{
|
||||
$this->street = $street;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $building
|
||||
* @return $this
|
||||
*/
|
||||
public function setBuilding($building)
|
||||
public function setBuilding(string $building): CustomerAddress
|
||||
{
|
||||
$this->building = $building;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $house
|
||||
* @return $this
|
||||
*/
|
||||
public function setHouse($house)
|
||||
public function setHouse(string $house): CustomerAddress
|
||||
{
|
||||
$this->house = $house;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $block
|
||||
* @return $this
|
||||
*/
|
||||
public function setBlock($block)
|
||||
public function setBlock(string $block): CustomerAddress
|
||||
{
|
||||
$this->block = $block;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $flat
|
||||
* @return $this
|
||||
*/
|
||||
public function setFlat($flat)
|
||||
public function setFlat(string $flat): CustomerAddress
|
||||
{
|
||||
$this->flat = $flat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $floor
|
||||
* @return $this
|
||||
*/
|
||||
public function setFloor($floor)
|
||||
public function setFloor(string $floor): CustomerAddress
|
||||
{
|
||||
$this->floor = $floor;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $intercomCode
|
||||
* @return $this
|
||||
*/
|
||||
public function setIntercomCode($intercomCode)
|
||||
public function setIntercomCode(string $intercomCode): CustomerAddress
|
||||
{
|
||||
$this->intercomCode = $intercomCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $metro
|
||||
* @return $this
|
||||
*/
|
||||
public function setMetro($metro)
|
||||
public function setMetro(string $metro): CustomerAddress
|
||||
{
|
||||
$this->metro = $metro;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $notes
|
||||
* @return $this
|
||||
*/
|
||||
public function setNotes($notes)
|
||||
public function setNotes(string $notes): CustomerAddress
|
||||
{
|
||||
$this->notes = $notes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @return $this
|
||||
*/
|
||||
public function setText($text)
|
||||
public function setText(string $text): CustomerAddress
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
|
@ -63,10 +63,9 @@ class RetailCrmHistory
|
||||
$GLOBALS['RETAIL_CRM_HISTORY'] = true;
|
||||
|
||||
$newUser = new CUser();
|
||||
$customerBuilder = new CustomerBuilder();
|
||||
|
||||
foreach ($customers as $customer) {
|
||||
$customerBuilder = new CustomerBuilder();
|
||||
|
||||
if (function_exists('retailCrmBeforeCustomerSave')) {
|
||||
$newResCustomer = retailCrmBeforeCustomerSave($customer);
|
||||
if (is_array($newResCustomer) && !empty($newResCustomer)) {
|
||||
@ -175,6 +174,8 @@ class RetailCrmHistory
|
||||
retailCrmAfterCustomerSave($customer);
|
||||
}
|
||||
}
|
||||
|
||||
$customerBuilder->reset();
|
||||
}
|
||||
|
||||
$GLOBALS['RETAIL_CRM_HISTORY'] = false;
|
||||
|
@ -1,3 +1 @@
|
||||
- Исправлено формирование картинок в ICML при включеном CDN
|
||||
- Убрана некорректная запись внешнего идентификатора платежа для новых платежей по истории
|
||||
- Добавлена проверка на длину email при отправке в систему
|
||||
- Исправлена передача полей от одного пользователя к другому в момент загрузки истории из CRM
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?
|
||||
$arModuleVersion = array(
|
||||
"VERSION" => "5.6.2",
|
||||
"VERSION_DATE" => "2021-01-14 16:00:00"
|
||||
);
|
||||
<?php
|
||||
$arModuleVersion = [
|
||||
'VERSION' => '5.6.3',
|
||||
'VERSION_DATE' => '2021-03-23 14:00:00',
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user