2namespace Bitrix\MessageService\Internal\Entity;
4use Bitrix\Main\Application;
5use Bitrix\Main\ORM\Data\DataManager;
6use Bitrix\Main\ORM\Fields\ArrayField;
7use Bitrix\Main\ORM\Fields\DatetimeField;
8use Bitrix\Main\ORM\Fields\EnumField;
9use Bitrix\Main\ORM\Fields\ExpressionField;
10use Bitrix\Main\ORM\Fields\IntegerField;
11use Bitrix\Main\ORM\Fields\StringField;
12use Bitrix\Main\ORM\Fields\TextField;
13use Bitrix\Main\ORM\Fields\Validators\LengthValidator;
14use Bitrix\Main\Type\DateTime;
15use Bitrix\MessageService\Internal\Entity\Message\SuccessExec;
40 return 'b_messageservice_message';
51 ->configurePrimary(
true)
52 ->configureAutocomplete(
true)
56 'validation' => [__CLASS__,
'validateType']
58 ->configureRequired(
true)
62 'validation' => [__CLASS__,
'validateSenderId']
64 ->configureRequired(
true)
69 ->configureDefaultValue(0),
72 'validation' => [__CLASS__,
'validateMessageFrom']
77 'validation' => [__CLASS__,
'validateMessageTo']
79 ->configureRequired(
true)
83 ->configureSerializationPhp()
87 ->configureRequired(
true)
91 ->configureDefaultValue(
static fn() =>
new DateTime())
111 'validation' => [__CLASS__,
'validateExecError']
116 ->configureDefaultValue(0)
120 'validation' => [__CLASS__,
'validateExternalId']
125 'validation' => [__CLASS__,
'validateExternalStatus']
134 public static function getByExternalId(
string $senderId,
string $externalId, ?
string $from =
null)
138 '=SENDER_ID' => $senderId,
139 '=EXTERNAL_ID' => $externalId,
155 $tableName = static::getTableName();
161 STATUS_ID = {$newStatusId}
164 AND STATUS_ID != {$newStatusId}
173 $tableName = static::getTableName();
175 $newExternalStatus =
$connection->getSqlHelper()->forSql($newExternalStatus);
181 STATUS_ID = {$newInternalStatusId},
182 EXTERNAL_STATUS = '{$newExternalStatus}'
185 AND STATUS_ID < {$newInternalStatusId}
193 $today = (
new DateTime)->setTime(0, 0, 0);
196 '=SUCCESS_EXEC' =>
'Y',
197 '>=DATE_EXEC' => $today,
198 '=SENDER_ID' => $senderId,
199 '=MESSAGE_FROM' => $fromId,
205 $today = (
new DateTime)->setTime(0, 0, 0);
210 'SENDER_ID',
'MESSAGE_FROM',
'CNT'
213 '=SUCCESS_EXEC' =>
'Y',
214 '>=DATE_EXEC' => $today,
216 'group' => [
'SENDER_ID',
'MESSAGE_FROM'],
220 while ($row =
$result->fetch())
222 $id = $row[
'SENDER_ID'] .
':'. $row[
'MESSAGE_FROM'];
223 $counts[$id] = (int)$row[
'CNT'];
234 $senderId = $helper->forSql((
string)$senderId);
235 $fromId = $helper->forSql((
string)$fromId);
238 UPDATE b_messageservice_message
242 AND NEXT_EXEC IS NOT NULL
243 AND SENDER_ID = '{$senderId}'
244 AND MESSAGE_FROM = '{$fromId}'
351 $cache = \Bitrix\Main\Data\Cache::createInstance();
static getList(array $parameters=array())
static getCount($filter=array(), array $cache=array())
static getByExternalId(string $senderId, string $externalId, ?string $from=null)
static getAllDailyCount()
static onAfterAdd(\Bitrix\Main\ORM\Event $event)
static validateMessageFrom()
static validateExternalId()
static validateMessageTo()
static returnDeferredToQueue($senderId, $fromId)
static validateSenderId()
static onAfterDelete(\Bitrix\Main\ORM\Event $event)
static updateStatusId(int $id, int $newStatusId)
static validateExternalStatus()
static getDailyCount($senderId, $fromId)
static updateMessageStatuses($id, $newInternalStatusId, $newExternalStatus)
static onAfterUpdate(\Bitrix\Main\ORM\Event $event)
static validateExecError()
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)