1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
workflowtemplate.php
См. документацию.
1
<?php
2
namespace
Bitrix\Bizproc\Copy\Implement;
3
4
use Bitrix\Main\Error;
5
use Bitrix\Main\Result;
6
7
class
WorkflowTemplate
8
{
9
const
WORKFLOW_TEMPLATE_COPY_ERROR
=
'WORKFLOW_TEMPLATE_COPY_ERROR'
;
10
11
protected
$targetDocumentType
= [];
12
protected
$mapStatusIdsCopiedDocument
= [];
13
14
protected
$result
;
15
16
public
function
__construct
(
$targetDocumentType
= [],
$mapStatusIdsCopiedDocument
= [])
17
{
18
$this->targetDocumentType =
$targetDocumentType
;
19
$this->mapStatusIdsCopiedDocument =
$mapStatusIdsCopiedDocument
;
20
21
$this->result =
new
Result
();
22
}
23
24
public
function
getFields
($workflowTemplateId)
25
{
26
$queryResult = \CBPWorkflowTemplateLoader::getList([], [
'ID'
=> $workflowTemplateId]);
27
return
((
$fields
= $queryResult->fetch()) ?
$fields
: []);
28
}
29
30
public
function
prepareFieldsToCopy
(
array
$fields
)
31
{
32
if
(isset(
$fields
[
'ID'
]))
33
{
34
unset(
$fields
[
'ID'
]);
35
}
36
37
if
($this->targetDocumentType)
38
{
39
$fields
[
'DOCUMENT_TYPE'
] =
$this->targetDocumentType
;
40
}
41
42
if
(array_key_exists(
$fields
[
'DOCUMENT_STATUS'
], $this->mapStatusIdsCopiedDocument))
43
{
44
$fields
[
'DOCUMENT_STATUS'
] = $this->mapStatusIdsCopiedDocument[
$fields
[
'DOCUMENT_STATUS'
]];
45
}
46
47
return
$fields
;
48
}
49
50
public
function
add
(
array
$fields
)
51
{
52
$result
=
false
;
53
54
if
(
$fields
)
55
{
56
$result
= \CBPWorkflowTemplateLoader::add(
$fields
,
true
);
57
}
58
59
if
(!
$result
)
60
{
61
$this->result->addError(
62
new
Error
(
'Failed to copy workflow template'
, self::WORKFLOW_TEMPLATE_COPY_ERROR)
63
);
64
}
65
66
return
$result
;
67
}
68
}
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate
Определения
workflowtemplate.php:8
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\$result
$result
Определения
workflowtemplate.php:14
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\getFields
getFields($workflowTemplateId)
Определения
workflowtemplate.php:24
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\add
add(array $fields)
Определения
workflowtemplate.php:50
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\$targetDocumentType
$targetDocumentType
Определения
workflowtemplate.php:11
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\$mapStatusIdsCopiedDocument
$mapStatusIdsCopiedDocument
Определения
workflowtemplate.php:12
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\__construct
__construct($targetDocumentType=[], $mapStatusIdsCopiedDocument=[])
Определения
workflowtemplate.php:16
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\prepareFieldsToCopy
prepareFieldsToCopy(array $fields)
Определения
workflowtemplate.php:30
Bitrix\Bizproc\Copy\Implement\WorkflowTemplate\WORKFLOW_TEMPLATE_COPY_ERROR
const WORKFLOW_TEMPLATE_COPY_ERROR
Определения
workflowtemplate.php:9
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
bizproc
lib
copy
implement
workflowtemplate.php
Создано системой
1.14.0