Exemple #1
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);
 }
 protected function rebind($seedID, $targID)
 {
     \CCrmDeal::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmQuote::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmActivity::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmLiveFeed::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmSonetRelation::RebindRelations(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmEvent::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
 }
Exemple #3
0
 private static function RegisterOwnershipRelations($logEntityID, $logEventID, &$fields)
 {
     $entityTypeID = isset($fields['ENTITY_TYPE_ID']) ? intval($fields['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
     if (!CCrmOwnerType::IsDefined($entityTypeID)) {
         return;
     }
     $entityID = isset($fields['ENTITY_ID']) ? intval($fields['ENTITY_ID']) : 0;
     if ($entityID < 0) {
         return;
     }
     $parents = isset($fields['PARENTS']) && is_array($fields['PARENTS']) ? $fields['PARENTS'] : array();
     if (!empty($fields['PARENTS'])) {
         $parentOptions = isset($fields['PARENT_OPTIONS']) && is_array($fields['PARENT_OPTIONS']) ? $fields['PARENT_OPTIONS'] : array();
         $parentOptions['TYPE_ID'] = CCrmSonetRelationType::Ownership;
         CCrmSonetRelation::RegisterRelationBundle($logEntityID, $logEventID, $entityTypeID, $entityID, $parents, $parentOptions);
     } else {
         $parentEntityTypeID = isset($fields['PARENT_ENTITY_TYPE_ID']) ? intval($fields['PARENT_ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
         $parentEntityID = isset($fields['PARENT_ENTITY_ID']) ? intval($fields['PARENT_ENTITY_ID']) : 0;
         if (CCrmOwnerType::IsDefined($parentEntityTypeID) && $parentEntityID > 0) {
             CCrmSonetRelation::RegisterRelation($logEntityID, $logEventID, $entityTypeID, $entityID, $parentEntityTypeID, $parentEntityID, CCrmSonetRelationType::Ownership, 1);
         }
     }
 }
Exemple #4
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);
 }