$ownerTypeName = isset($_POST['OWNER_TYPE']) ? strtoupper(strval($_POST['OWNER_TYPE'])) : ''; if (!isset($ownerTypeName[0])) { echo CUtil::PhpToJSObject(array('ERROR' => 'OWNER TYPE IS NOT DEFINED!')); die; } $ownerID = isset($_POST['OWNER_ID']) ? intval($_POST['OWNER_ID']) : 0; if ($ownerID <= 0) { echo CUtil::PhpToJSObject(array('ERROR' => 'OWNER ID IS NOT DEFINED!')); die; } if (!CCrmActivity::CheckUpdatePermission(CCrmOwnerType::ResolveID($ownerTypeName), $ownerID)) { echo CUtil::PhpToJSObject(array('ERROR' => GetMessage('CRM_PERMISSION_DENIED'))); die; } $priority = isset($_POST['PRIORITY']) ? intval($_POST['PRIORITY']) : CCrmActivityPriority::Medium; if (CCrmActivity::SetPriority($ID, $priority, array('REGISTER_SONET_EVENT' => true))) { echo CUtil::PhpToJsObject(array('ITEM_ID' => $ID, 'PRIORITY' => $priority)); } else { $errorMsg = CCrmActivity::GetLastErrorMessage(); if (!isset($errorMsg[0])) { $errorMsg = "Could not change priority!"; } echo CUtil::PhpToJsObject(array('ERROR' => $errorMsg)); } } elseif ($action == 'SAVE_ACTIVITY') { $siteID = !empty($_REQUEST['siteID']) ? $_REQUEST['siteID'] : SITE_ID; if (!CModule::IncludeModule('calendar')) { echo CUtil::PhpToJSObject(array('ERROR' => 'Could not load module "calendar"!')); die; } $data = isset($_POST['DATA']) && is_array($_POST['DATA']) ? $_POST['DATA'] : array();