if (!function_exists('__CrmMobileLocationListEndResonse')) { function __CrmMobileLocationListEndResonse($result) { $GLOBALS['APPLICATION']->RestartBuffer(); Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); if (!empty($result)) { echo CUtil::PhpToJSObject($result); } require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php'; die; } } $curUserPrems = CCrmPerms::GetCurrentUserPermissions(); $action = isset($_REQUEST['ACTION']) ? $_REQUEST['ACTION'] : ''; if ($action === 'SAVE_RECENT_USED_LOCATION') { //__IncludeLang(dirname(__FILE__).'/lang/'.LANGUAGE_ID.'/'.basename(__FILE__)); if (!CCrmPerms::IsAccessEnabled()) { __CrmMobileLocationListEndResonse(array('ERROR' => 'Access denied.')); } $ID = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : ''; if ($ID === '') { __CrmMobileLocationListEndResonse(array('ERROR' => 'ID is not found.')); } if (CCrmMobileHelper::SaveRecentlyUsedLocation($ID)) { __CrmMobileLocationListEndResonse(array('SAVED_ENTITY_ID' => $ID)); } else { __CrmMobileLocationListEndResonse(array('ERROR' => 'Could not save location.')); } } else { __CrmMobileLocationListEndResonse(array('ERROR' => 'Action is not supported in current context.')); }