1
0
Fork 0
mirror of synced 2025-04-11 05:00:55 +00:00
Исправление синхронизации кастомных полей пользователя
This commit is contained in:
Ivan Chaplygin 2023-12-07 17:14:23 +03:00
parent 5c46fad8a2
commit 81e309be5f
4 changed files with 12 additions and 6 deletions

View file

@ -522,7 +522,11 @@ class RCrmActions
$result = $value;
if ($type === 'boolean') {
$result = $value === 'Y' ? 1 : 0;
$result = $value === '1' ? 1 : 0;
}
if ($type === 'datetime') {
$result = date('Y-m-d', strtotime($value));
}
return $result;

View file

@ -99,7 +99,7 @@ class RestNormalizer
$formatted[ $code ] = $this->formatting($value, true);
}
if (empty($formatted[$code])) {
if (empty($formatted[$code] && $formatted[$code] !== 0)) {
if ($this->clear === true) {
unset($formatted[ $code ]);
}

View file

@ -167,7 +167,7 @@ class RetailCrmUser
$result = [];
foreach ($customUserFields as $code => $codeCrm) {
if (!empty($arFields[$code])) {
if (isset($arFields[$code])) {
$type = $typeList[$code] ?? '';
$result[$codeCrm] = RCrmActions::convertFieldToCrmValue($arFields[$code], $type);
}

View file

@ -950,9 +950,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
}
}
foreach ($arResult['bitrixCustomUserFields'] as $code => $text) {
if (!empty($_POST['bitrixUserField_' . $code]) && !empty($_POST['crmUserField_' . $code])) {
$customUserFields[htmlspecialchars($_POST['bitrixUserField_' . $code])] = htmlspecialchars($_POST['crmUserField_' . $code]);
foreach ($arResult['bitrixCustomUserFields'] as $list) {
foreach ($list as $code => $text) {
if (!empty($_POST['bitrixUserField_' . $code]) && !empty($_POST['crmUserField_' . $code])) {
$customUserFields[htmlspecialchars($_POST['bitrixUserField_' . $code])] = htmlspecialchars($_POST['crmUserField_' . $code]);
}
}
}