Exemplo n.º 1
0
 public static function DeleteLogEvents($params, $options = array())
 {
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $entityTypeID = isset($params['ENTITY_TYPE_ID']) ? intval($params['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
     $liveFeedEntityType = CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID);
     if ($liveFeedEntityType === CCrmLiveFeedEntity::Undefined) {
         return false;
     }
     $entityID = isset($params['ENTITY_ID']) ? intval($params['ENTITY_ID']) : 0;
     if ($entityID <= 0) {
         return false;
     }
     $dbRes = CSocNetLog::GetList(array('ID' => 'DESC'), array('ENTITY_TYPE' => $liveFeedEntityType, 'ENTITY_ID' => $entityID), false, false, array('ID'));
     while ($arRes = $dbRes->Fetch()) {
         CSocNetLog::Delete($arRes['ID']);
     }
     if (!is_array($options)) {
         $options = array();
     }
     $unregisterRelation = !(isset($options['UNREGISTER_RELATION']) && $options['UNREGISTER_RELATION'] === false);
     if ($unregisterRelation) {
         CCrmSonetRelation::UnRegisterRelationsByEntity($entityTypeID, $entityID);
     }
 }
Exemplo n.º 2
0
 private static function UnregisterLiveFeedEvent($activityID)
 {
     $slEntities = CCrmLiveFeed::GetLogEvents(array(), array('ENTITY_TYPE_ID' => CCrmOwnerType::Activity, 'ENTITY_ID' => $activityID), array('ID'));
     $options = array('UNREGISTER_RELATION' => false);
     foreach ($slEntities as &$slEntity) {
         CCrmLiveFeed::DeleteLogEvent($slEntity['ID'], $options);
     }
     unset($slEntity);
     CCrmSonetRelation::UnRegisterRelationsByEntity(CCrmOwnerType::Activity, $activityID);
 }
Exemplo n.º 3
0
 private static function UnregisterLiveFeedEvent($invoiceID)
 {
     $invoiceID = intval($invoiceID);
     if ($invoiceID <= 0) {
         return;
     }
     $slEntities = CCrmLiveFeed::GetLogEvents(array(), array('ENTITY_TYPE_ID' => CCrmOwnerType::Invoice, 'ENTITY_ID' => $invoiceID), array('ID'));
     $options = array('UNREGISTER_RELATION' => false);
     foreach ($slEntities as &$slEntity) {
         CCrmLiveFeed::DeleteLogEvent($slEntity['ID'], $options);
     }
     unset($slEntity);
     CCrmSonetRelation::UnRegisterRelationsByEntity(CCrmOwnerType::Invoice, $invoiceID);
 }