Replace CustomerBuilder
This commit is contained in:
commit
e422557514
@ -67,4 +67,9 @@ class AddressBuilder extends AbstractBuilder implements RetailcrmBuilderInterfac
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->customerAddress = new CustomerAddress();
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,10 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param Customer $customer
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomer($customer)
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -79,6 +80,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
public function setDataCrm($dataCrm)
|
||||
{
|
||||
$this->dataCrm = $dataCrm;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -89,6 +91,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
public function setUser($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -96,9 +99,10 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param int $registeredUserID
|
||||
* @return $this
|
||||
*/
|
||||
public function setRegisteredUserID($registeredUserID)
|
||||
public function setRegisteredUserID(int $registeredUserID)
|
||||
{
|
||||
$this->registeredUserID = $registeredUserID;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -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']);
|
||||
@ -218,7 +222,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param string $login
|
||||
* @return $this
|
||||
*/
|
||||
public function setLogin($login)
|
||||
public function setLogin(string $login)
|
||||
{
|
||||
$this->customer->setLogin($login);
|
||||
|
||||
@ -229,10 +233,17 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
* @param string $email
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail($email)
|
||||
public function setEmail(string $email)
|
||||
{
|
||||
$this->customer->setEmail($email);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function reset(): void
|
||||
{
|
||||
$this->customer = new Customer();
|
||||
$this->customerAddress = new CustomerAddress();
|
||||
$this->addressBuilder->reset();
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ class CustomerAddress extends BaseModel
|
||||
* @param string $floor
|
||||
* @return $this
|
||||
*/
|
||||
public function setFloor($floor)
|
||||
public function setFloor(string $floor)
|
||||
{
|
||||
$this->floor = $floor;
|
||||
|
||||
|
@ -174,6 +174,8 @@ class RetailCrmHistory
|
||||
retailCrmAfterCustomerSave($customer);
|
||||
}
|
||||
}
|
||||
|
||||
$customerBuilder->reset();
|
||||
}
|
||||
|
||||
$GLOBALS['RETAIL_CRM_HISTORY'] = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user