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