$showType = 'Success'; } else { try { $documentType = $documentService->GetDocumentType($arTask["PARAMETERS"]["DOCUMENT_ID"]); if (!array_key_exists("BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2], $GLOBALS)) { $GLOBALS["BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2]] = 1; CBPDocument::AddShowParameterInit($documentType[0], "only_users", $documentType[2], $documentType[1]); } } catch (Exception $e) { CAdminMessage::ShowMessage(GetMessage('BPAT_NO_STATE')); $showType = 'Success'; } } list($taskForm, $taskFormButtons) = array("", ""); if ($showType != "Success") { list($taskForm, $taskFormButtons) = CBPDocument::ShowTaskForm($arTask, $userId, "", $_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" ? $_REQUEST : null); } ?> <form method="post" name="task_delegate" action="<?php echo GetPagePath(false, true); ?> "> <input type="hidden" name="action" value="delegate"> <input type="hidden" name="id" value="<?php echo intval($arTask["ID"]); ?> "> <input type="hidden" name="workflow_id" value="<?php echo htmlspecialcharsbx($arTask["WORKFLOW_ID"]); ?> ">
$context->Show(); $APPLICATION->SetTitle(str_replace("#ID#", $taskId, GetMessage("BPAT_TITLE"))); if (strlen($errorMessage) > 0) { CAdminMessage::ShowMessage($errorMessage); } $runtime = CBPRuntime::GetRuntime(); $runtime->StartRuntime(); $documentService = $runtime->GetService("DocumentService"); $documentType = $documentService->GetDocumentType($arTask["PARAMETERS"]["DOCUMENT_ID"]); if (!array_key_exists("BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2], $GLOBALS)) { $GLOBALS["BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2]] = 1; CBPDocument::AddShowParameterInit($documentType[0], "only_users", $documentType[2], $documentType[1]); } list($taskForm, $taskFormButtons) = array("", ""); if ($showType != "Success") { list($taskForm, $taskFormButtons) = CBPDocument::ShowTaskForm($arTask, $allowAdminAccess ? $userId : $USER->GetID(), "", $_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" ? $_REQUEST : null); } ?> <form method="post" name="task_form1" action="<?php echo GetPagePath(false, true); ?> " enctype="multipart/form-data"> <input type="hidden" name="action" value="doTask"> <input type="hidden" name="id" value="<?php echo intval($arTask["ID"]); ?> "> <input type="hidden" name="workflow_id" value="<?php echo htmlspecialcharsbx($arTask["WORKFLOW_ID"]); ?> ">
} } } } if (strlen($arResult["FatalErrorMessage"]) <= 0) { list($taskForm, $taskFormButtons) = array("", ""); if ($arResult["ShowType"] != "Success") { $runtime = CBPRuntime::GetRuntime(); $runtime->StartRuntime(); $documentService = $runtime->GetService("DocumentService"); $documentType = $documentService->GetDocumentType($arResult["Task"]["PARAMETERS"]["DOCUMENT_ID"]); if (!array_key_exists("BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2], $GLOBALS)) { $GLOBALS["BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2]] = 1; CBPDocument::AddShowParameterInit($documentType[0], "only_users", $documentType[2], $documentType[1]); } list($taskForm, $taskFormButtons) = CBPDocument::ShowTaskForm($arResult["Task"], $USER->GetID(), "", $_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" ? $_REQUEST : null); } $arResult["TaskForm"] = $taskForm; $arResult["TaskFormButtons"] = $taskFormButtons; } $this->IncludeComponentTemplate(); if (strlen($arResult["FatalErrorMessage"]) <= 0) { if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle(str_replace("#NAME#", $arResult["Task"]["NAME"], GetMessage("BPWC_WTC_PAGE_TITLE"))); } if ($arParams["SET_NAV_CHAIN"] == "Y") { $APPLICATION->AddChainItem($arResult["BlockType"]["NAME"], $arResult["PATH_TO_INDEX"]); $APPLICATION->AddChainItem($arResult["Block"]["NAME"], $arResult["PATH_TO_LIST"]); $APPLICATION->AddChainItem(str_replace("#NAME#", $arResult["Task"]["NAME"], GetMessage("BPWC_WTC_PAGE_NAV_CHAIN"))); } } else {
$arResult['WORKFLOW_TEMPLATE_NAME'] = $arState["TEMPLATE_NAME"]; $runtime = CBPRuntime::GetRuntime(); $runtime->StartRuntime(); $documentService = $runtime->GetService("DocumentService"); $arResult['DOCUMENT_ICON'] = $documentService->getDocumentIcon($arResult['TASK']['PARAMETERS']['DOCUMENT_ID']); if (empty($arResult['TASK']['DOCUMENT_NAME'])) { $arResult['TASK']['DOCUMENT_NAME'] = htmlspecialcharsbx($documentService->getDocumentName($arResult['TASK']['PARAMETERS']['DOCUMENT_ID'])); } if ($arResult["ShowMode"] != "Success") { try { $documentType = $documentService->GetDocumentType($arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"]); if (!array_key_exists("BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2], $GLOBALS)) { $GLOBALS["BP_AddShowParameterInit_" . $documentType[0] . "_" . $documentType[1] . "_" . $documentType[2]] = 1; CBPDocument::AddShowParameterInit($documentType[0], "only_users", $documentType[2], $documentType[1]); } // deprecated old style list($arResult["TaskForm"], $arResult["TaskFormButtons"]) = CBPDocument::ShowTaskForm($arResult["TASK"], $arParams["USER_ID"], "", $_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" ? $_REQUEST : null); // new style $arResult['TaskControls'] = CBPDocument::getTaskControls($arResult["TASK"]); } catch (Exception $e) { ShowError(GetMessage("BPAT_NO_ACCESS")); return false; } } $this->IncludeComponentTemplate(); if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle(GetMessage("BPAT_TITLE")); } if ($arParams["SET_NAV_CHAIN"] == "Y") { $APPLICATION->AddChainItem(GetMessage("BPAT_TITLE")); }
} if (!$arTask) { $workflowId = trim($_REQUEST["workflow_id"]); if (strlen($workflowId) > 0) { $dbTask = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $workflowId, "USER_ID" => $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS")); $arTask = $dbTask->GetNext(); } } if (!empty($arTask)) { $arResult["arTask"] = $arTask; $arResult["showType"] = "Form"; if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) { $arErrorsTmp = array(); if (CBPDocument::PostTaskForm($arResult["arTask"], $USER->GetID(), $_REQUEST, $arErrorsTmp, $USER->GetFullName())) { $arResult["showType"] = "Success"; LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BIZPROC"], array())); die; } else { foreach ($arErrorsTmp as $e) { $arResult["ErrorMessage"] .= $e["message"] . ".<br />"; } } } $APPLICATION->SetTitle(str_replace("#ID#", $arParams["TASK_ID"], GetMessage("BPAT_TITLE"))); list($arResult["taskForm"], $arResult["taskFormButtons"]) = array("", ""); if ($arResult["showType"] != "Success") { list($arResult["taskForm"], $arResult["taskFormButtons"]) = CBPDocument::ShowTaskForm($arResult["arTask"], $USER->GetID()); } } } $this->IncludeComponentTemplate();