3namespace Bitrix\Bizproc\Controller;
5use Bitrix\Main\Engine\Response\HtmlContent;
7use Bitrix\Main\Localization\Loc;
16 ?
array $documentId =
null,
19 $operationParameters = [];
21 if (isset($documentType[3]))
23 $operationParameters[
'DocumentCategoryId'] = $documentType[3];
26 $documentType = \CBPHelper::ParseDocumentId($documentType);
29 $user = $this->getCurrentUser();
38 $documentId = \CBPHelper::parseDocumentId($documentId);
39 $hasAccess = \CBPDocument::canUserOperateDocument(
48 $hasAccess = \CBPDocument::canUserOperateDocumentType(
58 $this->
addError(
new Error(Loc::getMessage(
'BIZPROC_ACCESS_DENIED')));
75 ->validateRequire(
'Func')
76 ->validateEnum(
'Func', [
77 'BPRIASwitchSubTypeControl',
78 'BWFVCSwitchSubTypeControl',
79 'WFSSwitchSubTypeControlC',
80 'WFSSwitchSubTypeControlV',
81 'WFSSwitchSubTypeControlP',
83 ->setDefault(
'Value',
'')
86 $runtime = \CBPRuntime::GetRuntime();
87 $runtime->StartRuntime();
88 $documentService = $runtime->GetService(
"DocumentService");
90 return $documentService->GetFieldInputControlOptions(
100 $createInternalError =
static fn ($reason) =>
new Error(
'', 0, [
'reason' => $reason]);
102 if (!$this->request->isJson())
106 $createInternalError(
'Wrong request format. Expected json in request body.'),
112 $documentType = $this->request->getJsonList()->get(
'documentType');
113 $controlsData = $this->request->getJsonList()->get(
'controlsData');
117 $context = $this->request->getJsonList()->get(
'context') ?? [];
119 if (isset(
$context[
'signedDocumentId']))
121 $documentId = \CBPDocument::unSignDocumentType(
$context[
'signedDocumentId']);
122 if ($documentId && isset(
$context[
'isStartWorkflow']) &&
$context[
'isStartWorkflow'] ===
true)
128 if (!is_array($documentType))
131 $createInternalError(
'Wrong request format. Expected documentType in request json body.')
134 if (!is_array($controlsData))
137 $createInternalError(
'Wrong request format. Expected controlsData in request json body.')
142 foreach ($controlsData as
$data)
145 is_array(
$data[
'property'] ??
null)
146 && is_array(
$data[
'params'] ??
null)
150 $accessCheckOperation,
155 $property = $this->normalizeProperty(
$data[
'property']);
158 ->validateRequire(
'Field')
160 ->setPureValue(
'Value')
161 ->setDefault(
'Value',
'')
162 ->validateRequire(
'Als')
163 ->validateNumeric(
'Als')
164 ->validateEnum(
'RenderMode', [
'public',
'designer',
''])
165 ->setDefault(
'RenderMode',
'')
169 $renderer->addProperty($documentType, $property,
$params);
184 ->validateRequire(
'Field')
186 ->setPureValue(
'Value')
187 ->setDefault(
'Value',
'')
188 ->validateRequire(
'Als')
189 ->validateNumeric(
'Als')
190 ->validateEnum(
'RenderMode', [
'public',
'designer',
''])
191 ->setDefault(
'RenderMode',
'')
194 $property = $this->normalizeProperty($property);
199 private function normalizeProperty(
array $property):
array
202 isset($property[
'OptionsSort']) && is_array($property[
'OptionsSort'])
203 && isset($property[
'Options'])
204 && is_array($property[
'Options'])
205 &&
count($property[
'OptionsSort']) ===
count($property[
'Options'])
210 foreach ($property[
'OptionsSort'] as $optionKey)
212 if (!isset($property[
'Options'][$optionKey]))
214 $sortSuccess =
false;
217 $sortedOptions[$optionKey] = $property[
'Options'][$optionKey];
221 $property[
'Options'] = $sortedOptions;
inputAndAccessCheck(array &$documentType, array &$type, int $operation=\CBPCanUserOperateOperation::ViewWorkflow, ?array $documentId=null,)
renderControlCollectionAction()
renderControlAction(array $documentType, array $property, array $params)
static normalizeProperty($property)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
</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."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']