31 return 'b_bp_script_queue';
41 'data_type' =>
'integer',
45 'data_type' =>
'integer'
48 'data_type' =>
'datetime'
51 'data_type' =>
'integer'
54 'data_type' => Main\UserTable::class,
56 '=this.STARTED_BY' =>
'ref.ID'
58 'join_type' =>
'LEFT',
61 'data_type' =>
'integer'
64 'data_type' =>
'datetime'
67 'data_type' =>
'integer'
81 $all = (int) ScriptQueueDocumentTable::getCount([
'=QUEUE_ID' => $queueId]);
82 $queued = (int) ScriptQueueDocumentTable::getCount([
'=QUEUE_ID' => $queueId,
'=STATUS' => Status::QUEUED]);
87 'completed' => $all - $queued
93 $document = ScriptQueueDocumentTable::getList([
95 '=QUEUE_ID' => $queueId,
96 '=STATUS' => Status::QUEUED,
98 'order' => [
'ID' =>
'ASC'],
110 'STATUS' => Status::TERMINATED,
111 'MODIFIED_BY' => $userId
115 $docResult = ScriptQueueDocumentTable::getList([
117 '=QUEUE_ID' => $queueId,
118 '=STATUS' => Status::QUEUED,
123 $docIds = array_column($docResult->fetchAll(),
'ID');
125 ScriptQueueDocumentTable::updateMulti($docIds, [
'STATUS' => Status::TERMINATED],
true);
130 static::update($queueId, [
'STATUS' => Status::EXECUTING]);
135 static::update($queueId, [
'STATUS' => Status::COMPLETED]);
140 $result = static::getList([
'filter' => [
'=SCRIPT_ID' => $scriptId],
'select' => [
'ID']]);
142 foreach ($result as $row)
144 static::delete($row[
'ID']);
153 $fields = $event->getParameter(
'fields');
156 if(!isset($fields[
'MODIFIED_BY']))
158 $modifyFields[
'MODIFIED_BY'] = 0;
161 $result->modifyFields($modifyFields);
static deleteByQueue(int $queueId)
static markCompleted(int $queueId)
static getDocumentCounters(int $queueId)
static deleteByScript(int $scriptId)
static onBeforeUpdate(Main\ORM\Event $event)
static getNextQueuedDocument(int $queueId)
static markTerminated(int $queueId, int $userId)
static markExecuting(int $queueId)