示例#1
0
if (!$arTask) {
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    $APPLICATION->SetTitle(GetMessage("BPAT_NO_TASK"));
    CAdminMessage::ShowMessage(GetMessage("BPAT_NO_TASK") . ". ");
} else {
    $backUrl = "/" . ltrim(trim($_REQUEST["back_url"]), "\\/");
    if (strlen($backUrl) <= 0) {
        $backUrl = "/bitrix/admin/bizproc_task_list.php?lang=" . LANGUAGE_ID;
    }
    if (strlen($backUrl) <= 0 && isset($arTask["PARAMETERS"]["DOCUMENT_ID"])) {
        $backUrl = CBPDocument::GetDocumentAdminPage($arTask["PARAMETERS"]["DOCUMENT_ID"]);
    }
    $showType = "Form";
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) {
        $arErrorsTmp = array();
        if (CBPDocument::PostTaskForm($arTask, $allowAdminAccess ? $userId : $USER->GetID(), $_REQUEST + $_FILES, $arErrorsTmp, $USER->GetFormattedName(false))) {
            $showType = "Success";
            if (strlen($backUrl) > 0) {
                LocalRedirect($backUrl);
                die;
            }
        } else {
            foreach ($arErrorsTmp as $e) {
                $errorMessage .= $e["message"] . ".<br />";
            }
        }
    }
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    $aMenu = array(array("TEXT" => GetMessage("BPAT_BACK"), "LINK" => $backUrl, "ICON" => "btn_list"));
    $context = new CAdminContextMenu($aMenu);
    $context->Show();
示例#2
0
文件: task.php 项目: Satariall/izurit
 $backUrl = "/" . ltrim(trim($_REQUEST["back_url"]), "\\/");
 if (strlen($backUrl) <= 0) {
     $backUrl = "/bitrix/admin/bizproc_task_list.php?lang=" . LANGUAGE_ID;
 }
 if (strlen($backUrl) <= 0 && !empty($arTask["PARAMETERS"]["DOCUMENT_ID"])) {
     $backUrl = CBPDocument::GetDocumentAdminPage($arTask["PARAMETERS"]["DOCUMENT_ID"]);
 }
 $backUrl = CHTTP::urlDeleteParams($backUrl, array('mode'));
 $showType = "Form";
 if ($arTask['STATUS'] > CBPTaskStatus::Running || $arTask['USER_STATUS'] > CBPTaskUserStatus::Waiting) {
     $showType = "Success";
 }
 if ($_SERVER["REQUEST_METHOD"] == "POST" && check_bitrix_sessid()) {
     if ($_POST["action"] == "doTask") {
         $arErrorsTmp = array();
         if (CBPDocument::PostTaskForm($arTask, $userId, $_REQUEST + $_FILES, $arErrorsTmp, $USER->GetFormattedName(false))) {
             $showType = "Success";
             if (strlen($backUrl) > 0) {
                 LocalRedirect($backUrl);
                 die;
             }
         } else {
             foreach ($arErrorsTmp as $e) {
                 $errorMessage .= $e["message"] . ".<br />";
             }
         }
     } elseif ($_POST["action"] == "delegate" && $showType == 'Form' && $allowAdminAccess && !empty($_POST['delegate_to']) && $arTask["USER_ID"] != $_POST['delegate_to']) {
         $errors = array();
         CBPDocument::delegateTasks($arTask["USER_ID"], $_POST['delegate_to'], $arTask['ID'], $errors);
         if ($errors) {
             $errorMessage .= $errors[0] . '.';
示例#3
0
    return false;
}
$arResult['TASK']['PARAMETERS']['DOCUMENT_ID'] = $arState['DOCUMENT_ID'];
$arResult["TASK"]["MODULE_ID"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][0];
$arResult["TASK"]["ENTITY"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][1];
$arResult["TASK"]["DOCUMENT_ID"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][2];
$arParams["DOCUMENT_URL"] = trim($arParams["DOCUMENT_URL"]);
if (empty($arParams["DOCUMENT_URL"])) {
    $arParams["DOCUMENT_URL"] = CBPDocument::GetDocumentAdminPage($arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"]);
} else {
    $arParams["DOCUMENT_URL"] = CComponentEngine::MakePathFromTemplate($arParams["DOCUMENT_URL"], $arResult["TASK"]);
}
$arResult["TASK"]["URL"] = array("VIEW" => htmlspecialcharsbx($arParams["DOCUMENT_URL"]), "~VIEW" => $arParams["DOCUMENT_URL"]);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) {
    $arErrorsTmp = array();
    if (CBPDocument::PostTaskForm($arResult["TASK"], $arParams['USER_ID'], $_REQUEST + $_FILES, $arErrorsTmp, $USER->GetFormattedName(false))) {
        $arResult["ShowMode"] = "Success";
        $d = CBPTaskService::GetList(array(), array('WORKFLOW_ID' => $arResult['TASK']['WORKFLOW_ID'], 'USER_ID' => $arParams['USER_ID'], 'USER_STATUS' => CBPTaskUserStatus::Waiting), false, false, array("ID"));
        if ($r = $d->Fetch()) {
            $backUrl = CComponentEngine::MakePathFromTemplate($arParams["TASK_EDIT_URL"], array("ID" => $r["ID"], "task_id" => $r["ID"]));
        } else {
            $backUrl = $arResult["backUrl"];
        }
        if (strlen($backUrl) > 0) {
            LocalRedirect($backUrl);
            die;
        }
    } else {
        $arError = array();
        foreach ($arErrorsTmp as $e) {
            $arError[] = array("id" => "bad_task", "text" => $e["message"]);
示例#4
0
}
$arState = CBPStateService::GetWorkflowState($arResult['TASK']['WORKFLOW_ID']);
$arResult['TASK']['PARAMETERS']['DOCUMENT_ID'] = $arState['DOCUMENT_ID'];
$arResult["TASK"]["MODULE_ID"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][0];
$arResult["TASK"]["ENTITY"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][1];
$arResult["TASK"]["DOCUMENT_ID"] = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][2];
$arParams["DOCUMENT_URL"] = trim($arParams["DOCUMENT_URL"]);
if (empty($arParams["DOCUMENT_URL"])) {
    $arParams["DOCUMENT_URL"] = CBPDocument::GetDocumentAdminPage($arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"]);
} else {
    $arParams["DOCUMENT_URL"] = CComponentEngine::MakePathFromTemplate($arParams["DOCUMENT_URL"], $arResult["TASK"]);
}
$arResult["TASK"]["URL"] = array("VIEW" => htmlspecialcharsbx($arParams["DOCUMENT_URL"]), "~VIEW" => $arParams["DOCUMENT_URL"]);
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) {
    $arErrorsTmp = array();
    if (CBPDocument::PostTaskForm($arResult["TASK"], $GLOBALS["USER"]->GetID(), $_REQUEST + $_FILES, $arErrorsTmp, $GLOBALS["USER"]->GetFormattedName(false))) {
        $arResult["ShowMode"] = "Success";
        $d = CBPTaskService::GetList(array(), array('WORKFLOW_ID' => $arResult['TASK']['WORKFLOW_ID'], 'USER_ID' => $arParams['USER_ID'], 'USER_STATUS' => CBPTaskUserStatus::Waiting), false, false, array("ID"));
        if ($r = $d->Fetch()) {
            $backUrl = CComponentEngine::MakePathFromTemplate($arParams["TASK_EDIT_URL"], array("ID" => $r["ID"], "task_id" => $r["ID"]));
        } else {
            $backUrl = $arResult["backUrl"];
        }
        if (strlen($backUrl) > 0) {
            LocalRedirect($backUrl);
            die;
        }
    } else {
        $arError = array();
        foreach ($arErrorsTmp as $e) {
            $arError[] = array("id" => "bad_task", "text" => $e["message"]);
示例#5
0
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arResult["Block"] = null;
    $db = CIBlock::GetList(array(), array("ID" => $arParams["BLOCK_ID"], "TYPE" => $arParams["IBLOCK_TYPE"], "ACTIVE" => "Y"));
    if ($ar = $db->GetNext()) {
        $arResult["Block"] = $ar;
    } else {
        $arResult["FatalErrorMessage"] .= GetMessage("BPWC_WTC_WRONG_IBLOCK") . ". ";
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arResult["ShowType"] = "Form";
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) {
        $arErrorsTmp = array();
        if (CBPDocument::PostTaskForm($arResult["Task"], $USER->GetID(), $_REQUEST + $_FILES, $arErrorsTmp, $USER->GetFormattedName(false))) {
            $arResult["ShowType"] = "Success";
            $d = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $arResult["Task"]['WORKFLOW_ID'], "USER_ID" => (int) $GLOBALS["USER"]->GetID(), 'STATUS' => CBPTaskStatus::Running), false, false, array("ID"));
            if ($r = $d->Fetch()) {
                $backUrl = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASK"], array("task_id" => $r["ID"], "block_id" => $arParams["BLOCK_ID"]));
            } else {
                $backUrl = $arResult["BackUrl"];
            }
            if (strlen($backUrl) > 0) {
                LocalRedirect($backUrl);
                die;
            }
        } else {
            foreach ($arErrorsTmp as $e) {
                $arResult["ErrorMessage"] .= $e["message"] . ".<br />";
            }
示例#6
0
    $taskId = (int) $_REQUEST['TASK_ID'];
    $task = false;
    if ($taskId > 0) {
        $dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $user->getId(), 'USER_STATUS' => CBPTaskUserStatus::Waiting), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
        $task = $dbTask->fetch();
    }
    if (!$task) {
        $result['SUCCESS'] = false;
        $result['ERROR'] = 'Task not found.';
    } else {
        $task["PARAMETERS"]["DOCUMENT_ID"] = CBPStateService::GetStateDocumentId($task['WORKFLOW_ID']);
        $task["MODULE_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][0];
        $task["ENTITY"] = $task["PARAMETERS"]["DOCUMENT_ID"][1];
        $task["DOCUMENT_ID"] = $task["PARAMETERS"]["DOCUMENT_ID"][2];
        $arErrorsTmp = array();
        if (SITE_CHARSET != "utf-8" && !empty($_SERVER['HTTP_BX_AJAX'])) {
            CUtil::decodeURIComponent($_REQUEST);
            CUtil::decodeURIComponent($_FILES);
        }
        $formData = $_REQUEST + $_FILES;
        if (!CBPDocument::PostTaskForm($task, $user->getId(), $formData, $arErrorsTmp)) {
            $arError = array();
            foreach ($arErrorsTmp as $e) {
                $arError[] = array("id" => "bad_task", "text" => $e["message"]);
            }
            $e = new CAdminException($arError);
            $result['ERROR'] = HTMLToTxt($e->GetString());
        }
    }
}
echo CUtil::PhpToJSObject($result);
示例#7
0
     $dbTask = CBPTaskService::GetList(array(), array("ID" => $arParams["TASK_ID"], "USER_ID" => $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
     $arTask = $dbTask->GetNext();
 }
 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());
     }
 }