1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CollaberNotAcceptInvitationOneDay.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
13use CTimeZone;
14
16{
17 public const LIFE_TIME = self::SECONDS_PER_DAY;
18 public const JOB_OFFSET = self::SECONDS_PER_DAY;
19
20 public function getType(): Type
21 {
22 return Type::CollaberNotAcceptInvitationOneDay;
23 }
24
25 public function isImmediatelyExecuted(): bool
26 {
27 return false; // Displayed only when the user has entered the collab
28 }
29
30 protected function createNextExecutionDate(): DateTime
31 {
32 $closestWorkDate = (new ClosestWorkDate())->get(self::JOB_OFFSET);
33
34 $userTimeOffset = CTimeZone::GetOffset($this->userId);
35 $closestWorkDate->add("-{$userTimeOffset} seconds");
36
37 return $closestWorkDate;
38 }
39
40 public function __invoke(): JobResult
41 {
42 $isCompletedByLifeTime = time() > ($this->nextExecution->getTimestamp() + static::LIFE_TIME);
43
44 if ($isCompletedByLifeTime)
45 {
46 return new JobResult();
47 }
48
49 return (new JobResult())->addError(new JobNotCompletedError());
50 }
51}
addError(Error $error)
Определения result.php:50