• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/statusbase.php
  • Класс: BitrixSaleStatusBase
  • Вызов: StatusBase::canGroupDoOperations
static function canGroupDoOperations($groupId, $fromStatus, array $operations)
{
	if (!$operations)
	{
		throw new SystemException('provide at least one operation', 0, __FILE__, __LINE__);
	}

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

	if (in_array('1', $groupId, true) || CMain::GetUserRight('sale', $groupId) >= 'W') // Admin
	{
		return true;
	}

	$operations = static::convertNamesToOperations($operations);

	$result = static::getList(array(
		'select' => array(
			'NAME' => 'BitrixSaleInternalsStatusGroupTaskTable:STATUS.TASK.BitrixMainTaskOperation:TASK.OPERATION.NAME',
		),
		'filter' => array(
			'=ID' => $fromStatus,
			'=BitrixSaleInternalsStatusGroupTaskTable:STATUS.GROUP_ID' => $groupId,
			'=BitrixSaleInternalsStatusGroupTaskTable:STATUS.TASK.BitrixMainTaskOperation:TASK.OPERATION.NAME' => $operations,
		),
	));

	while ($row = $result->fetch())
	{
		if (($key = array_search($row['NAME'], $operations)) !== false)
		{
			unset($operations[$key]);
		}
	}

	return !$operations;
}