2namespace Bitrix\Im\Model;
6use Bitrix\Main\ORM\Query\Query;
7use Bitrix\Main\Search\MapBuilder;
58 return 'b_im_message';
70 'data_type' =>
'integer',
72 'autocomplete' =>
true,
76 'data_type' =>
'integer',
81 'data_type' =>
'integer',
86 'data_type' =>
'text',
88 'save_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getSaveModificator'),
89 'fetch_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getFetchModificator'),
91 'MESSAGE_OUT' =>
array(
92 'data_type' =>
'text',
94 'save_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getSaveModificator'),
95 'fetch_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getFetchModificator'),
97 'DATE_CREATE' =>
array(
98 'data_type' =>
'datetime',
101 'default_value' =>
array(__CLASS__,
'getCurrentDate'),
103 'EMAIL_TEMPLATE' =>
array(
104 'data_type' =>
'string',
105 'validation' =>
array(__CLASS__,
'validateEmailTemplate'),
108 'NOTIFY_TYPE' =>
array(
109 'data_type' =>
'integer',
112 'NOTIFY_MODULE' =>
array(
113 'data_type' =>
'string',
114 'validation' =>
array(__CLASS__,
'validateNotifyModule'),
117 'NOTIFY_EVENT' =>
array(
118 'data_type' =>
'string',
119 'validation' =>
array(__CLASS__,
'validateNotifyEvent'),
122 'NOTIFY_TAG' =>
array(
123 'data_type' =>
'string',
124 'validation' =>
array(__CLASS__,
'validateNotifyTag'),
127 'NOTIFY_SUB_TAG' =>
array(
128 'data_type' =>
'string',
129 'validation' =>
array(__CLASS__,
'validateNotifySubTag'),
132 'NOTIFY_TITLE' =>
array(
133 'data_type' =>
'string',
134 'validation' =>
array(__CLASS__,
'validateNotifyTitle'),
136 'save_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getSaveModificator'),
137 'fetch_data_modification' =>
array(
'\Bitrix\Main\Text\Emoji',
'getFetchModificator'),
139 'NOTIFY_BUTTONS' =>
array(
140 'data_type' =>
'text',
143 'NOTIFY_READ' =>
array(
144 'data_type' =>
'boolean',
145 'values' =>
array(
'N',
'Y'),
148 'IMPORT_ID' =>
array(
149 'data_type' =>
'integer',
153 'data_type' =>
'Bitrix\Im\Model\ChatTable',
154 'reference' =>
array(
'=this.CHAT_ID' =>
'ref.ID'),
157 'data_type' =>
'Bitrix\Main\User',
158 'reference' =>
array(
'=this.AUTHOR_ID' =>
'ref.ID'),
161 'data_type' =>
'Bitrix\Im\Model\StatusTable',
162 'reference' =>
array(
'=this.AUTHOR_ID' =>
'ref.USER_ID'),
165 'data_type' =>
'Bitrix\Im\Model\RelationTable',
166 'reference' =>
array(
'=this.CHAT_ID' =>
'ref.CHAT_ID'),
167 'join_type' =>
'INNER',
170 'data_type' =>
'Bitrix\Im\Model\MessageIndex',
171 'reference' =>
array(
'=this.ID' =>
'ref.MESSAGE_ID'),
172 'join_type' =>
'INNER',
176 'reference' =>
array(
'=this.ID' =>
'ref.MESSAGE_ID'),
177 'join_type' =>
'LEFT',
255 return new \Bitrix\Main\Type\DateTime();
276 $message = parent::getByPrimary($id)->fetch();
285 'SEARCH_CONTENT' => self::generateSearchContent(
$message)
299 private static function generateSearchContent(
array $message) : string
306 $builder->addText($authorName);
312 $messageText = strip_tags($messageText);
318 $builder->addText($messageText);
324 $textNodes = \CIMMessageParamAttach::GetTextForIndex(
$params[
'ATTACH'][0]);
325 foreach($textNodes as
$text)
327 $builder->addText(
$text);
334 foreach(
$params[
'FILE_ID'] as $fileId)
336 $file = \Bitrix\Disk\File::getById($fileId);
341 $builder->addText($file->getName());
345 return $builder->build();
355 $whereSql = \Bitrix\Main\Entity\Query::buildFilterSql(static::getEntity(),
$filter);
359 $tableName = static::getTableName();
361 $connection->queryExecute(
"DELETE FROM {$tableName} WHERE {$whereSql}");
371 $query->whereExpr(
"EXISTS ({$unreadSubQuery->getQuery()})", [
'ID']);
380 $query->whereExpr(
"EXISTS ({$viewedSubQuery->getQuery()})", [
'ID']);
389 $query->whereExpr(
"NOT EXISTS ({$unreadSubQuery->getQuery()})", [
'ID']);
394 $query->where(
'AUTHOR_ID',
'!=', 0)->where(
'NOTIFY_EVENT',
'!=',
'private_system');
static merge(array $data)
static validateNotifyTitle()
static withNonSystemOnly(Query $query)
static withReadOnly(Query $query)
static withUnreadOnly(Query $query)
static validateNotifySubTag()
static validateEmailTemplate()
static withViewedOnly(Query $query)
static validateNotifyTag()
static validateNotifyModule()
static deleteBatch(array $filter)
static validateNotifyEvent()
static removeBbCodes($text, $withFile=false, $attachValue=false)
static getInstance($userId=null)
static getConnection($name="")
static get($moduleId, $name, $default="", $siteId=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']