1
0
mirror of synced 2024-11-28 08:16:07 +03:00

OnlineConsultant (#154)

This commit is contained in:
RenCurs 2020-11-24 12:14:26 +03:00 committed by GitHub
parent b34da9a756
commit 559ff1d8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 130 additions and 4 deletions

View File

@ -1,3 +1,9 @@
## 2020-11-24 v.5.6.0
* Добавлена возможность активации онлайн-консультанта
* Обновлен список стран
* Улучшена синхронизация ФИО в истории
* Добавлен перевод на английский язык
## 2020-10-14 v.5.5.3
* Исправлено затирание полей при создании заказа по агенту

View File

@ -198,6 +198,47 @@ class RetailcrmConfigProvider
return static::$sitesListCorporate;
}
/**
* isOnlineConsultantEnabled
*
* @return bool
*/
public static function isOnlineConsultantEnabled()
{
return static::getOption(RetailcrmConstants::CRM_ONLINE_CONSULTANT) === 'Y';
}
/**
* getOnlineConsultantScript
*
* @return string
*/
public static function getOnlineConsultantScript()
{
return trim(static::getOption(RetailcrmConstants::CRM_ONLINE_CONSULTANT_SCRIPT, ""));
}
/**
* setOnlineConsultant
*
* @param string $value
*/
public static function setOnlineConsultant($value)
{
static::setOption(RetailcrmConstants::CRM_ONLINE_CONSULTANT, $value);
}
/**
* setOnlineConsultantScript
*
* @param string $value
*/
public function setOnlineConsultantScript($value)
{
static::setOption(RetailcrmConstants::CRM_ONLINE_CONSULTANT_SCRIPT, $value);
}
/**
* getOrderTypes
*

View File

@ -78,4 +78,6 @@ class RetailcrmConstants
const CRM_INTEGRATION_DELIVERY = 'integration_delivery';
const CRM_SHIPMENT_DEDUCTED = 'shipment_deducted';
const SEND_PAYMENT_AMOUNT = 'send_payment_amount';
const CRM_ONLINE_CONSULTANT = 'online_consultant';
const CRM_ONLINE_CONSULTANT_SCRIPT = 'online_consultant_script';
}

View File

@ -0,0 +1,26 @@
<?php
/**
* class RetailCrmOnlineConsultant
*/
class RetailCrmOnlineConsultant
{
/**
* Add a script of online consultant
*
* @return bool
*/
public static function add()
{
if (RetailcrmConfigProvider::isOnlineConsultantEnabled() && ADMIN_SECTION !== true) {
\Bitrix\Main\Page\Asset::getInstance()->addString(
RetailcrmConfigProvider::getOnlineConsultantScript(),
true
);
return true;
} else {
return false;
}
}
}

View File

@ -1 +1,4 @@
- Исправлено затирание полей при создании заказа по агенту
- Добавлена возможность активации онлайн-консультанта
- Обновлен список стран
- Улучшена синхронизация ФИО в истории
- Добавлен перевод на английский язык

View File

@ -38,6 +38,7 @@ CModule::AddAutoloadClasses(
'AddressBuilder' => 'classes/general/AddressBuilder.php',
'AbstractBuilder' => 'classes/general/AbstractBuilder.php',
'BaseModel' => 'classes/general/Model/BaseModel.php',
'RetailCrmService' => 'classes/general/services/RetailCrmService.php'
'RetailCrmService' => 'classes/general/services/RetailCrmService.php',
'RetailCrmOnlineConsultant' => 'classes/general/consultant/RetailCrmOnlineConsultant.php'
)
);

View File

@ -1,5 +1,5 @@
<?
$arModuleVersion = array(
"VERSION" => "5.5.3",
"VERSION_DATE" => "2020-10-15 15:48:00"
"VERSION" => "5.6.0",
"VERSION_DATE" => "2020-11-24 11:42:00"
);

View File

@ -92,3 +92,5 @@ $MESS['PURCHASE_ICML'] = "If enabled, ICML generation will reset the purchase pr
$MESS['PURCHASE_HEADER'] = "Reset purchase price in ICML";
$MESS['PHONE_REQUIRED'] = "In the main module settings «Phone Number is required» option was enabled, so it may cause problems with reverse synchronization. For proper work you must disable this option.";
$MESS['CHANGE_SHIPMENT_STATUS_FROM_CRM'] = "Change the shipment status when corresponding flag is received from retailCRM";
$MESS ['ONLINE_CONSULTANT'] = 'Activate Online Consultant';
$MESS ['ONLINE_CONSULTANT_LABEL'] = 'Online Consultant script';

View File

@ -92,6 +92,9 @@ $MESS ['SHOPS_PRICES_UPLOAD'] = 'Магазины в которые будут
$MESS ['DEMON_COLLECTOR'] = 'Активировать Демон Collector';
$MESS ['DEMON_KEY'] = 'Ключ для';
$MESS ['ONLINE_CONSULTANT'] = 'Активировать Онлайн-консультанта';
$MESS ['ONLINE_CONSULTANT_LABEL'] = 'Скрипт для Онлайн-консультанта';
$MESS ['UNIVERSAL_ANALYTICS'] = 'Включить интеграцию с UA';
$MESS ['ID_UA'] = 'Идентификатор отслеживания:';
$MESS ['INDEX_UA'] = 'Индекс пользовательского параметра:';

View File

@ -453,6 +453,17 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmUa", "add");
}
//online_consultant
if (htmlspecialchars(trim($_POST['online_consultant'] == 'Y'))) {
$onlineConsultant = 'Y';
$onlineConsultantScript = trim($_POST['online_consultant_script']);
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmOnlineConsultant", "add");
} else {
$onlineConsultant = 'N';
$onlineConsultantScript = RetailcrmConfigProvider::getOnlineConsultantScript();
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmOnlineConsultant", "add");
}
//discount_round
if (htmlspecialchars(trim($_POST['discount_round'])) == 'Y') {
$discount_round = 'Y';
@ -564,6 +575,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
COption::SetOptionString($mid, $CRM_COLLECTOR, $collector);
COption::SetOptionString($mid, $CRM_COLL_KEY, serialize(RCrmActions::clearArr($collectorKeys)));
RetailCrmConfigProvider::setOnlineConsultant($onlineConsultant);
RetailCrmConfigProvider::setOnlineConsultantScript($onlineConsultantScript);
COption::SetOptionString($mid, $CRM_UA, $ua);
COption::SetOptionString($mid, $CRM_UA_KEYS, serialize(RCrmActions::clearArr($uaKeys)));
COption::SetOptionString($mid, $CRM_DIMENSIONS, $orderDimensions);
@ -686,6 +700,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
$optionCollector = COption::GetOptionString($mid, $CRM_COLLECTOR, 0);
$optionCollectorKeys = unserialize(COption::GetOptionString($mid, $CRM_COLL_KEY));
$optionOnlineConsultant = RetailcrmConfigProvider::isOnlineConsultantEnabled();
$optionOnlineConsultantScript = RetailcrmConfigProvider::getOnlineConsultantScript();
$optionUa = COption::GetOptionString($mid, $CRM_UA, 0);
$optionUaKeys = unserialize(COption::GetOptionString($mid, $CRM_UA_KEYS));
@ -833,6 +850,16 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
return true;
});
$('.r-consultant-button label').change(function(){
if($(this).find('input').is(':checked') === true){
$('tr.r-consultant').show('slow');
} else if($(this).find('input').is(':checked') === false){
$('tr.r-consultant').hide('slow');
}
return true;
});
$('.r-purchaseprice-button label').change(function() {
if($(this).find('input').is(':checked') === true) {
$('tr.r-purchaseprice').show('slow');
@ -1424,6 +1451,21 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
</tr>
<?php endforeach;?>
<tr class="heading r-consultant-button">
<td colspan="2" class="option-other-heading">
<b>
<label><input class="addr" type="checkbox" name="online_consultant" value="Y" <?php if ($optionOnlineConsultant) echo "checked"; ?>><?php echo GetMessage('ONLINE_CONSULTANT'); ?></label>
</b>
</td>
</tr>
<tr class="r-consultant" <?php if (!$optionOnlineConsultant) echo 'style="display: none;"'; ?>>
<td class="adm-detail-content-cell-l" width="45%"><?php echo GetMessage('ONLINE_CONSULTANT_LABEL')?></td>
<td class="adm-detail-content-cell-r" width="55%">
<textarea name="online_consultant_script"><?php echo $optionOnlineConsultantScript; ?></textarea>
</td>
</tr>
<tr class="heading r-dc-button">
<td colspan="2" class="option-other-heading">
<b>