1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
taskservice.php
См. документацию.
1<?php
2
5
7{
8 const COUNTERS_CACHE_TAG_PREFIX = 'b_bp_tasks_cnt_';
9 private static $taskUsers = [];
10
11 public function deleteTask($id)
12 {
13 self::Delete($id);
14 }
15
16 public function deleteAllWorkflowTasks($workflowId)
17 {
18 self::DeleteByWorkflow($workflowId);
19 }
20
22 {
23 $taskId = (int)$taskId;
24 if ($taskId <= 0)
25 {
26 throw new Main\ArgumentOutOfRangeException('id', 1);
27 }
28
29 $userId = (int)$userId;
30 if ($userId <= 0)
31 {
32 throw new Main\ArgumentOutOfRangeException('userId', 1);
33 }
34
35 $status = (int)$status;
36
37 Bizproc\Workflow\Task\TaskUserTable::updateStatus($taskId, [$userId], $status);
38
39 self::decrementUserTaskCounter($userId);
41 $taskId,
42 [
43 'USERS' => [$userId],
44 'USERS_STATUSES' => [$userId => $status],
45 'COUNTERS_DECREMENTED' => [$userId],
46 'STATUS_NAME' => 'COMPLETED',
47 ],
49 );
50 foreach (GetModuleEvents('bizproc', 'OnTaskMarkCompleted', true) as $arEvent)
51 {
52 ExecuteModuleEventEx($arEvent, [$taskId, $userId, $status]);
53 }
54 }
55
60 public function markUnCompleted(int $taskId, array $userIds)
61 {
62 if ($taskId <= 0)
63 {
64 throw new Main\ArgumentOutOfRangeException('taskId', 1);
65 }
66
68 if (empty($userIds))
69 {
70 throw new Main\ArgumentNullException('userIds');
71 }
72
74
75 Bizproc\Workflow\Task\TaskUserTable::updateStatus($taskId, $userIds, $status);
76
77 $usersStatuses = [];
78 foreach ($userIds as $userId)
79 {
80 self::incrementUserTaskCounter($userId);
81 $usersStatuses[$userId] = $status;
82 }
84 $taskId,
85 [
86 'USERS' => $userIds,
87 'USERS_STATUSES' => $usersStatuses,
88 'COUNTERS_INCREMENTED' => $userIds,
89 'STATUS_NAME' => 'UNCOMPLETED',
90 ],
92 );
93 foreach (GetModuleEvents('bizproc', 'OnTaskMarkUnCompleted', true) as $arEvent)
94 {
95 ExecuteModuleEventEx($arEvent, [$taskId, $userIds, $status]);
96 }
97 }
98
99 public static function getTaskUsers($taskId)
100 {
101 global $DB;
102
103 $taskId = (array)$taskId;
104 $taskId = array_map('intval', $taskId);
105 $taskId = array_filter($taskId);
106 if (sizeof($taskId) < 1)
107 {
108 throw new Exception("taskId");
109 }
110
111 $users = [];
112 $where = '';
113 foreach ($taskId as $id)
114 {
115 if (!isset(self::$taskUsers[$id]))
116 {
117 if ($where)
118 {
119 $where .= ' OR ';
120 }
121 $where .= ' TASK_ID = '.$id;
122 self::$taskUsers[$id] = [];
123 }
124 else
125 {
126 $users[$id] = self::$taskUsers[$id];
127 }
128 }
129
130 if ($where)
131 {
132 $dateUpdateSelect = $DB->DateToCharFunction('TU.DATE_UPDATE', 'FULL') . ' as DATE_UPDATE';
133
134 $iterator = $DB->Query(
135 'SELECT'
136 .' TU.ID, TU.USER_ID, TU.TASK_ID, TU.STATUS, TU.ORIGINAL_USER_ID, ' . $dateUpdateSelect . ','
137 .' U.PERSONAL_PHOTO, U.NAME, U.LAST_NAME, U.SECOND_NAME, U.LOGIN, U.TITLE'
138 .' FROM b_bp_task_user TU'
139 .' INNER JOIN b_user U ON (U.ID = TU.USER_ID)'
140 .' WHERE '.$where
141 .' ORDER BY TU.DATE_UPDATE DESC'
142 );
143
144 while ($user = $iterator->fetch())
145 {
146 $users[$user['TASK_ID']][] = $user;
147 self::$taskUsers[$user['TASK_ID']][] = $user;
148 }
149 }
150
151 return $users;
152 }
153
154 public static function getTaskUserIds(int $taskId): array
155 {
156 $ids = [];
157 $taskUsers = static::getTaskUsers($taskId);
158 if (isset($taskUsers[$taskId]))
159 {
160 $ids = array_column($taskUsers[$taskId], 'USER_ID');
161 }
162
163 return array_map('intval', $ids);
164 }
165
172 public static function getWorkflowParticipants($workflowId, $userStatus = null)
173 {
174 global $DB;
175
176 if ($workflowId == '')
177 {
178 throw new Exception('workflowId');
179 }
180
181 $users = [];
182 $iterator = $DB->Query('SELECT DISTINCT TU.USER_ID'
183 .' FROM b_bp_task_user TU'
184 .' INNER JOIN b_bp_task T ON (T.ID = TU.TASK_ID)'
185 .' WHERE T.WORKFLOW_ID = \''.$DB->ForSql($workflowId).'\''
186 .($userStatus !== null ? ' AND TU.STATUS = '.(int)$userStatus : '')
187 );
188 while ($user = $iterator->fetch())
189 {
190 $users[] = (int)$user['USER_ID'];
191 }
192
193 return $users;
194 }
195
196 public static function getWorkflowUsers(string $workflowId): array
197 {
198 global $DB;
199
200 $users = [];
201 $iteratorOverdueNull = $DB->Query('SELECT DISTINCT TU.USER_ID, TU.STATUS'
202 . ' FROM b_bp_task_user TU'
203 . ' INNER JOIN b_bp_task T ON (T.ID = TU.TASK_ID)'
204 . ' WHERE T.WORKFLOW_ID = \''.$DB->ForSql($workflowId).'\''
205 . ' AND T.OVERDUE_DATE IS NULL'
206 );
207 self::extractUsers($iteratorOverdueNull, $users);
208
209 $connection = $DB->getConnection();
210 $sqlHelper = $connection->getSqlHelper();
211 $query = 'SELECT DISTINCT TU.USER_ID, TU.STATUS'
212 . ' FROM b_bp_task_user TU'
213 . ' INNER JOIN b_bp_task T ON (T.ID = TU.TASK_ID)'
214 . ' WHERE T.WORKFLOW_ID = \''.$DB->ForSql($workflowId).'\''
215 . ' AND T.OVERDUE_DATE > ' . $sqlHelper->getCurrentDateTimeFunction();
216 $iteratorOverdueFuture = $DB->Query($query);
217 self::extractUsers($iteratorOverdueFuture, $users);
218
219 return $users;
220 }
221
222 public static function extractUsers(mixed $usersIterator, array &$users): void
223 {
224 while ($user = $usersIterator->fetch())
225 {
226 $userId = (int)$user['USER_ID'];
227 $status = (int)$user['STATUS'];
228
229 if (isset($users[$userId]))
230 {
231 $users[$userId] = min($users[$userId], $status);
232 continue;
233 }
234
235 $users[$userId] = $status;
236 }
237 }
238
239 public static function delegateTask($taskId, $fromUserId, $toUserId)
240 {
241 $taskId = (int)$taskId;
242 $fromUserId = (int)$fromUserId;
243 $toUserId = (int)$toUserId;
244
245 if (!$taskId || !$fromUserId || !$toUserId)
246 {
247 return false;
248 }
249
250 // check USER_ID (USER_ID must be unique for task)
251 $iterator =
252 Bizproc\Workflow\Task\TaskUserTable::query()
253 ->setSelect(['USER_ID'])
254 ->where('TASK_ID', $taskId)
255 ->where('USER_ID', $toUserId)
256 ->exec()
257 ;
258 $row = $iterator->fetch();
259 if (!empty($row['USER_ID']))
260 {
261 return false;
262 }
263
264 Bizproc\Workflow\Task\TaskUserTable::delegateTask($taskId, $fromUserId, $toUserId);
265
266 self::decrementUserTaskCounter($fromUserId);
267 self::incrementUserTaskCounter($toUserId);
269 $taskId,
270 [
271 'USERS' => [$toUserId],
272 'USERS_ADDED' => [$toUserId],
273 'USERS_REMOVED' => [$fromUserId],
274 'COUNTERS_DECREMENTED' => [$fromUserId],
275 'COUNTERS_INCREMENTED' => [$toUserId],
276 ],
278 );
279 foreach (GetModuleEvents('bizproc', 'OnTaskDelegate', true) as $arEvent)
280 {
281 ExecuteModuleEventEx($arEvent, [$taskId, $fromUserId, $toUserId]);
282 }
283
284 return true;
285 }
286
287 public static function getOriginalTaskUserId($taskId, $realUserId)
288 {
289 $taskId = (int)$taskId;
290 $realUserId = (int)$realUserId;
291
292 $originalUserId = Bizproc\Workflow\Task\TaskUserTable::getOriginalTaskUserId($taskId, $realUserId);
293 if ($originalUserId !== null)
294 {
295 return $originalUserId > 0 ? $originalUserId : $realUserId;
296 }
297
298 return false;
299 }
300
301 public static function delete($id)
302 {
303 global $DB;
304
305 $id = intval($id);
306 if ($id <= 0)
307 {
308 throw new Exception("id");
309 }
310
311 $removedUsers = $decremented = [];
312 $dbRes = $DB->Query("SELECT USER_ID, STATUS FROM b_bp_task_user WHERE TASK_ID = ".intval($id)." ");
313 while ($arRes = $dbRes->Fetch())
314 {
315 if ($arRes['STATUS'] == CBPTaskUserStatus::Waiting)
316 {
317 self::decrementUserTaskCounter((int)$arRes['USER_ID']);
318 $decremented[] = $arRes["USER_ID"];
319 }
320 $removedUsers[] = $arRes["USER_ID"];
321 }
322 $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = ".intval($id)." ",);
323
325 $id,
326 [
327 'USERS_REMOVED' => $removedUsers,
328 'COUNTERS_DECREMENTED' => $decremented,
329 ],
331 );
332 foreach (GetModuleEvents("bizproc", "OnTaskDelete", true) as $arEvent)
333 {
334 ExecuteModuleEventEx($arEvent, [$id]);
335 }
336
337 $DB->Query('DELETE FROM b_bp_task WHERE ID = ' . (int)$id . ' ');
338 }
339
340 public static function deleteByWorkflow($workflowId, $taskStatus = null)
341 {
342 global $DB;
343
344 $workflowId = trim($workflowId);
345 if ($workflowId == '')
346 {
347 throw new Exception("workflowId");
348 }
349
350 $dbRes = $DB->Query(
351 "SELECT ID ".
352 "FROM b_bp_task ".
353 "WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' "
354 .($taskStatus !== null? 'AND STATUS = '.(int)$taskStatus : '')
355 );
356 $allUsers = [];
357 while ($arRes = $dbRes->Fetch())
358 {
359 $taskId = intval($arRes["ID"]);
360 $removedUsers = $decremented = [];
361 $dbResUser = $DB->Query("SELECT USER_ID, STATUS FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ");
362 while ($arResUser = $dbResUser->Fetch())
363 {
364 if ($arResUser['STATUS'] == CBPTaskUserStatus::Waiting)
365 {
366 self::decrementUserTaskCounter((int)$arResUser['USER_ID']);
367 $decremented[] = $arResUser["USER_ID"];
368 }
369 $removedUsers[] = $arResUser['USER_ID'];
370 $allUsers[] = $arResUser['USER_ID'];
371 }
372 $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = ".$taskId." ");
373
375 $taskId,
376 [
377 'USERS_REMOVED' => $removedUsers,
378 'COUNTERS_DECREMENTED' => $decremented,
379 ],
381 );
382 foreach (GetModuleEvents("bizproc", "OnTaskDelete", true) as $arEvent)
383 {
384 ExecuteModuleEventEx($arEvent, [$taskId]);
385 }
386 }
387
388 $DB->Query(
389 "DELETE FROM b_bp_task ".
390 "WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' "
391 .($taskStatus !== null? 'AND STATUS = '.(int)$taskStatus : '')
392 );
393 }
394
395 public static function getCounters($userId)
396 {
397 global $DB;
398
399 $counters = array('*' => 0);
400 $cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
401 $cacheTag = self::COUNTERS_CACHE_TAG_PREFIX.$userId;
402 if ($cache->read(3600*24*7, $cacheTag))
403 {
404 $counters = (array) $cache->get($cacheTag);
405 }
406 else
407 {
408 $query =
409 "SELECT WI.MODULE_ID AS MODULE_ID, WI.ENTITY AS ENTITY, COUNT('x') AS CNT ".
410 'FROM b_bp_task T '.
411 ' INNER JOIN b_bp_task_user TU ON (T.ID = TU.TASK_ID) '.
412 ' INNER JOIN b_bp_workflow_instance WI ON (T.WORKFLOW_ID = WI.ID) '.
413 'WHERE TU.STATUS = '.(int)CBPTaskUserStatus::Waiting.' '.
414 ' AND TU.USER_ID = '.(int)$userId.' '.
415 'GROUP BY MODULE_ID, ENTITY';
416
417 $iterator = $DB->Query($query);
418 if ($iterator)
419 {
420 while ($row = $iterator->fetch())
421 {
422 $cnt = (int)$row['CNT'];
423 $counters[$row['MODULE_ID']][$row['ENTITY']] = $cnt;
424 if (!isset($counters[$row['MODULE_ID']]['*']))
425 $counters[$row['MODULE_ID']]['*'] = 0;
426 $counters[$row['MODULE_ID']]['*'] += $cnt;
427 $counters['*'] += $cnt;
428 }
429 $cache->set($cacheTag, $counters);
430 }
431 }
432 return $counters;
433 }
434
435 protected static function onTaskChange($taskId, $taskData, $status)
436 {
437 $workflowId = isset($taskData['WORKFLOW_ID']) ? $taskData['WORKFLOW_ID'] : null;
438 if (!$workflowId)
439 {
440 $iterator = CBPTaskService::GetList(array('ID'=>'DESC'), array('ID' => $taskId), false, false, array('WORKFLOW_ID'));
441 $row = $iterator->fetch();
442 if (!$row)
443 {
444 return false;
445 }
446 $workflowId = $row['WORKFLOW_ID'];
447 $taskData['WORKFLOW_ID'] = $workflowId;
448 }
449
450 //clean counters cache
451 $users = array();
452 if (!empty($taskData['USERS']))
453 {
454 $users = $taskData['USERS'];
455 }
456 if (!empty($taskData['USERS_REMOVED']))
457 {
458 $users = array_merge($users, $taskData['USERS_REMOVED']);
459 }
460 if (!empty($taskData['USERS_STATUSES']))
461 {
462 $users = array_merge($users, array_keys($taskData['USERS_STATUSES']));
463 }
465
466 if (!empty($taskData['USERS_REMOVED']) || !empty($taskData['USERS_ADDED']))
467 {
468 unset(self::$taskUsers[$taskId]);
469 }
470
471 self::setSearchContent($status, $taskId, $taskData);
472
473 //ping document
474 $runtime = CBPRuntime::GetRuntime();
475 $runtime->StartRuntime();
476 $documentId = CBPStateService::GetStateDocumentId($workflowId);
477 if ($documentId)
478 {
479 $documentService = $runtime->GetService('DocumentService');
480 try
481 {
482 $documentService->onTaskChange($documentId, $taskId, $taskData, $status);
483 }
484 catch (Exception $e)
485 {
486
487 }
488 }
489
490 // currently out of usage
491 //static::pushChanges($taskId, $taskData, $status);
492
493 return true;
494 }
495
496 private static function pushChanges($taskId, $taskData, $status)
497 {
498 $eventName = Bizproc\Integration\Push\BasePush::EVENT_ADDED;
499 $users = [];
500
501 switch ($status)
502 {
504 $users = $taskData['USERS'];
505 break;
508 $eventName = Bizproc\Integration\Push\BasePush::EVENT_UPDATED;
509 $users = array_unique(
510 array_merge(
511 $taskData['USERS'] ?? [],
512 $taskData['USERS_ADDED'] ?? [],
513 $taskData['USERS_REMOVED'] ?? [],
514 array_keys($taskData['USERS_STATUSES'] ?? []),
515 )
516 );
517 break;
519 $eventName = Bizproc\Integration\Push\BasePush::EVENT_DELETED;
520 $users = $taskData['USERS_REMOVED'];
521 break;
522 }
523
524 if (empty($users))
525 {
526 $users = static::getTaskUserIds($taskId);
527 }
528
529 Bizproc\Integration\Push\TaskPush::pushLastEvent($eventName, $taskId, $users);
530 }
531
532 protected static function cleanCountersCache($users)
533 {
534 $users = (array) $users;
535 $users = array_unique($users);
536 $cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
537 foreach ($users as $userId)
538 {
539 $cache->clean(self::COUNTERS_CACHE_TAG_PREFIX.$userId);
540 }
541 }
542
543 protected static function parseFields(&$arFields, $id = 0)
544 {
545 global $DB;
546
547 $id = intval($id);
548 $updateMode = ($id > 0 ? true : false);
549 $addMode = !$updateMode;
550
551 if ($addMode && !is_set($arFields, "USERS"))
552 throw new Exception("USERS");
553
554 if (is_set($arFields, "USERS"))
555 {
556 $arUsers = $arFields["USERS"];
557 if (!is_array($arUsers))
558 $arUsers = array($arUsers);
559
560 $arFields["USERS"] = array();
561 foreach ($arUsers as $userId)
562 {
563 $userId = intval($userId);
564 if ($userId > 0 && !in_array($userId, $arFields["USERS"]))
565 $arFields["USERS"][] = $userId;
566 }
567
568 if (count($arFields["USERS"]) <= 0)
569 throw new Exception(GetMessage("BPTS_AI_AR_USERS"));
570 }
571
572 if (is_set($arFields, "WORKFLOW_ID") || $addMode)
573 {
574 $arFields["WORKFLOW_ID"] = trim($arFields["WORKFLOW_ID"]);
575 if ($arFields["WORKFLOW_ID"] == '')
576 throw new Exception("WORKFLOW_ID");
577 }
578
579 if (is_set($arFields, "ACTIVITY") || $addMode)
580 {
581 $arFields["ACTIVITY"] = trim($arFields["ACTIVITY"]);
582 if ($arFields["ACTIVITY"] == '')
583 throw new Exception("ACTIVITY");
584 }
585
586 if (is_set($arFields, "ACTIVITY_NAME") || $addMode)
587 {
588 $arFields["ACTIVITY_NAME"] = trim($arFields["ACTIVITY_NAME"]);
589 if ($arFields["ACTIVITY_NAME"] == '')
590 throw new Exception("ACTIVITY_NAME");
591 }
592
593 if (is_set($arFields, "NAME") || $addMode)
594 {
595 $arFields["NAME"] = is_scalar($arFields["NAME"]) ? trim($arFields["NAME"]) : '';
596 if ($arFields["NAME"] == '')
597 throw new Exception("NAME");
598
599 $arFields["NAME"] = htmlspecialcharsback($arFields["NAME"]);
600 }
601
602 if (is_set($arFields, "DESCRIPTION"))
603 {
604 $arFields["DESCRIPTION"] = htmlspecialcharsback(CBPHelper::stringify($arFields["DESCRIPTION"]));
605 }
606
607 if (is_set($arFields, "PARAMETERS"))
608 {
609 if ($arFields["PARAMETERS"] == null)
610 {
611 $arFields["PARAMETERS"] = false;
612 }
613 else
614 {
615 $arParameters = $arFields["PARAMETERS"];
616 if (!is_array($arParameters))
617 $arParameters = array($arParameters);
618 if (count($arParameters) > 0)
619 $arFields["PARAMETERS"] = serialize($arParameters);
620 }
621 }
622
623 if (is_set($arFields, "OVERDUE_DATE"))
624 {
625 if ($arFields["OVERDUE_DATE"] == null)
626 {
627 $arFields["OVERDUE_DATE"] = false;
628 }
629 elseif (!$DB->IsDate($arFields["OVERDUE_DATE"], false, LANG, "FULL"))
630 {
631 throw new Exception("OVERDUE_DATE");
632 }
633 }
634
635 if (isset($arFields['CREATED_DATE']) && !$DB->IsDate($arFields['CREATED_DATE']))
636 {
637 throw new Main\ArgumentException('Field CREATED_DATE must be datetime');
638 }
639 }
640
641 public static function onAdminInformerInsertItems()
642 {
643 global $USER;
644
645 if(!defined("BX_AUTH_FORM"))
646 {
647 $tasksCount = CUserCounter::GetValue($USER->GetID(), 'bp_tasks');
648
649 if($tasksCount > 0)
650 {
651 $bpAIParams = array(
652 "TITLE" => GetMessage("BPTS_AI_BIZ_PROC"),
653 "HTML" => '<span class="adm-informer-strong-text">'.GetMessage("BPTS_AI_EX_TASKS").'</span><br>'.GetMessage("BPTS_AI_TASKS_NUM").' '.$tasksCount,
654 "FOOTER" => '<a href="/bitrix/admin/bizproc_task_list.php?lang='.LANGUAGE_ID.'">'.GetMessage("BPTS_AI_TASKS_PERF").'</a>',
655 "COLOR" => "red",
656 "ALERT" => true,
657 );
658
659 CAdminInformer::AddItem($bpAIParams);
660 }
661 }
662 }
663
664 public function createTask($arFields)
665 {
666 return self::add($arFields);
667 }
668
669 public static function add($arFields): int
670 {
671 global $DB;
672
673 $arFields['CREATED_DATE'] = new Main\Type\DateTime();
674
675 self::ParseFields($arFields, 0);
676
677 $arInsert = $DB->PrepareInsert("b_bp_task", $arFields);
678
679 $strSql =
680 "INSERT INTO b_bp_task (".$arInsert[0].", MODIFIED) ".
681 "VALUES(".$arInsert[1].", ".$DB->CurrentTimeFunction().")";
682 $DB->Query($strSql);
683
684 $taskId = intval($DB->LastID());
685
686 if ($taskId > 0)
687 {
688 $users = [];
689 foreach ($arFields["USERS"] as $userId)
690 {
691 $userId = (int)($userId);
692 if (in_array($userId, $users))
693 {
694 continue;
695 }
696
697 $DB->Query(
698 "INSERT INTO b_bp_task_user (USER_ID, TASK_ID, ORIGINAL_USER_ID) ".
699 "VALUES (".intval($userId).", ".intval($taskId).", ".intval($userId).") "
700 );
701
702 self::incrementUserTaskCounter($userId);
703 $users[] = $userId;
704 }
705
706 $arFields['COUNTERS_INCREMENTED'] = $users;
708
709 foreach (GetModuleEvents("bizproc", "OnTaskAdd", true) as $arEvent)
710 {
711 ExecuteModuleEventEx($arEvent, [$taskId, $arFields]);
712 }
713 }
714
715 return $taskId;
716 }
717
718 public static function update($id, $arFields)
719 {
720 global $DB;
721
722 $id = intval($id);
723 if ($id <= 0)
724 {
725 throw new Exception("id");
726 }
727
728 self::ParseFields($arFields, $id);
729
730 $strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
731
732 if ($strUpdate)
733 {
734 $strSql =
735 "UPDATE b_bp_task SET ".
736 " ".$strUpdate.", ".
737 " MODIFIED = ".$DB->CurrentTimeFunction()." ".
738 "WHERE ID = ".intval($id)." ";
739 $DB->Query($strSql);
740 }
741
742 $removedUsers = $addedUsers = $decremented = $incremented = [];
743
744 if (is_set($arFields, 'USERS'))
745 {
746 $arFields['USERS'] = array_map('intval', array_unique($arFields['USERS']));
747 $previousUserIds = static::getTaskUserIds($id);
748
749 foreach ($arFields['USERS'] as $userId)
750 {
751 if (in_array($userId, $previousUserIds, true))
752 {
753 continue;
754 }
755
756 $DB->Query(
757 "INSERT INTO b_bp_task_user (USER_ID, TASK_ID, ORIGINAL_USER_ID) ".
758 "VALUES ({$userId}, {$id}, {$userId})"
759 );
760
761 $addedUsers[] = $userId;
762 $incremented[] = $userId;
763 self::incrementUserTaskCounter($userId);
764 }
765
766 $diff = array_diff($previousUserIds, $arFields['USERS']);
767 foreach ($diff as $removedUserId)
768 {
769 $decremented[] = $removedUserId;
770 self::decrementUserTaskCounter($removedUserId);
771 $removedUsers[] = $removedUserId;
772 $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = {$id} AND USER_ID = {$removedUserId}");
773 }
774 }
775
776 $userStatuses = [];
777 if (isset($arFields['STATUS']) && $arFields['STATUS'] > CBPTaskStatus::Running)
778 {
779 $dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = ".$id." AND STATUS = ".CBPTaskUserStatus::Waiting);
780 while ($userIterator = $dbResUser->Fetch())
781 {
782 $decremented[] = $userIterator["USER_ID"];
783 self::decrementUserTaskCounter((int)$userIterator['USER_ID']);
784
785 if ($arFields['STATUS'] == CBPTaskStatus::Timeout)
786 {
787 $userStatuses[$userIterator["USER_ID"]] = CBPTaskUserStatus::No;
788 }
789 else
790 {
791 $removedUsers[] = $userIterator["USER_ID"];
792 }
793 }
794 if ($arFields['STATUS'] == CBPTaskStatus::Timeout)
795 {
796 $DB->Query("UPDATE b_bp_task_user SET STATUS = ".CBPTaskUserStatus::No.", DATE_UPDATE = ".$DB->CurrentTimeFunction()
797 ." WHERE TASK_ID = ".$id." AND STATUS = ".CBPTaskUserStatus::Waiting);
798 }
799 else
800 {
801 $DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
802 }
803 }
804
805 foreach (GetModuleEvents("bizproc", "OnTaskUpdate", true) as $arEvent)
806 {
807 ExecuteModuleEventEx($arEvent, [$id, $arFields]);
808 }
809
810 if ($removedUsers)
811 {
812 $arFields['USERS_REMOVED'] = $removedUsers;
813 }
814 if ($addedUsers)
815 {
816 $arFields['USERS_ADDED'] = $addedUsers;
817 }
818 if ($userStatuses)
819 {
820 $arFields['USERS_STATUSES'] = $userStatuses;
821 }
822
823 $arFields['COUNTERS_INCREMENTED'] = $incremented;
824 $arFields['COUNTERS_DECREMENTED'] = $decremented;
825
827
828 return $id;
829 }
830
831 public static function getList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
832 {
833 global $DB;
834
835 if (count($arSelectFields) <= 0)
836 $arSelectFields = array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS");
837
838 static $arFields = array(
839 "ID" => array("FIELD" => "T.ID", "TYPE" => "int"),
840 "WORKFLOW_ID" => array("FIELD" => "T.WORKFLOW_ID", "TYPE" => "string"),
841 "ACTIVITY" => array("FIELD" => "T.ACTIVITY", "TYPE" => "string"),
842 "ACTIVITY_NAME" => array("FIELD" => "T.ACTIVITY_NAME", "TYPE" => "string"),
843 "MODIFIED" => array("FIELD" => "T.MODIFIED", "TYPE" => "datetime"),
844 'CREATED_DATE' => ['FIELD' => 'T.CREATED_DATE', 'TYPE' => 'datetime'],
845 "OVERDUE_DATE" => array("FIELD" => "T.OVERDUE_DATE", "TYPE" => "datetime"),
846 "NAME" => array("FIELD" => "T.NAME", "TYPE" => "string"),
847 "DESCRIPTION" => array("FIELD" => "T.DESCRIPTION", "TYPE" => "string"),
848 "PARAMETERS" => array("FIELD" => "T.PARAMETERS", "TYPE" => "string"),
849 "IS_INLINE" => array("FIELD" => "T.IS_INLINE", "TYPE" => "string"),
850 "DELEGATION_TYPE" => array("FIELD" => "T.DELEGATION_TYPE", "TYPE" => "int"),
851 "STATUS" => array("FIELD" => "T.STATUS", "TYPE" => "int"),
852 'DOCUMENT_NAME' => array("FIELD" => "T.DOCUMENT_NAME", "TYPE" => "string"),
853 "USER_ID" => array("FIELD" => "TU.USER_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_bp_task_user TU ON (T.ID = TU.TASK_ID)"),
854 "USER_STATUS" => array("FIELD" => "TU.STATUS", "TYPE" => "int", "FROM" => "INNER JOIN b_bp_task_user TU ON (T.ID = TU.TASK_ID)"),
855 "WORKFLOW_TEMPLATE_ID" => array("FIELD" => "WS.WORKFLOW_TEMPLATE_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
856 "MODULE_ID" => array("FIELD" => "WS.MODULE_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
857 "ENTITY" => array("FIELD" => "WS.ENTITY", "TYPE" => "string", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
858 "DOCUMENT_ID" => array("FIELD" => "WS.DOCUMENT_ID", "TYPE" => "string", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
859 "WORKFLOW_TEMPLATE_NAME" => array("FIELD" => "WT.NAME", "TYPE" => "string",
860 "FROM" => array("INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)",
861 "INNER JOIN b_bp_workflow_template WT ON (WS.WORKFLOW_TEMPLATE_ID = WT.ID)")),
862 "WORKFLOW_TEMPLATE_TEMPLATE_ID" => array("FIELD" => "WS.WORKFLOW_TEMPLATE_ID", "TYPE" => "int",
863 "FROM" => array("INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)")),
864 'WORKFLOW_STATE' => array("FIELD" => "WS.STATE_TITLE", "TYPE" => "string", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
865 'WORKFLOW_STARTED' => array("FIELD" => "WS.STARTED", "TYPE" => "datetime", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
866 'WORKFLOW_STARTED_BY' => array("FIELD" => "WS.STARTED_BY", "TYPE" => "int", "FROM" => "INNER JOIN b_bp_workflow_state WS ON (T.WORKFLOW_ID = WS.ID)"),
867 );
868
869 $arSqls = CBPHelper::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
870
871 $arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
872
873 if (is_array($arGroupBy) && count($arGroupBy)==0)
874 {
875 $strSql =
876 "SELECT ".$arSqls["SELECT"]." ".
877 "FROM b_bp_task T ".
878 " ".$arSqls["FROM"]." ";
879 if ($arSqls["WHERE"] <> '')
880 $strSql .= "WHERE ".$arSqls["WHERE"]." ";
881 if ($arSqls["GROUPBY"] <> '')
882 $strSql .= "GROUP BY ".$arSqls["GROUPBY"]." ";
883
884 $dbRes = $DB->Query($strSql);
885 if ($arRes = $dbRes->Fetch())
886 return $arRes["CNT"];
887 else
888 return False;
889 }
890
891 $strSql =
892 "SELECT ".$arSqls["SELECT"]." ".
893 "FROM b_bp_task T ".
894 " ".$arSqls["FROM"]." ";
895 if ($arSqls["WHERE"] <> '')
896 $strSql .= "WHERE ".$arSqls["WHERE"]." ";
897 if ($arSqls["GROUPBY"] <> '')
898 $strSql .= "GROUP BY ".$arSqls["GROUPBY"]." ";
899 if ($arSqls["ORDERBY"] <> '')
900 $strSql .= "ORDER BY ".$arSqls["ORDERBY"]." ";
901
902 if (is_array($arNavStartParams) && empty($arNavStartParams["nTopCount"]))
903 {
904 $strSql_tmp =
905 "SELECT COUNT('x') as CNT ".
906 "FROM b_bp_task T ".
907 " ".$arSqls["FROM"]." ";
908 if ($arSqls["WHERE"] <> '')
909 $strSql_tmp .= "WHERE ".$arSqls["WHERE"]." ";
910 if ($arSqls["GROUPBY"] <> '')
911 $strSql_tmp .= "GROUP BY ".$arSqls["GROUPBY"]." ";
912
913 $dbRes = $DB->Query($strSql_tmp);
914 $cnt = 0;
915 if ($arSqls["GROUPBY"] == '')
916 {
917 if ($arRes = $dbRes->Fetch())
918 $cnt = $arRes["CNT"];
919 }
920 else
921 {
922 $cnt = $dbRes->SelectedRowsCount();
923 }
924
925 $dbRes = new CDBResult();
926 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
927 }
928 else
929 {
930 if (is_array($arNavStartParams) && intval($arNavStartParams["nTopCount"]) > 0)
931 $strSql .= "LIMIT ".intval($arNavStartParams["nTopCount"]);
932 $dbRes = $DB->Query($strSql);
933 }
934
936 return $dbRes;
937 }
938
939 public static function isLastTaskForUserByActivity(string $activityName, int $userId, int $templateId, ?string $activity = null): bool
940 {
941 $previousTasks = static::getPreviousTasks($activityName, $userId, $templateId, $activity);
942 $neededTask = static::getNeededTaskByActivityName($activityName, $previousTasks);
943
944 foreach ($previousTasks as $task)
945 {
946 if (is_null($task['CREATED_DATE']) || is_null($neededTask['MODIFIED']))
947 {
948 continue;
949 }
950
951 $completedCreatedDiff = $task['CREATED_DATE']->getTimestamp() - $neededTask['MODIFIED']->getTimestamp();
952 if ($completedCreatedDiff <= 2 && $completedCreatedDiff >= 0 && $task !== $neededTask)
953 {
954 return false;
955 }
956 }
957
958 return true;
959 }
960
961 private static function getPreviousTasks(string $activityName, int $userId, int $templateId, ?string $activity = null): array
962 {
963 $filter = [
964 '=ACTIVITY_NAME' => $activityName,
965 '=TASK_USERS.USER_ID' => $userId,
966 '=WORKFLOW_STATE.WORKFLOW_TEMPLATE_ID' => $templateId,
967 ];
968 if ($activity)
969 {
970 $filter['=ACTIVITY'] = $activity;
971 }
972 $previousWorkflowIdSubquery =
973 Bizproc\Workflow\Task\TaskTable::query()
974 ->setSelect(['WORKFLOW_ID'])
975 ->setFilter($filter)
976 ->whereNull('WORKFLOW_INSTANCE.ID')
977 ->setOrder(['TASK_USERS.TASK_ID' => 'DESC'])
978 ->setLimit(1)
979 ->getQuery()
980 ;
981
982 $tasksQuery =
983 Bizproc\Workflow\Task\TaskTable::query()
984 ->setSelect(['ID', 'CREATED_DATE', 'MODIFIED', 'ACTIVITY_NAME'])
985 ->setFilter([
986 '=TASK_USERS.USER_ID' => $userId,
987 '!=TASK_USERS.STATUS' => CBPTaskUserStatus::Waiting,
988 '=WORKFLOW_ID' => new Main\DB\SqlExpression("($previousWorkflowIdSubquery)"),
989 ])
990 ->setOrder(['MODIFIED' => 'ASC'])
991 ;
992
993 return $tasksQuery->fetchAll();
994 }
995
996 private static function getNeededTaskByActivityName(string $activityName, array $previousTasks): ?array
997 {
998 foreach ($previousTasks as $task)
999 {
1000 if ($task["ACTIVITY_NAME"] === $activityName)
1001 {
1002 return static::getLastCompletedParallelTask($task, $previousTasks);
1003 }
1004 }
1005
1006 return null;
1007 }
1008
1009 private static function getLastCompletedParallelTask(array $neededTask, array $previousTasks): array
1010 {
1011 foreach ($previousTasks as $task)
1012 {
1013 if (
1014 (!is_null($task['CREATED_DATE']) && !is_null($neededTask['CREATED_DATE']))
1015 && $task['CREATED_DATE']->getTimestamp() - $neededTask['CREATED_DATE']->getTimestamp() <= 2
1016 && $task['MODIFIED'] > $neededTask['MODIFIED']
1017 )
1018 {
1019 $neededTask = $task;
1020 }
1021 }
1022
1023 return $neededTask;
1024 }
1025
1026 private static function setSearchContent($status, $taskId, $taskData): void
1027 {
1028 try
1029 {
1030 switch ($status)
1031 {
1033 Bizproc\Workflow\Task\TaskSearchContentTable::add([
1034 'TASK_ID' => $taskId,
1035 'WORKFLOW_ID' => $taskData['WORKFLOW_ID'],
1036 'SEARCH_CONTENT' => $taskData['NAME'] . ' ' . ($taskData['DESCRIPTION'] ?? ''),
1037 ]);
1038 break;
1040 if (!empty($taskData['NAME']) && !empty($taskData['DESCRIPTION']))
1041 {
1042 Bizproc\Workflow\Task\TaskSearchContentTable::update(
1043 $taskId,
1044 [
1045 'SEARCH_CONTENT' => $taskData['NAME'] . ' ' . $taskData['DESCRIPTION'],
1046 ]
1047 );
1048 }
1049 break;
1051 Bizproc\Workflow\Task\TaskSearchContentTable::delete($taskId);
1052 break;
1053 }
1054 }
1055 catch (Main\DB\SqlQueryException $e)
1056 {
1057 //skip operation, empty search content
1058 }
1059 }
1060
1061 private static function incrementUserTaskCounter(int $userId): void
1062 {
1063 $userCounters = new Bizproc\Workflow\WorkflowUserCounters($userId);
1064 $userCounters->incrementTask();
1065 }
1066
1067 private static function decrementUserTaskCounter(int $userId): void
1068 {
1069 $userCounters = new Bizproc\Workflow\WorkflowUserCounters($userId);
1070 $userCounters->decrementTask();
1071 }
1072}
1073
1075{
1076 private static $classesList = [
1077 Bizproc\BaseType\Value\Date::class,
1078 Bizproc\BaseType\Value\DateTime::class,
1079 Main\Type\Date::class,
1080 Main\Type\DateTime::class,
1081 \DateTime::class,
1082 \DateTimeZone::class,
1083 Main\Web\Uri::class,
1084 ];
1085
1086 function fetch()
1087 {
1088 $res = parent::Fetch();
1089
1090 if ($res)
1091 {
1092 if (!empty($res["PARAMETERS"]))
1093 {
1094 $res["PARAMETERS"] = unserialize($res["PARAMETERS"], ['allowed_classes' => self::$classesList]);
1095 }
1096 }
1097
1098 return $res;
1099 }
1100
1101 function getNext($bTextHtmlAuto=true, $use_tilda=true)
1102 {
1103 $res = parent::GetNext($bTextHtmlAuto, $use_tilda);
1104
1105 if ($res)
1106 {
1107 if (!empty($res["DESCRIPTION"]))
1108 {
1109 $res["DESCRIPTION"] = CBPHelper::convertBBtoText($res["DESCRIPTION"]);
1110 }
1111 }
1112
1113 return $res;
1114 }
1115
1122 {
1123 $text = preg_replace(
1124 "'(?<=^|[\s.,;:!?\#\-\*\|\[\‍(\‍)\{\}]|\s)((http|https|news|ftp|aim|mailto)://[\.\-\_\:a-z0-9\@]([^\"\s\'\[\]\{\}])*)'is",
1125 "[url]\\1[/url]",
1126 $text
1127 );
1128
1129 $text = preg_replace_callback("#\[img\](.+?)\[/img\]#i", array($this, "ConvertBCodeImageTag"), $text);
1130
1131 $text = preg_replace_callback(
1132 "/\[url\]([^\]]+?)\[\/url\]/iu",
1133 array($this, "ConvertBCodeAnchorTag"),
1134 $text
1135 );
1136 $text = preg_replace_callback(
1137 "/\[url\s*=\s*([^\]]+?)\s*\](.*?)\[\/url\]/iu",
1138 array($this, "ConvertBCodeAnchorTag"),
1139 $text
1140 );
1141
1142 $text = preg_replace(
1143 array(
1144 "/\[b\](.+?)\[\/b\]/isu",
1145 "/\[i\](.+?)\[\/i\]/isu",
1146 "/\[s\](.+?)\[\/s\]/isu",
1147 "/\[u\](.+?)\[\/u\]/isu",
1148 ),
1149 array(
1150 "<b>\\1</b>",
1151 "<i>\\1</i>",
1152 "<s>\\1</s>",
1153 "<u>\\1</u>",
1154 ),
1155 $text
1156 );
1157
1158 return $text;
1159 }
1160
1167 {
1168 if (is_array($url))
1169 $url = $url[1];
1170 $url = trim($url);
1171 if ($url == '')
1172 return "";
1173
1174 $extension = preg_replace("/^.*\.(\S+)$/u", "\\1", $url);
1175 $extension = mb_strtolower($extension);
1176 $extension = preg_quote($extension, "/");
1177
1178 $bErrorIMG = False;
1179
1180 if (preg_match("/[?&;]/u", $url))
1181 $bErrorIMG = True;
1182 if (!$bErrorIMG && !preg_match("/$extension(\||\$)/u", "gif|jpg|jpeg|png"))
1183 $bErrorIMG = True;
1184 if (!$bErrorIMG && !preg_match("/^((http|https|ftp)\:\/\/[-_:.a-z0-9@]+)*(\/[-_+\/=:.a-z0-9@%]+)$/iu", $url))
1185 $bErrorIMG = True;
1186
1187 if ($bErrorIMG)
1188 return "[img]".$url."[/img]";
1189
1190 return '<img src="'.$url.'" border="0" />';
1191 }
1192
1200 {
1201 if (is_array($url))
1202 {
1203 $text = isset($url[2]) ? $url[2] : $url[1];
1204 $url = $url[1];
1205 }
1206
1207 $result = "";
1208
1209 if ($url === $text)
1210 {
1211 $arUrl = explode(", ", $url);
1212 $arText = $arUrl;
1213 }
1214 else
1215 {
1216 $arUrl = array($url);
1217 $arText = array($text);
1218 }
1219
1220 for ($i = 0, $n = count($arUrl); $i < $n; $i++)
1221 {
1222 $url = $arUrl[$i];
1223 $text = $arText[$i];
1224
1225 $text = str_replace("\\\"", "\"", $text);
1226 $end = "";
1227
1228 if (preg_match("/([\.,\?]|&#33;)$/u", $url, $match))
1229 {
1230 $end = $match[1];
1231 $url = preg_replace("/([\.,\?]|&#33;)$/u", "", $url);
1232 $text = preg_replace("/([\.,\?]|&#33;)$/u", "", $text);
1233 }
1234
1235 $url = preg_replace(
1236 array("/&amp;/u", "/javascript:/iu"),
1237 array("&", "java script&#58; "),
1238 $url
1239 );
1240 if (mb_substr($url, 0, 1) != "/" && !preg_match("/^(http|news|https|ftp|aim|mailto)\:\/\//iu", $url))
1241 $url = 'http://'.$url;
1242 if (!preg_match("/^((http|https|news|ftp|aim):\/\/[-_:.a-z0-9@]+)*([^\"\'])+$/iu", $url))
1243 return $text." (".$url.")".$end;
1244
1245 $text = preg_replace(
1246 array("/&amp;/iu", "/javascript:/iu"),
1247 array("&", "javascript&#58; "),
1248 $text
1249 );
1250
1251 if ($result !== "")
1252 $result .= ", ";
1253
1254 $result .= "<a href=\"".$url."\" target='_blank'>".$text."</a>".$end;
1255 }
1256
1257 return $result;
1258 }
1259
1260}
$connection
Определения actionsdefinitions.php:38
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getInstance()
Определения application.php:98
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения collection.php:150
static AddItem($arParams)
Определения admin_informer.php:27
$result
Определения dbresult.php:16
$runtime
Определения runtimeservice.php:5
const Add
Определения constants.php:315
const Delegate
Определения constants.php:317
const Delete
Определения constants.php:318
const Update
Определения constants.php:316
Определения taskservice.php:1075
convertBCodeImageTag($url="")
Определения taskservice.php:1166
convertBCodeAnchorTag($url, $text='')
Определения taskservice.php:1199
getNext($bTextHtmlAuto=true, $use_tilda=true)
Определения taskservice.php:1101
convertBBCode($text)
Определения taskservice.php:1121
fetch()
Определения taskservice.php:1086
Определения taskservice.php:7
static isLastTaskForUserByActivity(string $activityName, int $userId, int $templateId, ?string $activity=null)
Определения taskservice.php:939
static GetList($arOrder=array("ID"=> "DESC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения taskservice.php:138
markCompleted($taskId, $userId, $status=CBPTaskUserStatus::Ok)
Определения taskservice.php:21
static parseFields(&$arFields, $id=0)
Определения taskservice.php:543
static getTaskUserIds(int $taskId)
Определения taskservice.php:154
createTask($arFields)
Определения taskservice.php:664
static getTaskUsers($taskId)
Определения taskservice.php:99
static update($id, $arFields)
Определения taskservice.php:718
deleteTask($id)
Определения taskservice.php:11
markUnCompleted(int $taskId, array $userIds)
Определения taskservice.php:60
static cleanCountersCache($users)
Определения taskservice.php:532
deleteAllWorkflowTasks($workflowId)
Определения taskservice.php:16
static onTaskChange($taskId, $taskData, $status)
Определения taskservice.php:435
const COUNTERS_CACHE_TAG_PREFIX
Определения taskservice.php:8
static deleteByWorkflow($workflowId, $taskStatus=null)
Определения taskservice.php:340
static delegateTask($taskId, $fromUserId, $toUserId)
Определения taskservice.php:239
static onAdminInformerInsertItems()
Определения taskservice.php:641
static getList($arOrder=array("ID"=> "DESC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения taskservice.php:831
static extractUsers(mixed $usersIterator, array &$users)
Определения taskservice.php:222
static getCounters($userId)
Определения taskservice.php:395
static getOriginalTaskUserId($taskId, $realUserId)
Определения taskservice.php:287
static getWorkflowParticipants($workflowId, $userStatus=null)
Определения taskservice.php:172
static getWorkflowUsers(string $workflowId)
Определения taskservice.php:196
static add($arFields)
Определения taskservice.php:669
const Timeout
Определения constants.php:262
const Running
Определения constants.php:258
const Ok
Определения constants.php:276
const No
Определения constants.php:275
const Waiting
Определения constants.php:273
Определения dbresult.php:88
$templateId
Определения component_props2.php:51
$arFields
Определения dblapprove.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$query
Определения get_search.php:11
$activity
Определения options.php:214
$filter
Определения iblock_catalog_list.php:54
global $DB
Определения cron_frame.php:29
global $USER
Определения csv_new_run.php:40
$status
Определения session.php:10
ExecuteModuleEventEx($arEvent, $arParams=[])
Определения tools.php:5214
htmlspecialcharsback($str)
Определения tools.php:2693
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
Определения tools.php:5177
is_set($a, $k=false)
Определения tools.php:2133
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$user
Определения mysql_to_pgsql.php:33
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$text
Определения template_pdf.php:79
$i
Определения factura.php:643
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$counters
Определения options.php:100
$arRes
Определения options.php:104
$n
Определения update_log.php:107
$arFilter
Определения user_search.php:106
$url
Определения iframe.php:7
$dbRes
Определения yandex_detail.php:168
$iterator
Определения yandex_run.php:610