1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
usertoworkflowstepper.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Worker\Task;
4
5use Bitrix\Main;
6use Bitrix\Main\Application;
7
9{
10 protected static $moduleId = 'bizproc';
11
12 private const STEP_ROWS_LIMIT = 100;
13
14 public function execute(array &$option)
15 {
16 $userId = (int)$this->getOuterParams()[0];
17 $lastId = (int)($this->getOuterParams()[1] ?? 0);
18 $limit = self::STEP_ROWS_LIMIT;
19
20 $connection = Application::getConnection();
21
22 $idCondition = $lastId > 0 ? " AND tu.ID < {$lastId} " : '';
23 $queryRows = $connection->query(
24 <<<SQL
25 select tu.ID from b_bp_task_user tu
26 where tu.USER_ID = {$userId} {$idCondition} order by tu.ID DESC LIMIT {$limit}
27 SQL
28 )->fetchAll();
29
30 $ids = array_column($queryRows, 'ID');
31
32 if (empty($ids))
33 {
34 return self::FINISH_EXECUTION;
35 }
36
37 $this->setOuterParams([$userId, end($ids)]);
38
39 $idsSql = implode(',', $ids);
40
41 $connection->query(
42 <<<SQL
43 INSERT INTO b_bp_workflow_user
44 (USER_ID, WORKFLOW_ID, IS_AUTHOR, WORKFLOW_STATUS, TASK_STATUS, MODIFIED)
45 (
46 select tu.USER_ID, t.WORKFLOW_ID, 0, case when wi.id is null then 1 else 0 end,
47 case when tu.STATUS = '0' then 2 else 1 end,
48 case when tu.DATE_UPDATE is null then now() else tu.DATE_UPDATE end
49 from b_bp_task_user tu
50 inner join b_bp_task t on (t.ID = tu.TASK_ID)
51 left join b_bp_workflow_instance wi on (t.WORKFLOW_ID = wi.ID)
52 where tu.ID IN ({$idsSql})
53 )
54 ON DUPLICATE KEY UPDATE WORKFLOW_STATUS = VALUES(WORKFLOW_STATUS), TASK_STATUS = VALUES(TASK_STATUS), MODIFIED = VALUES(MODIFIED)
55 SQL
56 );
57
58 return self::CONTINUE_EXECUTION;
59 }
60
61 public static function bindUser(int $userId): void
62 {
63 static::bind(0, [$userId]);
64 }
65}
return select
Определения access_edit.php:440
$connection
Определения actionsdefinitions.php:38
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
getOuterParams()
Определения stepper.php:212
setOuterParams(array $outerParams)
Определения stepper.php:207
if(!\Bitrix\Main\Loader::includeModule('clouds')) $lastId
Определения sync.php:68
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
hidden mSiteList<?=htmlspecialcharsbx(serialize( $siteList))?><?=htmlspecialcharsbx( $siteList[ $j]["ID"])?> _Propery<? if(((COption::GetOptionString( $module_id, "different_set", "N")=="Y") &&( $j !=0))||(COption::GetOptionString( $module_id, "different_set", "N")=="N")) echo "display: none;"?> top adm detail content cell l top adm detail content cell r heading center center ID left
Определения options.php:768
$option
Определения options.php:1711