示例#1
0
            if ($newCalltoFormat === CCrmCallToUrl::Custom) {
                $newCalltoSettings['URL_TEMPLATE'] = isset($_POST['CALLTO_URL_TEMPLATE']) ? $_POST['CALLTO_URL_TEMPLATE'] : '';
                $newCalltoSettings['CLICK_HANDLER'] = isset($_POST['CALLTO_CLICK_HANDLER']) ? $_POST['CALLTO_CLICK_HANDLER'] : '';
            }
            $newCalltoSettings['NORMALIZE_NUMBER'] = isset($_POST['CALLTO_NORMALIZE_NUMBER']) && strtoupper($_POST['CALLTO_NORMALIZE_NUMBER']) === 'N' ? 'N' : 'Y';
            if ($oldCalltoSettings['URL_TEMPLATE'] != $newCalltoSettings['URL_TEMPLATE'] || $oldCalltoSettings['CLICK_HANDLER'] != $newCalltoSettings['CLICK_HANDLER'] || $oldCalltoSettings['NORMALIZE_NUMBER'] != $newCalltoSettings['NORMALIZE_NUMBER']) {
                CCrmCallToUrl::SetCustomSettings($newCalltoSettings);
                $isCallSettingsChanged = true;
            }
            if (defined('BX_COMP_MANAGED_CACHE') && $isCallSettingsChanged) {
                $GLOBALS['CACHE_MANAGER']->ClearByTag('CRM_CALLTO_SETTINGS');
            }
            $entityAddressFormatID = isset($_POST['ENTITY_ADDRESS_FORMAT_ID']) ? (int) $_POST['ENTITY_ADDRESS_FORMAT_ID'] : \Bitrix\Crm\Format\EntityAddressFormatter::Dflt;
            \Bitrix\Crm\Format\EntityAddressFormatter::setFormatID($entityAddressFormatID);
            $personFormatID = isset($_POST['PERSON_NAME_FORMAT_ID']) ? (int) $_POST['PERSON_NAME_FORMAT_ID'] : \Bitrix\Crm\Format\PersonNameFormatter::Dflt;
            \Bitrix\Crm\Format\PersonNameFormatter::setFormatID($personFormatID);
            $dupControl->enabledFor(CCrmOwnerType::Lead, isset($_POST['ENABLE_LEAD_DUP_CONTROL']) && strtoupper($_POST['ENABLE_LEAD_DUP_CONTROL']) === 'Y');
            $dupControl->enabledFor(CCrmOwnerType::Contact, isset($_POST['ENABLE_CONTACT_DUP_CONTROL']) && strtoupper($_POST['ENABLE_CONTACT_DUP_CONTROL']) === 'Y');
            $dupControl->enabledFor(CCrmOwnerType::Company, isset($_POST['ENABLE_COMPANY_DUP_CONTROL']) && strtoupper($_POST['ENABLE_COMPANY_DUP_CONTROL']) === 'Y');
            $dupControl->save();
            CCrmStatus::EnableDepricatedTypes(isset($_POST['ENABLE_DEPRECATED_STATUSES']) && strtoupper($_POST['ENABLE_DEPRECATED_STATUSES']) === 'Y');
            \Bitrix\Crm\Settings\DealSettings::enableCloseDateSync(isset($_POST['REFRESH_DEAL_CLOSEDATE']) && strtoupper($_POST['REFRESH_DEAL_CLOSEDATE']) === 'Y');
            if ($_POST['DEAL_DEFAULT_LIST_VIEW']) {
                \Bitrix\Crm\Settings\DealSettings::setDefaultListViewID($_POST['DEAL_DEFAULT_LIST_VIEW']);
            }
            LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_SM_CONFIG'], array()));
        }
    }
}
$arResult['FORM_ID'] = 'CRM_SM_CONFIG';
$arResult['BACK_URL'] = $arParams['PATH_TO_SM_CONFIG'];