CCrmOwnerType::IsOpened

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmOwnerType
  4. IsOpened
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_owner_type.php
  • Класс: \CCrmOwnerType
  • Вызов: CCrmOwnerType::IsOpened
static function IsOpened($typeID, $ID, $checkRights = true)
{
	$typeID = intval($typeID);
	$ID = intval($ID);

	switch($typeID)
	{
		case self::Lead:
		{
			$dbRes = CCrmLead::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => ($checkRights ? 'Y' : 'N')), false, false, array('OPENED'));
			$arRes = $dbRes ? $dbRes->Fetch() : null;
			return ($arRes && $arRes['OPENED'] == 'Y');
		}
		case self::Contact:
		{
			$dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => ($checkRights ? 'Y' : 'N')), false, false, array('OPENED'));
			$arRes = $dbRes ? $dbRes->Fetch() : null;
			return ($arRes && $arRes['OPENED'] == 'Y');
		}
		case self::Company:
		{
			$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => ($checkRights ? 'Y' : 'N')), false, false, array('OPENED'));
			$arRes = $dbRes ? $dbRes->Fetch() : null;
			return ($arRes && $arRes['OPENED'] == 'Y');
		}
		case self::Deal:
		{
			$dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => ($checkRights ? 'Y' : 'N')), false, false, array('OPENED'));
			$arRes = $dbRes ? $dbRes->Fetch() : null;
			return ($arRes && $arRes['OPENED'] == 'Y');
		}
		case self::Quote:
		{
			$dbRes = CCrmQuote::GetList(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => ($checkRights ? 'Y' : 'N')), false, false, array('OPENED'));
			$arRes = $dbRes ? $dbRes->Fetch() : null;
			return ($arRes && $arRes['OPENED'] == 'Y');
		}
	}

	if (static::isUseFactoryBasedApproach($typeID))
	{
		$factory = Container::getInstance()->getFactory($typeID);
		if ($factory)
		{
			$item = $factory->getItem($ID);
			if ($item && $item->hasField(\Bitrix\Crm\Item::FIELD_NAME_OPENED))
			{
				return $item->getOpened();
			}
		}
	}

	return false;
}

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