1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
restrictedtracking.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Service;
4
5use Bitrix\Main\Config\Option;
6
8{
9 private array $templateIdMap = [];
10 private array $offTemplateMap = [];
11
12 public function canWrite($type, $workflowId)
13 {
14 if (!$this->isForcedMode($workflowId) && $this->isOff($workflowId))
15 {
16 return false;
17 }
18
19 return parent::canWrite($type, $workflowId);
20 }
21
22 private function isOff($workflowId): bool
23 {
24 $this->templateIdMap[$workflowId] ??= $this->getTemplateId($workflowId);
25 $templateId = $this->templateIdMap[$workflowId];
26
27 $this->offTemplateMap[$templateId] ??= $this->isTemplateOff($templateId);
28
29 return $this->offTemplateMap[$templateId];
30 }
31
32 private function getTemplateId($workflowId): int
33 {
34 try
35 {
36 return \CBPRuntime::getRuntime()->getWorkflow($workflowId, true)->getTemplateId();
37 }
38 catch (\Exception $e)
39 {
40 return 0;
41 }
42 }
43
44 private function isTemplateOff(int $templateId): bool
45 {
46 $optionName = 'tpl_track_on_' . $templateId;
47 $onTime = (int)Option::get('bizproc', $optionName, 0);
48
49 if ($onTime > 0)
50 {
51 $sevenDays = 7 * 86400;
52
53 return ($onTime + $sevenDays) <= time();
54 }
55
56 return true;
57 }
58}
$type
Определения options.php:106
canWrite($type, $workflowId)
Определения restrictedtracking.php:12
isForcedMode($workflowId)
Определения trackingservice.php:320
$templateId
Определения component_props2.php:51
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$optionName
Определения options.php:1735