Пример #1
0
 protected static function DeleteCalendarEvent(&$arFields)
 {
     $typeID = isset($arFields['TYPE_ID']) ? intval($arFields['TYPE_ID']) : CCrmActivityType::Undefined;
     if (!($typeID === CCrmActivityType::Call || $typeID === CCrmActivityType::Meeting)) {
         return false;
     }
     $assocEntityID = isset($arFields['ASSOCIATED_ENTITY_ID']) ? intval($arFields['ASSOCIATED_ENTITY_ID']) : 0;
     if ($assocEntityID <= 0) {
         return false;
     }
     if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar'))) {
         return false;
     }
     self::$IGNORE_CALENDAR_EVENTS = true;
     CCalendarEvent::Delete(array('id' => $assocEntityID, 'bMarkDeleted' => false));
     self::$IGNORE_CALENDAR_EVENTS = false;
     return true;
 }