• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/classes/general/vi_phone.php
  • Класс: CVoxImplantPhone
  • Вызов: CVoxImplantPhone::generateConfigName
static function generateConfigName($rentedPhones, $maxLength = 0)
{
	if(count($rentedPhones) === 1)
	{
		$firstPhone = array_keys($rentedPhones)[0];
		return $rentedPhones[$firstPhone]['PHONE_NUMBER'] ?? null;
	}
	else
	{
		// checking if it is a single subscription or not
		$subscriptions = [];

		foreach ($rentedPhones as $phone => $fields)
		{
			$subscriptions[$fields['SUBSCRIPTION_ID']] = true;
		}

		$isSingleSubscription = count($subscriptions) === 1;

		if($isSingleSubscription)
		{
			return Loc::getMessage("VI_PHONE_PACKAGE", ["#COUNT#" => count($rentedPhones)]);
		}
		else
		{
			$result = Loc::getMessage("VI_PHONE_GROUP") . ": " . join(", ", array_keys($rentedPhones));
			if ($maxLength > 0 && mb_strlen($result) > $maxLength)
			{
				$result = mb_substr($result, 0, $maxLength - 3) . "...";
			}
			return $result;
		}
	}
}