...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/mail_template.php
- Класс: \CAllCrmMailTemplate
- Вызов: CAllCrmMailTemplate::updateUserFields
static function updateUserFields($id, &$fields) { global $USER_FIELD_MANAGER; $USER_FIELD_MANAGER->update('CRM_MAIL_TEMPLATE', $id, $fields); if (!empty($fields['UF_ATTACHMENT']) && \CModule::includeModule('disk')) { $files = $USER_FIELD_MANAGER->getUserFieldValue('CRM_MAIL_TEMPLATE', 'UF_ATTACHMENT', $id); $files = !empty($files) && is_array($files) ? $files : array(); $diskUfManager = \Bitrix\Disk\Driver::getInstance()->getUserFieldManager(); $diskUfManager->loadBatchAttachedObject($files); foreach ($files as $attachedId) { if ($attachedObject = $diskUfManager->getAttachedObjectById($attachedId)) { $fields['BODY'] = preg_replace( sprintf('/bxacid:n%u/', $attachedObject->getObjectId()), sprintf('bxacid:%u', $attachedId), $fields['BODY'], -1, $count ); if ($count > 0) $bodyUpdated = true; } } if (!empty($bodyUpdated)) { $bodyFields = array('BODY' => $fields['BODY']); \CCrmMailTemplate::update($id, $bodyFields); } } }