Вручную:
1 |
CUserCounter::Set(1, "bp_tasks", 1, "**"); |
Автоматически в соответствии с количеством задач БП:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$targetUserId = 2748; CModule::IncludeModule('bizproc'); $currentCounter = (int)CUserCounter::GetValue($targetUserId, 'bp_tasks', '**'); $arBizprocCounter = CBPTaskService::getCounters($targetUserId); if (isset($currentCounter) && $currentCounter != $arBizprocCounter['*']) { echo 'Счетчик неверный: ' . $arBizprocCounter['*'] . ' != ' . $currentCounter . '<br>'; CUserCounter::Set($targetUserId, 'bp_tasks', $arBizprocCounter['*'], '**'); echo 'Установлено новое значение: ' . (int)CUserCounter::GetValue($targetUserId, 'bp_tasks', '**') . '<br>'; } else { echo 'Счетчик корректен: ' . $arBizprocCounter['*'] . ' = ' . $currentCounter . '<br>'; } |