parent
46570494a3
commit
a66ec1d663
@ -1,5 +1,8 @@
|
|||||||
|
## 2023-12-29 v.6.5.4
|
||||||
|
- Исправлена передача адреса доставки
|
||||||
|
|
||||||
## 2023-12-27 v.6.5.3
|
## 2023-12-27 v.6.5.3
|
||||||
- Исправлен баг с двойной сериализацией при получении списка пользователей
|
- Исправлена ошибка с двойной сериализацией при получении списка пользователей
|
||||||
|
|
||||||
## 2023-12-21 v.6.5.2
|
## 2023-12-21 v.6.5.2
|
||||||
- Добавлена функциональность, позволяющая выгружать из CRM в Bitrix заказы с определенным способом оформления
|
- Добавлена функциональность, позволяющая выгружать из CRM в Bitrix заказы с определенным способом оформления
|
||||||
|
@ -136,7 +136,31 @@ class RCrmActions
|
|||||||
public static function OrderPropsList()
|
public static function OrderPropsList()
|
||||||
{
|
{
|
||||||
$bitrixPropsList = [];
|
$bitrixPropsList = [];
|
||||||
$arPropsAll = OrderPropsTable::getList(['select' => ['*'], 'filter' => ['CODE' => '_%']]);
|
$arPropsAll = OrderPropsTable::getList([
|
||||||
|
'select' => ['*'],
|
||||||
|
'filter' => [
|
||||||
|
['CODE' => '_%'],
|
||||||
|
['!=TYPE' => 'LOCATION']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
while ($prop = $arPropsAll->Fetch()) {
|
||||||
|
$bitrixPropsList[$prop['PERSON_TYPE_ID']][] = $prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bitrixPropsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLocationProps()
|
||||||
|
{
|
||||||
|
$bitrixPropsList = [];
|
||||||
|
$arPropsAll = OrderPropsTable::getList([
|
||||||
|
'select' => ['*'],
|
||||||
|
'filter' => [
|
||||||
|
['CODE' => '_%'],
|
||||||
|
['TYPE' => 'LOCATION']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
while ($prop = $arPropsAll->Fetch()) {
|
while ($prop = $arPropsAll->Fetch()) {
|
||||||
$bitrixPropsList[$prop['PERSON_TYPE_ID']][] = $prop;
|
$bitrixPropsList[$prop['PERSON_TYPE_ID']][] = $prop;
|
||||||
|
@ -792,59 +792,93 @@ class RetailCrmHistory
|
|||||||
} else {
|
} else {
|
||||||
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||||
}
|
}
|
||||||
} elseif (is_array($order['delivery']['address']) && array_key_exists($key, $order['delivery']['address'])) {
|
} elseif ($propsKey[$orderProp]['TYPE'] === 'LOCATION'
|
||||||
if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') {
|
&& (
|
||||||
|
isset($order['delivery']['address']['city'])
|
||||||
|
|| isset($order['delivery']['address']['region'])
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
$parameters = [
|
||||||
|
'filter' => [
|
||||||
|
'NAME.LANGUAGE_ID' => 'ru'
|
||||||
|
],
|
||||||
|
'limit' => 1,
|
||||||
|
'select' => ['*']
|
||||||
|
];
|
||||||
|
|
||||||
if (!empty($order['delivery']['address'][$key])) {
|
$somePropValue = $propertyCollection
|
||||||
$parameters['filter']['NAME.LANGUAGE_ID'] = 'ru';
|
->getItemByOrderPropertyId($propsKey[$orderProp]['ID'])
|
||||||
$parameters['limit'] = 1;
|
;
|
||||||
$parameters['select'] = ['*'];
|
|
||||||
|
|
||||||
// if address have a dot
|
$codeLocation = $somePropValue->getValue();
|
||||||
$loc = explode('.', $order['delivery']['address'][$key]);
|
$subParameters = $parameters;
|
||||||
if (count($loc) == 1) {
|
$subParameters['filter']['=CODE'] = RCrmActions::fromJSON($codeLocation);
|
||||||
|
$subLocation = Finder::find($subParameters)->fetch();
|
||||||
|
|
||||||
|
if (!isset($order['delivery']['address']['city'])) {
|
||||||
|
$parameters['filter']['=ID'] = RCrmActions::fromJSON($subLocation['CITY_ID']);
|
||||||
|
} else { // В системе город пишется с префиксом (г. Москва)
|
||||||
|
$loc = explode('.', $order['delivery']['address']['city']);
|
||||||
|
|
||||||
|
if (count($loc) === 1) {
|
||||||
$parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[0]));
|
$parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[0]));
|
||||||
} else {
|
} else {
|
||||||
$parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[1]));
|
$parameters['filter']['=NAME.NAME'] = RCrmActions::fromJSON(trim($loc[1]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$location = Finder::find(
|
if (!isset($order['delivery']['address']['region'])) {
|
||||||
$parameters
|
$parameters['filter']['=PARENT.ID'] = RCrmActions::fromJSON($subLocation['REGION_ID']);
|
||||||
)->fetch();
|
} else {
|
||||||
|
$parameters['filter']['PARENT.NAME.NAME'] = RCrmActions::fromJSON(trim($order['delivery']['address']['region']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$location = Finder::find($parameters)->fetch();
|
||||||
|
|
||||||
|
//При существовании района в локации, фильтр по региону изменяется
|
||||||
|
if (empty($location)) {
|
||||||
|
if (!isset($order['delivery']['address']['region'])) {
|
||||||
|
$parameters['filter']['=PARENT.PARENT.ID'] = RCrmActions::fromJSON($subLocation['REGION_ID']);
|
||||||
|
unset($parameters['filter']['=PARENT.ID']);
|
||||||
|
} else {
|
||||||
|
$parameters['filter']['PARENT.PARENT.NAME.NAME'] = RCrmActions::fromJSON(trim($order['delivery']['address']['region']));
|
||||||
|
unset($parameters['filter']['PARENT.NAME.NAME']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$location = Finder::find($parameters)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($location)) {
|
if (!empty($location)) {
|
||||||
$somePropValue = $propertyCollection
|
self::setProp($somePropValue, $location['CODE']);
|
||||||
->getItemByOrderPropertyId($propsKey[$orderProp]['ID'])
|
|
||||||
;
|
|
||||||
try {
|
|
||||||
self::setProp($somePropValue, $location['CODE']);
|
|
||||||
} catch (ArgumentException $argumentException) {
|
|
||||||
RCrmActions::eventLog(
|
|
||||||
'RetailCrmHistory::orderHistory',
|
|
||||||
'RetailCrmHistory::setProp',
|
|
||||||
'Location parameter is incorrect in order number=' . $order['number']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
if (isset($order['externalId'])) {
|
||||||
|
$message = 'ExternalId: ' . $order['externalId'];
|
||||||
|
} else {
|
||||||
|
$message = 'CRM id: ' . $order['id'];
|
||||||
|
}
|
||||||
|
|
||||||
RCrmActions::eventLog(
|
RCrmActions::eventLog(
|
||||||
'RetailCrmHistory::orderHistory',
|
'RetailCrmHistory::orderHistory',
|
||||||
'RetailCrmHistory::setProp',
|
'RetailCrmHistory::setProp',
|
||||||
sprintf(
|
'Ошибка обновления локации в заказе. ' . $message
|
||||||
'Error location. %s is empty in order number=%s',
|
|
||||||
$order['delivery']['address'][$key],
|
|
||||||
$order['number']
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (\Exception $exception) {
|
||||||
$somePropValue = $propertyCollection
|
RCrmActions::eventLog(
|
||||||
->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
'RetailCrmHistory::orderHistory',
|
||||||
self::setProp(
|
'RetailCrmHistory::setProp',
|
||||||
$somePropValue,
|
'Error when updating a location. Order: '
|
||||||
RCrmActions::fromJSON($order['delivery']['address'][$key])
|
. $order['number'] . ' message:' . $exception->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} elseif (is_array($order['delivery']['address']) && array_key_exists($key, $order['delivery']['address'])) {
|
||||||
|
$somePropValue = $propertyCollection
|
||||||
|
->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||||
|
self::setProp(
|
||||||
|
$somePropValue,
|
||||||
|
RCrmActions::fromJSON($order['delivery']['address'][$key])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,6 @@ class RetailCrmOrder
|
|||||||
$order['contragent']['contragentType'] = $arParams['optionsContragentType'][$arOrder['PERSON_TYPE_ID']];
|
$order['contragent']['contragentType'] = $arParams['optionsContragentType'][$arOrder['PERSON_TYPE_ID']];
|
||||||
|
|
||||||
$countryList = BitrixOrderService::getCountryList();
|
$countryList = BitrixOrderService::getCountryList();
|
||||||
$deliveryAddress = ['city' => '', 'text' => '', 'index' => '', 'region' => '', 'countryIso' => ''];
|
|
||||||
$isSendCustomFields = 'N';
|
$isSendCustomFields = 'N';
|
||||||
|
|
||||||
if (method_exists(RCrmActions::class, 'convertCmsFieldToCrmValue')) {
|
if (method_exists(RCrmActions::class, 'convertCmsFieldToCrmValue')) {
|
||||||
@ -156,33 +155,34 @@ class RetailCrmOrder
|
|||||||
|
|
||||||
$order[$search] = $prop['VALUE'][0];//phone, email
|
$order[$search] = $prop['VALUE'][0];//phone, email
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ($prop['TYPE'] === 'LOCATION' && isset($prop['VALUE'][0]) && $prop['VALUE'][0] != '') {
|
||||||
|
$arLoc = LocationTable::getByCode($prop['VALUE'][0])->fetch();
|
||||||
|
|
||||||
|
if ($arLoc) {
|
||||||
|
$deliveryLocation = CSaleLocation::GetByID($arLoc['ID']);
|
||||||
|
$order['delivery']['address']['region'] = $deliveryLocation['REGION_NAME'] ?? '';
|
||||||
|
$city = $deliveryLocation['CITY_NAME'] ?? null;
|
||||||
|
|
||||||
|
if (count($countryList) > 0 && isset($countryList[$deliveryLocation['COUNTRY_NAME']])) {
|
||||||
|
$order['countryIso'] = $countryList[$deliveryLocation['COUNTRY_NAME']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$prop['VALUE'][0] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($prop['VALUE'][0])) {
|
||||||
|
$order['delivery']['address'][$search] = $prop['VALUE'][0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($prop['CODE'] === 'ZIP' && !empty($prop['VALUE'][0])) {
|
|
||||||
$deliveryAddress['index'] = $prop['VALUE'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($prop['CODE'] === 'CITY' && $deliveryAddress['city'] === '' && !empty($prop['VALUE'][0])) {
|
|
||||||
$deliveryAddress['city'] = $prop['VALUE'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($prop['CODE'] === 'ADDRESS' && !empty($prop['VALUE'][0])) {
|
|
||||||
$deliveryAddress['text'] = $prop['VALUE'][0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($prop['TYPE'] === 'LOCATION' && isset($prop['VALUE'][0]) && !empty($prop['VALUE'][0])) {
|
|
||||||
$arLoc = LocationTable::getByCode($prop['VALUE'][0])->fetch();
|
|
||||||
$deliveryLocation = CSaleLocation::GetByID($arLoc['ID']);
|
|
||||||
|
|
||||||
$deliveryAddress['city'] = $deliveryLocation['CITY_NAME'] ?? '';
|
|
||||||
$deliveryAddress['region'] = $deliveryLocation['REGION_NAME'] ?? '';
|
|
||||||
$deliveryAddress['countryIso'] = $countryList['COUNTRY_NAME'] ?? '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Удаляем пустые значения
|
//Перезапись города при его наличии в свойстве типа LOCATION
|
||||||
$deliveryAddress = array_filter($deliveryAddress);
|
if (isset($city)) {
|
||||||
|
$order['delivery']['address']['city'] = $city;
|
||||||
|
}
|
||||||
|
|
||||||
// Пункт самовывоза
|
// Пункт самовывоза
|
||||||
$pickupPointAddress = '';
|
$pickupPointAddress = '';
|
||||||
@ -193,8 +193,6 @@ class RetailCrmOrder
|
|||||||
|
|
||||||
if ($pickupPointAddress !== '') {
|
if ($pickupPointAddress !== '') {
|
||||||
$order['delivery']['address']['text'] = $pickupPointAddress;
|
$order['delivery']['address']['text'] = $pickupPointAddress;
|
||||||
} elseif(!empty($deliveryAddress)) {
|
|
||||||
$order['delivery']['address'] = $deliveryAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Deliverys
|
//Deliverys
|
||||||
|
@ -1 +1 @@
|
|||||||
- Исправлен баг с двойной сериализацией при получении списка пользователей
|
- Исправлена передача адреса доставки
|
||||||
|
@ -658,6 +658,7 @@ class intaro_retailcrm extends CModule
|
|||||||
//new page
|
//new page
|
||||||
//form orderProps
|
//form orderProps
|
||||||
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
||||||
|
$arResult['locationProp'] = RCrmActions::getLocationProps();
|
||||||
|
|
||||||
$request = Application::getInstance()->getContext()->getRequest();
|
$request = Application::getInstance()->getContext()->getRequest();
|
||||||
|
|
||||||
@ -803,8 +804,11 @@ class intaro_retailcrm extends CModule
|
|||||||
$orderTypesList = RCrmActions::OrderTypesList(RCrmActions::getSitesList());
|
$orderTypesList = RCrmActions::OrderTypesList(RCrmActions::getSitesList());
|
||||||
|
|
||||||
$orderTypesArr = [];
|
$orderTypesArr = [];
|
||||||
|
$addressDetailOptions = [];
|
||||||
|
|
||||||
foreach ($orderTypesList as $orderType) {
|
foreach ($orderTypesList as $orderType) {
|
||||||
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
|
$orderTypesArr[$orderType['ID']] = htmlspecialchars(trim($_POST['order-type-' . $orderType['ID']]));
|
||||||
|
$addressDetailOptions[$orderType['ID']] = $_POST['address-detail-' . $orderType['ID']];
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderPropsArr = [];
|
$orderPropsArr = [];
|
||||||
@ -846,6 +850,7 @@ class intaro_retailcrm extends CModule
|
|||||||
$contragentTypeArr[$orderType['ID']] = htmlspecialchars(trim($_POST['contragent-type-' . $orderType['ID']]));
|
$contragentTypeArr[$orderType['ID']] = htmlspecialchars(trim($_POST['contragent-type-' . $orderType['ID']]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COption::SetOptionString($this->MODULE_ID, $this->CRM_ADDRESS_OPTIONS, serialize($addressDetailOptions));
|
||||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
|
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_PROPS, serialize(RCrmActions::clearArr($orderPropsArr)));
|
||||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOM_FIELDS, serialize(RCrmActions::clearArr($customFieldsArr)));
|
COption::SetOptionString($this->MODULE_ID, $this->CRM_CUSTOM_FIELDS, serialize(RCrmActions::clearArr($customFieldsArr)));
|
||||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
|
COption::SetOptionString($this->MODULE_ID, $this->CRM_LEGAL_DETAILS, serialize(RCrmActions::clearArr($legalDetailsArr)));
|
||||||
|
@ -32,6 +32,7 @@ if (count($arResult['arSites']) === 1) {
|
|||||||
if (!isset($arResult['bitrixOrderTypesList'])) {
|
if (!isset($arResult['bitrixOrderTypesList'])) {
|
||||||
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
|
$arResult['bitrixOrderTypesList'] = RCrmActions::OrderTypesList($arResult['arSites']);
|
||||||
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
||||||
|
$arResult['locationProp'] = RCrmActions::getLocationProps();
|
||||||
$arResult['ORDER_PROPS'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_ORDER_PROPS, 0));
|
$arResult['ORDER_PROPS'] = unserialize(COption::GetOptionString($MODULE_ID, $CRM_ORDER_PROPS, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,9 +81,43 @@ if (isset($arResult['ORDER_PROPS'])) {
|
|||||||
<?php CJSCore::Init(['jquery']);?>
|
<?php CJSCore::Init(['jquery']);?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function updateAddressList()
|
||||||
|
{
|
||||||
|
splitName = $(this).attr('name').split('-');
|
||||||
|
orderType = splitName[2];
|
||||||
|
|
||||||
|
if (parseInt($(this).val()) === 1) {
|
||||||
|
let locationElement = document.getElementById('locationElement-' + orderType);
|
||||||
|
let replacedSelect = document.getElementsByName('order-prop-text-' + orderType);
|
||||||
|
let replacedElement = replacedSelect[0].parentNode.parentNode;
|
||||||
|
let addedLocation = locationElement.cloneNode(true);
|
||||||
|
|
||||||
|
addedLocation.querySelector(`select`).setAttribute("name", 'order-prop-text-' + orderType);
|
||||||
|
addedLocation.removeAttribute("hidden");
|
||||||
|
addedLocation.removeAttribute("id");
|
||||||
|
replacedElement.replaceWith(addedLocation);
|
||||||
|
|
||||||
|
$('tr.address-detail-' + orderType).show('slow');
|
||||||
|
|
||||||
|
} else if (parseInt($(this).val()) === 0) {
|
||||||
|
let locationElement = document.getElementById('textAddressElement-' + orderType);
|
||||||
|
let replacedSelect = document.getElementsByName('order-prop-text-' + orderType);
|
||||||
|
let replacedElement = replacedSelect[0].parentNode.parentNode;
|
||||||
|
let addedLocation = locationElement.cloneNode(true);
|
||||||
|
|
||||||
|
addedLocation.querySelector(`select`).setAttribute("name", 'order-prop-text-' + orderType);
|
||||||
|
addedLocation.removeAttribute("hidden");
|
||||||
|
addedLocation.removeAttribute("id");
|
||||||
|
replacedElement.replaceWith(addedLocation);
|
||||||
|
|
||||||
|
$('tr.address-detail-' + orderType).hide('slow');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
const individual = $("[name='contragent-type-1']").val();
|
const individual = $("[name='contragent-type-1']").val();
|
||||||
const legalEntity = $("[name='contragent-type-2']").val();
|
const legalEntity = $("[name='contragent-type-2']").val();
|
||||||
|
$('input:checked[name^="address-detail-"]').each(updateAddressList);
|
||||||
|
|
||||||
if (legalEntity !== 'individual') {
|
if (legalEntity !== 'individual') {
|
||||||
$('tr.legal-detail-2').each(function(){
|
$('tr.legal-detail-2').each(function(){
|
||||||
@ -102,15 +137,7 @@ if (isset($arResult['ORDER_PROPS'])) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('input.addr').change(function(){
|
$('input[name^="address-detail-"]').change(updateAddressList);
|
||||||
const splitName = $(this).attr('name').split('-');
|
|
||||||
const orderType = splitName[2];
|
|
||||||
|
|
||||||
if(parseInt($(this).val()) === 1)
|
|
||||||
$('tr.address-detail-' + orderType).show('slow');
|
|
||||||
else if(parseInt($(this).val()) === 0)
|
|
||||||
$('tr.address-detail-' + orderType).hide('slow');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('tr.contragent-type select').change(function(){
|
$('tr.contragent-type select').change(function(){
|
||||||
const splitName = $(this).attr('name').split('-');
|
const splitName = $(this).attr('name').split('-');
|
||||||
@ -223,6 +250,42 @@ if (isset($arResult['ORDER_PROPS'])) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php $countProps++; endforeach; ?>
|
<?php $countProps++; endforeach; ?>
|
||||||
|
|
||||||
|
<tr id="<?php echo 'locationElement-' . $bitrixOrderType['ID']; ?>" hidden="hidden">
|
||||||
|
<td class="adm-detail-content-cell-l" width="50%" name="text"><?php echo GetMessage('LOCATION_LABEL'); ?></td>
|
||||||
|
<td class="adm-detail-content-cell-r" width="50%">
|
||||||
|
<select class="typeselect">
|
||||||
|
<option value=""></option>
|
||||||
|
<?php foreach ($arResult['locationProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
||||||
|
<option value="<?php echo $arProp['CODE']; ?>"
|
||||||
|
<?php if ($defaultOrderProps[$bitrixOrderType['ID']]['text'] === $arProp['CODE']) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>
|
||||||
|
>
|
||||||
|
<?php echo $arProp['NAME'];?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="<?php echo 'textAddressElement-' . $bitrixOrderType['ID']; ?>" hidden="hidden">
|
||||||
|
<td class="adm-detail-content-cell-l" width="50%" name="text"><?php echo GetMessage('TEXT_ADDRESS_LABEL'); ?></td>
|
||||||
|
<td class="adm-detail-content-cell-r" width="50%">
|
||||||
|
<select class="typeselect">
|
||||||
|
<option value=""></option>
|
||||||
|
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
||||||
|
<option value="<?php echo $arProp['CODE']; ?>"
|
||||||
|
<?php if ($defaultOrderProps[$bitrixOrderType['ID']]['text'] === $arProp['CODE']) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>
|
||||||
|
>
|
||||||
|
<?php echo $arProp['NAME']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<?if (isset($arResult['customFields']) && count($arResult['customFields']) > 0):?>
|
<?if (isset($arResult['customFields']) && count($arResult['customFields']) > 0):?>
|
||||||
<tr class="heading custom-detail-title">
|
<tr class="heading custom-detail-title">
|
||||||
<td colspan="2" style="background-color: transparent;">
|
<td colspan="2" style="background-color: transparent;">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$arModuleVersion = [
|
$arModuleVersion = [
|
||||||
'VERSION' => '6.5.3',
|
'VERSION' => '6.5.4',
|
||||||
'VERSION_DATE' => '2023-12-27 12:30:00'
|
'VERSION_DATE' => '2023-12-29 15:00:00'
|
||||||
];
|
];
|
||||||
|
@ -27,3 +27,6 @@ $MESS ['BLOCK'] = 'Block';
|
|||||||
$MESS ['HOUSE'] = 'House';
|
$MESS ['HOUSE'] = 'House';
|
||||||
$MESS ['ADDRESS_SHORT'] = 'Short address';
|
$MESS ['ADDRESS_SHORT'] = 'Short address';
|
||||||
$MESS ['ADDRESS_FULL'] = 'Detailed address';
|
$MESS ['ADDRESS_FULL'] = 'Detailed address';
|
||||||
|
|
||||||
|
$MESS ['LOCATION_LABEL'] = 'Location';
|
||||||
|
$MESS ['TEXT_ADDRESS_LABEL'] = 'Address (line)';
|
||||||
|
@ -133,4 +133,7 @@ $MESS ['DATE_TYPE'] = 'Date';
|
|||||||
$MESS ['NOTATION_CUSTOM_FIELDS'] = 'Before enabling this functionality, make sure that you do not have customized files for working with orders and customers associated with older versions of the module.';
|
$MESS ['NOTATION_CUSTOM_FIELDS'] = 'Before enabling this functionality, make sure that you do not have customized files for working with orders and customers associated with older versions of the module.';
|
||||||
$MESS ['NOTATION_MATCHED_CUSTOM_FIELDS'] = 'For correct data exchange, the types of matched fields must be the same!';
|
$MESS ['NOTATION_MATCHED_CUSTOM_FIELDS'] = 'For correct data exchange, the types of matched fields must be the same!';
|
||||||
$MESS ['ADD_LABEL'] = 'Add';
|
$MESS ['ADD_LABEL'] = 'Add';
|
||||||
$MESS ['DELETE_MATCHED'] = 'Delete';
|
$MESS ['DELETE_MATCHED'] = 'Delete';
|
||||||
|
|
||||||
|
$MESS ['LOCATION_LABEL'] = 'Location';
|
||||||
|
$MESS ['TEXT_ADDRESS_LABEL'] = 'Address (line)';
|
||||||
|
@ -28,3 +28,6 @@ $MESS ['BLOCK'] = 'Подъезд';
|
|||||||
$MESS ['HOUSE'] = 'Строение / корпус';
|
$MESS ['HOUSE'] = 'Строение / корпус';
|
||||||
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
$MESS ['ADDRESS_SHORT'] = 'Краткий адрес';
|
||||||
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
$MESS ['ADDRESS_FULL'] = 'Детальный адрес';
|
||||||
|
|
||||||
|
$MESS ['LOCATION_LABEL'] = 'Местоположение (LOCATION)';
|
||||||
|
$MESS ['TEXT_ADDRESS_LABEL'] = 'Адрес (строкой)';
|
||||||
|
@ -193,3 +193,6 @@ $MESS ['NOTATION_CUSTOM_FIELDS'] = 'Перед подключением данн
|
|||||||
$MESS ['NOTATION_MATCHED_CUSTOM_FIELDS'] = 'Для корректного обмена данными типы сопоставляемых полей должны быть одинаковыми!';
|
$MESS ['NOTATION_MATCHED_CUSTOM_FIELDS'] = 'Для корректного обмена данными типы сопоставляемых полей должны быть одинаковыми!';
|
||||||
$MESS ['ADD_LABEL'] = 'Добавить';
|
$MESS ['ADD_LABEL'] = 'Добавить';
|
||||||
$MESS ['DELETE_MATCHED'] = 'Удалить';
|
$MESS ['DELETE_MATCHED'] = 'Удалить';
|
||||||
|
|
||||||
|
$MESS ['LOCATION_LABEL'] = 'Местоположение (LOCATION)';
|
||||||
|
$MESS ['TEXT_ADDRESS_LABEL'] = 'Адрес (строкой)';
|
||||||
|
@ -1125,6 +1125,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
|||||||
|
|
||||||
//bitrix orderPropsList
|
//bitrix orderPropsList
|
||||||
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
$arResult['arProp'] = RCrmActions::OrderPropsList();
|
||||||
|
$arResult['locationProp'] = RCrmActions::getLocationProps();
|
||||||
|
|
||||||
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
|
$arResult['bitrixIblocksExportList'] = RCrmActions::IblocksExportList();
|
||||||
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
|
$arResult['bitrixStoresExportList'] = RCrmActions::StoresExportList();
|
||||||
@ -1540,16 +1541,42 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
function updateAddressList()
|
||||||
$('input.addr').change(function() {
|
{
|
||||||
splitName = $(this).attr('name').split('-');
|
splitName = $(this).attr('name').split('-');
|
||||||
orderType = splitName[2];
|
orderType = splitName[2];
|
||||||
|
|
||||||
if (parseInt($(this).val()) === 1)
|
if (parseInt($(this).val()) === 1) {
|
||||||
$('tr.address-detail-' + orderType).show('slow');
|
let locationElement = document.getElementById('locationElement-' + orderType);
|
||||||
else if (parseInt($(this).val()) === 0)
|
let replacedSelect = document.getElementsByName('order-prop-text-' + orderType);
|
||||||
$('tr.address-detail-' + orderType).hide('slow');
|
let replacedElement = replacedSelect[0].parentNode.parentNode;
|
||||||
});
|
let addedLocation = locationElement.cloneNode(true);
|
||||||
|
|
||||||
|
addedLocation.querySelector(`select`).setAttribute("name", 'order-prop-text-' + orderType);
|
||||||
|
addedLocation.removeAttribute("hidden");
|
||||||
|
addedLocation.removeAttribute("id");
|
||||||
|
replacedElement.replaceWith(addedLocation);
|
||||||
|
|
||||||
|
$('tr.address-detail-' + orderType).show('slow');
|
||||||
|
|
||||||
|
} else if (parseInt($(this).val()) === 0) {
|
||||||
|
let locationElement = document.getElementById('textAddressElement-' + orderType);
|
||||||
|
let replacedSelect = document.getElementsByName('order-prop-text-' + orderType);
|
||||||
|
let replacedElement = replacedSelect[0].parentNode.parentNode;
|
||||||
|
let addedLocation = locationElement.cloneNode(true);
|
||||||
|
|
||||||
|
addedLocation.querySelector(`select`).setAttribute("name", 'order-prop-text-' + orderType);
|
||||||
|
addedLocation.removeAttribute("hidden");
|
||||||
|
addedLocation.removeAttribute("id");
|
||||||
|
replacedElement.replaceWith(addedLocation);
|
||||||
|
|
||||||
|
$('tr.address-detail-' + orderType).hide('slow');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('input[name^="address-detail-"]').change(updateAddressList);
|
||||||
|
$('input:checked[name^="address-detail-"]').each(updateAddressList);
|
||||||
|
|
||||||
$('tr.contragent-type select').change(function() {
|
$('tr.contragent-type select').change(function() {
|
||||||
splitName = $(this).attr('name').split('-');
|
splitName = $(this).attr('name').split('-');
|
||||||
@ -2011,31 +2038,31 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
|||||||
<?php $countProps = 1;
|
<?php $countProps = 1;
|
||||||
foreach ($arResult['orderProps'] as $orderProp): ?>
|
foreach ($arResult['orderProps'] as $orderProp): ?>
|
||||||
<?php if ($orderProp['ID'] === 'text'): ?>
|
<?php if ($orderProp['ID'] === 'text'): ?>
|
||||||
<tr class="heading">
|
<tr class="heading">
|
||||||
<td colspan="2" style="background-color: transparent;">
|
<td colspan="2" style="background-color: transparent;">
|
||||||
<b>
|
<b>
|
||||||
<label>
|
<label>
|
||||||
<input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="0"
|
<input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="0"
|
||||||
<?php
|
<?php
|
||||||
if ($addressOptions[$bitrixOrderType['ID']] === '0') {
|
if ($addressOptions[$bitrixOrderType['ID']] === '0') {
|
||||||
echo 'checked';
|
echo 'checked';
|
||||||
}
|
}
|
||||||
?>>
|
?>>
|
||||||
<?= GetMessage('ADDRESS_SHORT')?>
|
<?= GetMessage('ADDRESS_SHORT')?>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="1"
|
<input class="addr" type="radio" name="address-detail-<?php echo $bitrixOrderType['ID']; ?>" value="1"
|
||||||
<?php
|
<?php
|
||||||
if ($addressOptions[$bitrixOrderType['ID']] === '1') {
|
if ($addressOptions[$bitrixOrderType['ID']] === '1') {
|
||||||
echo 'checked';
|
echo 'checked';
|
||||||
}
|
}
|
||||||
?>>
|
?>>
|
||||||
<?= GetMessage('ADDRESS_FULL')?>
|
<?= GetMessage('ADDRESS_FULL')?>
|
||||||
</label>
|
</label>
|
||||||
</b>
|
</b>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<tr <?php if ($countProps > 4) {
|
<tr <?php if ($countProps > 4) {
|
||||||
echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"';
|
echo 'class="address-detail-' . $bitrixOrderType['ID'] . '"';
|
||||||
}
|
}
|
||||||
@ -2087,6 +2114,41 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
|||||||
</tr>
|
</tr>
|
||||||
<? endforeach; ?>
|
<? endforeach; ?>
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
|
<tr id="<?php echo 'locationElement-' . $bitrixOrderType['ID']; ?>" hidden="hidden">
|
||||||
|
<td class="adm-detail-content-cell-l" width="50%" name="text"><?php echo GetMessage('LOCATION_LABEL'); ?></td>
|
||||||
|
<td class="adm-detail-content-cell-r" width="50%">
|
||||||
|
<select class="typeselect">
|
||||||
|
<option value=""></option>
|
||||||
|
<?php foreach ($arResult['locationProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
||||||
|
<option value="<?php echo $arProp['CODE']; ?>"
|
||||||
|
<?php if ($optionsOrderProps[$bitrixOrderType['ID']]['text'] === $arProp['CODE']) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>
|
||||||
|
>
|
||||||
|
<?php echo $arProp['NAME'];?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach;?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="<?php echo 'textAddressElement-' . $bitrixOrderType['ID']; ?>" hidden="hidden">
|
||||||
|
<td class="adm-detail-content-cell-l" width="50%" name="text"><?php echo GetMessage('TEXT_ADDRESS_LABEL'); ?></td>
|
||||||
|
<td class="adm-detail-content-cell-r" width="50%">
|
||||||
|
<select class="typeselect">
|
||||||
|
<option value=""></option>
|
||||||
|
<?php foreach ($arResult['arProp'][$bitrixOrderType['ID']] as $arProp): ?>
|
||||||
|
<option value="<?php echo $arProp['CODE']; ?>"
|
||||||
|
<?php if ($optionsOrderProps[$bitrixOrderType['ID']]['text'] === $arProp['CODE']) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>
|
||||||
|
>
|
||||||
|
<?php echo $arProp['NAME']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr class="heading legal-detail-title-<?php echo $bitrixOrderType['ID']; ?>" <?php if (is_array($optionsLegalDetails[$bitrixOrderType['ID']]) && count($optionsLegalDetails[$bitrixOrderType['ID']]) < 1) {
|
<tr class="heading legal-detail-title-<?php echo $bitrixOrderType['ID']; ?>" <?php if (is_array($optionsLegalDetails[$bitrixOrderType['ID']]) && count($optionsLegalDetails[$bitrixOrderType['ID']]) < 1) {
|
||||||
echo 'style="display:none"';
|
echo 'style="display:none"';
|
||||||
} ?>>
|
} ?>>
|
||||||
@ -2120,6 +2182,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<?php $tabControl->BeginNextTab(); ?>
|
<?php $tabControl->BeginNextTab(); ?>
|
||||||
<?php
|
<?php
|
||||||
//loyalty program options
|
//loyalty program options
|
||||||
|
Loading…
Reference in New Issue
Block a user