From e816d8acf01f2b47eca163a5af8056db9a37f0d6 Mon Sep 17 00:00:00 2001 From: Ivan Chaplygin Date: Tue, 29 Aug 2023 15:53:59 +0300 Subject: [PATCH] =?UTF-8?q?ref=20#91590=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=9F=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D0=B0=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=B8=D0=BA=D0=B0=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0?= =?UTF-8?q?=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20(=D0=BF=D1=80=D0=B5?= =?UTF-8?q?=D0=B8=D0=BC=D1=83=D1=89=D0=B5=D1=81=D1=82=D0=B2=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D1=81?= =?UTF-8?q?=D1=8F=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D0=B0=D0=BF?= =?UTF-8?q?=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- intaro.retailcrm/lang/en/install/step1.php | 4 ++ intaro.retailcrm/lang/en/install/step11.php | 2 + intaro.retailcrm/lang/en/options.php | 5 ++ intaro.retailcrm/lang/ru/install/step1.php | 4 +- intaro.retailcrm/lang/ru/install/step11.php | 2 +- intaro.retailcrm/lang/ru/options.php | 4 +- intaro.retailcrm/options.php | 54 +++++++++++---------- 7 files changed, 44 insertions(+), 31 deletions(-) diff --git a/intaro.retailcrm/lang/en/install/step1.php b/intaro.retailcrm/lang/en/install/step1.php index 51f85434..6f4fd825 100644 --- a/intaro.retailcrm/lang/en/install/step1.php +++ b/intaro.retailcrm/lang/en/install/step1.php @@ -15,3 +15,7 @@ $MESS ['ERR_METHOD_NOT_FOUND'] = 'Check availability of API methods for current $MESS ['INFO_1'] = 'Enter the address of RetailCRM instance (for example, https://demo.retailcrm.ru) and API key.'; $MESS ['INFO_2'] = 'API key can be generated when the store is registered in RetailCRM (Administration > Integration).'; $MESS ['INFO_3'] = 'Store code in 1C-Bitrix must correspond with the store code in RetailCRM (Administration > Stores).'; +$MESS ['ERR_COUNT_SITES'] = 'The API Key you entered relates to more than one store. +Change the access settings for the API key, it should work with only one store in CRM'; +$MESS ['ERR_CURRENCY_SITES'] = 'The currency of the site differs from the currency of the store in CRM. +For the integration to work correctly, the currencies in CRM and CMS must match'; diff --git a/intaro.retailcrm/lang/en/install/step11.php b/intaro.retailcrm/lang/en/install/step11.php index e9af525e..df60160e 100644 --- a/intaro.retailcrm/lang/en/install/step11.php +++ b/intaro.retailcrm/lang/en/install/step11.php @@ -10,3 +10,5 @@ $MESS ['ERR_0'] = 'Server connection timeout error.'; $MESS ['ERR_FIELDS_API_HOST'] = 'Fields are filled incorrectly.'; $MESS ['INFO_1'] = 'Set the correspondence between 1C-Bitrix and RetailCRM stores.'; $MESS ['INFO_2'] = 'All your stores in RetailCRM must have a common API key!'; +$MESS ['ERR_CURRENCY_SITES'] = 'The currency of the site differs from the currency of the store in CRM. +For the integration to work correctly, the currencies in CRM and CMS must match'; diff --git a/intaro.retailcrm/lang/en/options.php b/intaro.retailcrm/lang/en/options.php index 9f1ef83b..df3f536b 100644 --- a/intaro.retailcrm/lang/en/options.php +++ b/intaro.retailcrm/lang/en/options.php @@ -100,5 +100,10 @@ $MESS ['ONLINE_CONSULTANT_LABEL'] = 'Online Consultant script'; $MESS ['INTEGRATION_PAYMENT_LIST'] = 'The status will not be transferred for integration payments'; $MESS ['INTEGRATIONS'] = ' (integration)'; +$MESS ['ERR_COUNT_SITES'] = 'The API Key you entered relates to more than one store. +Change the access settings for the API key, it should work with only one store in CRM'; +$MESS ['ERR_CURRENCY_SITES'] = 'The currency of the site differs from the currency of the store in CRM. +For the integration to work correctly, the currencies in CRM and CMS must match'; + $MESS ['ACTIVITY_SETTINGS'] = 'Module activity settings'; $MESS ['DEACTIVATE_MODULE'] = 'Deactivate the module'; diff --git a/intaro.retailcrm/lang/ru/install/step1.php b/intaro.retailcrm/lang/ru/install/step1.php index 8d0634e7..7d53f532 100644 --- a/intaro.retailcrm/lang/ru/install/step1.php +++ b/intaro.retailcrm/lang/ru/install/step1.php @@ -12,9 +12,9 @@ $MESS ['ERR_0'] = 'Превышено время ожидания ответа $MESS ['ERR_FIELDS_API_HOST'] = 'Неверно заполнены поля.'; $MESS ['ERR_METHOD_NOT_FOUND'] = 'Проверьте доступность методов API по текущему ключу.'; $MESS ['ERR_COUNT_SITES'] = 'Введенный вами API Ключ относится более чем к одному магазину. -Измените настройки доступа для API ключа. Он должен работать только с одним магазином в CRM.'; +Измените настройки доступа для API ключа, он должен работать только с одним магазином в CRM'; $MESS ['ERR_CURRENCY_SITES'] = 'Валюта сайта отличается от валюты магазина в CRM. -Настройте валюты в CRM и CMS для корректной работы интеграции.'; +Для корректной работы интеграции, валюты в CRM и CMS должны совпадать'; //$MESS ['URL_NOT_FOUND'] = 'В настройках одного или нескольких сайтов не заполнено поле "URL сервера".'; $MESS ['INFO_1'] = 'Введите адрес экземпляра RetailCRM (например, https://demo.retailcrm.ru) и API-ключ.'; $MESS ['INFO_2'] = 'API-ключ можно сгенерировать при регистрации магазина в RetailCRM (Администрирование > Интеграция).'; diff --git a/intaro.retailcrm/lang/ru/install/step11.php b/intaro.retailcrm/lang/ru/install/step11.php index 1a1d0cb7..81ca7627 100644 --- a/intaro.retailcrm/lang/ru/install/step11.php +++ b/intaro.retailcrm/lang/ru/install/step11.php @@ -11,4 +11,4 @@ $MESS ['ERR_FIELDS_API_HOST'] = 'Неверно заполнены поля.'; $MESS ['INFO_1'] = 'Задайте соответствия между Вашими магазинами в 1С-Битрикс и RetailCRM.'; $MESS ['INFO_2'] = 'У всех Ваших магазинов в RetailCRM должен быть общий API-ключ!'; $MESS ['ERR_CURRENCY_SITES'] = 'Валюта сайта отличается от валюты магазина в CRM. -Настройте валюты в CRM и CMS для корректной работы интеграции.'; \ No newline at end of file +Для корректной работы интеграции, валюты в CRM и CMS должны совпадать'; \ No newline at end of file diff --git a/intaro.retailcrm/lang/ru/options.php b/intaro.retailcrm/lang/ru/options.php index d6559ee3..1424dc2e 100644 --- a/intaro.retailcrm/lang/ru/options.php +++ b/intaro.retailcrm/lang/ru/options.php @@ -28,9 +28,9 @@ $MESS ['INTEGRATION_PAYMENT_LIST'] = 'Для интеграционных опл $MESS ['INTEGRATIONS'] = ' (интеграционная)'; $MESS ['ERR_COUNT_SITES'] = 'Введенный вами API Ключ относится более чем к одному магазину. -Измените настройки доступа для API ключа. Он должен работать только с одним магазином в CRM.'; +Измените настройки доступа для API ключа, он должен работать только с одним магазином в CRM'; $MESS ['ERR_CURRENCY_SITES'] = 'Валюта сайта отличается от валюты магазина в CRM. -Настройте валюты в CRM и CMS для корректной работы интеграции.'; +Для корректной работы интеграции, валюты в CRM и CMS должны совпадать'; $MESS ['ICRM_OPTIONS_SUBMIT_TITLE'] = 'Сохранить настройки'; $MESS ['ICRM_OPTIONS_SUBMIT_VALUE'] = 'Сохранить'; diff --git a/intaro.retailcrm/options.php b/intaro.retailcrm/options.php index c961c487..022f4812 100644 --- a/intaro.retailcrm/options.php +++ b/intaro.retailcrm/options.php @@ -1064,43 +1064,45 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) { $errorsText = []; - if (count($arResult['arSites']) === 1 && count($arResult['sitesList']) > 1) { - $errorsText[] = GetMessage('ERR_COUNT_SITES'); + if (preg_match('/&errc=ERR_(.*)/is', $APPLICATION->GetCurUri(), $matches)) { + $errorsText[] = urldecode($matches[1]); } - if (count($arResult['arSites']) > 1) { - foreach ($optionsSitesList as $LID => $crmCode) { - if (empty($crmCode)) { - continue; - } + if (empty($errorsText)) { + if (count($arResult['arSites']) === 1 && count($arResult['sitesList']) > 1) { + $errorsText[] = GetMessage('ERR_COUNT_SITES'); + } + if (count($arResult['arSites']) > 1) { + foreach ($optionsSitesList as $LID => $crmCode) { + if (empty($crmCode)) { + continue; + } + + $currentCurrency = $baseCurrency; + + if (isset($arResult['arCurrencySites'][$LID])) { + $currentCurrency = $arResult['arCurrencySites'][$LID]; + } + + if ($currentCurrency !== $arResult['sitesList'][$crmCode]['currency']) { + $errorsText[] = GetMessage('ERR_CURRENCY_SITES') . ' (' . $arResult['sitesList'][$crmCode]['name'] . ')'; + } + } + } else { $currentCurrency = $baseCurrency; + $LID = $arResult['arSites'][0]['LID']; if (isset($arResult['arCurrencySites'][$LID])) { $currentCurrency = $arResult['arCurrencySites'][$LID]; } - if ($currentCurrency !== $arResult['sitesList'][$crmCode]['currency']) { - $errorsText[] = GetMessage('ERR_CURRENCY_SITES') . ' (' . $arResult['sitesList'][$crmCode]['name'] . ')'; + $crmSite = reset($arResult['sitesList']); + + if ($currentCurrency !== $crmSite['currency']) { + $errorsText[] = GetMessage('ERR_CURRENCY_SITES') . ' (' . $crmSite['name'] . ')'; } } - } else { - $currentCurrency = $baseCurrency; - $LID = $arResult['arSites'][0]['LID']; - - if (isset($arResult['arCurrencySites'][$LID])) { - $currentCurrency = $arResult['arCurrencySites'][$LID]; - } - - $crmSite = reset($arResult['sitesList']); - - if ($currentCurrency !== $crmSite['currency']) { - $errorsText[] = GetMessage('ERR_CURRENCY_SITES') . ' (' . $crmSite['name'] . ')'; - } - } - - if (preg_match('/&errc=ERR_(.*)/is', $APPLICATION->GetCurUri(), $matches)){ - $errorsText[] = urldecode($matches[1]); } $customFields = [['code' => '__default_empty_value__', 'name' => GetMessage('SELECT_VALUE')]];