CCrmOwnerType::GetShowUrl

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

	if($ID <= 0)
	{
		return '';
	}

	switch($typeID)
	{
		case self::Lead:
		{
			if ($bCheckPermissions && !CCrmLead::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_lead_show'),
				array('lead_id' => $ID)
			);
		}
		case self::Contact:
		{
			if ($bCheckPermissions && !CCrmContact::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_contact_show'),
				array('contact_id' => $ID)
			);
		}
		case self::Company:
		{
			if ($bCheckPermissions && !CCrmCompany::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_company_show'),
				array('company_id' => $ID)
			);
		}
		case self::Deal:
		{
			if ($bCheckPermissions && !CCrmDeal::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_deal_show'),
				array('deal_id' => $ID)
			);
		}
		case self::Activity:
		{
			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_activity_show'),
				array('activity_id' => $ID)
			);
		}
		case self::Invoice:
		{
			if ($bCheckPermissions && !CCrmInvoice::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_invoice_show'),
				array('invoice_id' => $ID)
			);
		}
		case self::Quote:
		{
			if ($bCheckPermissions && !CCrmQuote::CheckReadPermission($ID))
			{
				return '';
			}

			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_quote_show'),
				array('quote_id' => $ID)
			);
		}
		case self::Order:
		{
			if ($bCheckPermissions && !\Bitrix\Crm\Order\Permissions\Order::checkReadPermission($ID))
			{
				return '';
			}

			return self::GetDetailsUrl($typeID, $ID, $bCheckPermissions = false);
		}
		case self::OrderShipment:
		{
			if ($bCheckPermissions && !\Bitrix\Crm\Order\Permissions\Shipment::checkReadPermission($ID))
			{
				return '';
			}

			return self::GetDetailsUrl($typeID, $ID, $bCheckPermissions = false);
		}
		case self::OrderPayment:
		{
			if ($bCheckPermissions && !\Bitrix\Crm\Order\Permissions\Payment::checkReadPermission($ID))
			{
				return '';
			}

			return self::GetDetailsUrl($typeID, $ID, $bCheckPermissions = false);
		}

		case self::StoreDocument:
		{
			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_store_document_details'),
				[
					'store_document_id' => $ID,
				]
			);
		}

		case self::ShipmentDocument:
		{
			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_shipment_document_details'),
				[
					'shipment_document_id' => $ID,
				]
			);
		}

		case self::AgentContractDocument:
		{
			return CComponentEngine::MakePathFromTemplate(
				COption::GetOptionString('crm', 'path_to_agent_contract_details'),
				[
					'agent_contract_id' => $ID,
				]
			);
		}

		default:
			return '';
	}
}

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