コード例 #1
0
 public static function ConvertCalEvents($checkPerms = true, $regEvent = true)
 {
     if (!(IsModuleInstalled('calendar') && CModule::IncludeModule('calendar'))) {
         return 0;
     }
     $arEvents = CCalendarEvent::GetList(array('arFilter' => array('!UF_CRM_CAL_EVENT' => null, 'DELETED' => 'N'), 'getUserfields' => true));
     $total = 0;
     foreach ($arEvents as $arEvent) {
         $eventID = $arEvent['ID'];
         $count = CCrmActivity::GetCount(array('@TYPE_ID' => array(CCrmActivityType::Call, CCrmActivityType::Meeting), '=ASSOCIATED_ENTITY_ID' => $eventID));
         if ($count === 0 && CCrmActivity::CreateFromCalendarEvent($eventID, $arEvent, $checkPerms, $regEvent) > 0) {
             $total++;
         }
     }
     return $total;
 }