PhoneNumberTable::appendNumber

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. PhoneNumberTable
  4. appendNumber
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/tracking/internals/phonenumber.php
  • Класс: Bitrix\Crm\Tracking\Internals\PhoneNumberTable
  • Вызов: PhoneNumberTable::appendNumber
static function appendNumber($value)
{
	$row = static::getRow([
		'select' => ['ID'],
		'filter' => ['=VALUE' => $value]
	]);
	if ($row)
	{
		$result = static::update(
			$row['ID'],
			[
				'USE_CNT' => new DB\SqlExpression("?# + ?i", 'USE_CNT', 1),
				'DATE_USE' => new DateTime()
			]
		);

	}
	else
	{
		$result = static::add([
			'VALUE' => $value,
			'USE_CNT' => 1,
			'DATE_USE' => new DateTime()
		]);
	}

	return $result->isSuccess() ? $value : false;
}

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