...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/numerator/quoteuserquotesnumbergenerator.php
- Класс: Bitrix\Crm\Integration\Numerator\QuoteUserQuotesNumberGenerator
- Вызов: QuoteUserQuotesNumberGenerator::parseTemplate
public function parseTemplate($template) { if (mb_strpos($template, self::TEMPLATE_WORD_USER_ID_QUOTES_COUNT) !== false) { $value = ''; $assignedById = QuoteTable::query() ->addSelect('ASSIGNED_BY_ID') ->where('ID', $this->quoteId) ->exec() ->fetch(); if ($assignedById) { $userId = intval($assignedById['ASSIGNED_BY_ID']); $count = QuoteTable::query() ->addSelect('QUOTES_COUNT') ->registerRuntimeField( new ExpressionField( 'QUOTES_COUNT', 'COUNT(ID)' ) ) ->where('ASSIGNED_BY_ID', $userId) ->addGroup('ASSIGNED_BY_ID') ->exec() ->fetch(); if ($count) { $numID = ((int)$count["QUOTES_COUNT"] > 0) ? (int)$count["QUOTES_COUNT"] : 1; $value = $userId . "_" . $numID; } else { $value = $userId . "_1"; } } $template = str_replace(self::getPatternFor(self::TEMPLATE_WORD_USER_ID_QUOTES_COUNT), $value, $template); } return $template; }