From 3f084d1eeeb94600860274d21a03c638a327b67f Mon Sep 17 00:00:00 2001 From: Ivan Chaplygin Date: Fri, 14 Jul 2023 14:48:35 +0300 Subject: [PATCH] =?UTF-8?q?ref=20#91040=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=88=D0=B0=D0=B1?= =?UTF-8?q?=D0=BB=D0=BE=D0=BD=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=BF=D0=BE=D0=B4=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B5=20=D1=81=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=BE?= =?UTF-8?q?=D0=BC=D0=BC=D0=BE=D0=B9=20=D0=BB=D0=BE=D1=8F=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B8=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/.default/lang/ru/template.php | 1 + .../templates/.default/template.php | 13 +++++++++ .../install/export/sub-register/index.php | 21 ++++++++++++++ .../component/builder/api/customerbuilder.php | 2 +- intaro.retailcrm/lib/model/bitrix/user.php | 28 +++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 intaro.retailcrm/install/export/sub-register/index.php diff --git a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php index 69faad47..c9bdd8d6 100644 --- a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php +++ b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/lang/ru/template.php @@ -81,3 +81,4 @@ $MESS["SEC"] = "сек."; $MESS["RESEND_SMS"] = "Отправить смс повторно"; $MESS["RESEND_POSSIBLE"] = "Повторная отправка смс возможна через"; $MESS["LOYALTY_CONNECTION_ERROR"] = "Возникли проблемы с подключением к удаленному серверу. Попробуйте перезагрузить страницу."; +$MESS["SUBSCRIBE_EMAIL"] = "Подписаться на события"; diff --git a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php index 4ae8931c..7f0a9e74 100644 --- a/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php +++ b/intaro.retailcrm/install/export/local/components/intaro/main.register/templates/.default/template.php @@ -540,6 +540,19 @@ if ($arResult["LOYALTY_CONNECTION_ERROR"] === true) { :* + + + + +
+
+ +
+
+ + SetTitle('Регистрация'); +?> + +IncludeComponent( + 'bitrix:main.register', + 'default_subscribe', + [ + 'AUTH' => 'Y', + 'REQUIRED_FIELDS' => [], + 'SET_TITLE' => 'Y', + 'SHOW_FIELDS' => ['NAME'], + 'SUCCESS_PAGE' => '', + 'USER_PROPERTY' => [], + 'USER_PROPERTY_NAME' => '', + 'USE_BACKURL' => 'Y', + ] +); ?> + + diff --git a/intaro.retailcrm/lib/component/builder/api/customerbuilder.php b/intaro.retailcrm/lib/component/builder/api/customerbuilder.php index 0a1c9bbe..2f022fb0 100644 --- a/intaro.retailcrm/lib/component/builder/api/customerbuilder.php +++ b/intaro.retailcrm/lib/component/builder/api/customerbuilder.php @@ -162,7 +162,7 @@ class CustomerBuilder implements BuilderInterface $this->customer->externalId = $this->user->getId(); $this->customer->email = $this->user->getEmail(); $this->customer->createdAt = $this->user->getDateRegister(); - $this->customer->subscribed = false; + $this->customer->subscribed = !empty($this->user->getSubscribe()); } /** diff --git a/intaro.retailcrm/lib/model/bitrix/user.php b/intaro.retailcrm/lib/model/bitrix/user.php index 757057c3..1fb2ae11 100644 --- a/intaro.retailcrm/lib/model/bitrix/user.php +++ b/intaro.retailcrm/lib/model/bitrix/user.php @@ -524,6 +524,14 @@ class User extends AbstractSerializableModel */ private $loyalty; + /** + * @var bool + * + * @Mapping\Type("boolean") + * @Mapping\SerializedName("UF_SUBSCRIBE_USER_EMAIL") + */ + private $subscribe; + /** * @return int */ @@ -1730,4 +1738,24 @@ class User extends AbstractSerializableModel { $this->loyalty = $loyalty; } + + /** + * @return bool + */ + public function getSubscribe() + { + return $this->subscribe; + } + + + /** + * @param bool $subscribe + * @return $this + */ + public function setSubscribe($subscribe) + { + $this->subscribe = $subscribe; + + return $this; + } }