...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_event.php
- Класс: \CCrmEvent
- Вызов: CCrmEvent::Rebind
public function Rebind($entityTypeID, $srcEntityID, $dstEntityID) { $entityTypeName = CCrmOwnerType::ResolveName($entityTypeID); $srcEntityID = (int)$srcEntityID; $dstEntityID = (int)$dstEntityID; $sql = "SELECT R.EVENT_ID FROM b_crm_event_relations R INNER JOIN b_crm_event E ON R.EVENT_ID = E.ID AND R.ENTITY_TYPE = '{$entityTypeName}' AND R.ENTITY_ID = {$srcEntityID} AND E.EVENT_TYPE IN (0, 2)"; global $DB; $err_mess = (self::err_mess()).'
Function: Rebind
Line: '; $dbResult = $DB->Query($sql, false, $err_mess.__LINE__); if(!is_object($dbResult)) { return; } $IDs = array(); while($fields = $dbResult->Fetch()) { if(isset($fields['EVENT_ID'])) { $IDs[] = (int)$fields['EVENT_ID']; } } if(!empty($IDs)) { $sql = 'UPDATE b_crm_event_relations SET ENTITY_ID = '.$dstEntityID.' WHERE EVENT_ID IN('.implode(',', $IDs).')'; $DB->Query($sql, false, $err_mess.__LINE__); } }