CAllCrmActivity::GetCommunications

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmActivity
  4. GetCommunications
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
  • Класс: \CAllCrmActivity
  • Вызов: CAllCrmActivity::GetCommunications
static function GetCommunications($activityID, $top = 0, array $options = null)
{
	$activityID = intval($activityID);
	if($activityID <= 0)
	{
		self::RegisterError(array('text' => 'Invalid arguments are supplied.'));
		return false;
	}

	global $DB;
	$commTableName = CCrmActivity::COMMUNICATION_TABLE_NAME;
	$sql = "SELECT ID, TYPE, VALUE, ENTITY_ID, ENTITY_TYPE_ID, ENTITY_SETTINGS FROM {$commTableName} WHERE ACTIVITY_ID = {$activityID} ORDER BY ID ASC";
	$top = intval($top);
	if($top > 0)
	{
		CSqlUtil::PrepareSelectTop($sql, $top, CCrmActivity::DB_TYPE);
	}

	if(!is_array($options))
	{
		$options = array();
	}

	$enableSettings = !isset($options['ENABLE_SETTINGS']) || $options['ENABLE_SETTINGS'];

	$dbRes = $DB->Query($sql, false, 'FILE: '.__FILE__.'
LINE: '.__LINE__); $result = array(); while($arRes = $dbRes->Fetch()) { if($enableSettings) { $arRes['ENTITY_SETTINGS'] = isset($arRes['ENTITY_SETTINGS']) && $arRes['ENTITY_SETTINGS'] !== '' ? unserialize($arRes['ENTITY_SETTINGS'], ['allowed_classes' => false]) : array(); } else { unset($arRes['ENTITY_SETTINGS']); } $result[] = $arRes; } return $result; }

Добавить комментарий