Beispiel #1
0
if ($allowAdminAccess && !empty($_REQUEST['action']) && check_bitrix_sessid()) {
    $ids = isset($_REQUEST['ID']) && is_array($_REQUEST['ID']) ? $_REQUEST['ID'] : array();
    if ($ids) {
        $errors = array();
        $action = $_REQUEST['action'];
        $status = 0;
        if (strpos($action, 'set_status_') === 0) {
            $status = substr($action, strlen('set_status_'));
            $action = 'set_status';
        }
        foreach ($ids as $id) {
            list($taskId, $userId) = explode('_', $id);
            if ($action == 'set_status' && $status > 0) {
                CBPDocument::setTasksUserStatus($userId, $status, $taskId, $errors);
            } elseif ($action == 'delegate' && !empty($_REQUEST['delegate_to'])) {
                CBPDocument::delegateTasks($userId, $_REQUEST['delegate_to'], $taskId, $errors);
            }
        }
        if ($errors) {
            foreach ($errors as $error) {
                $actionErrorMessage .= $error . PHP_EOL;
            }
        }
        unset($ids, $errors, $action, $status, $taskId, $userId);
    }
}
if ($actionErrorMessage) {
    $lAdmin->BeginPrologContent();
    CAdminMessage::ShowMessage($actionErrorMessage);
    $lAdmin->EndPrologContent();
}
Beispiel #2
0
 $arResult["SORT"] = $gridSort["sort"];
 $arResult["RECORDS"] = array();
 if (!empty($_REQUEST['action_button_' . $arResult["GRID_ID"]]) && check_bitrix_sessid()) {
     $action = $_REQUEST['action_button_' . $arResult["GRID_ID"]];
     $ids = isset($_REQUEST['ID']) && is_array($_REQUEST['ID']) ? $_REQUEST['ID'] : null;
     if (isset($_REQUEST['action_all_rows_' . $arResult["GRID_ID"]]) && $_REQUEST['action_all_rows_' . $arResult["GRID_ID"]] == 'Y') {
         $ids = array();
     }
     if (is_array($ids)) {
         if (strpos($action, 'set_status_') === 0) {
             $status = substr($action, strlen('set_status_'));
             CBPDocument::setTasksUserStatus($targetUserId, $status, $ids, $arResult['ERRORS']);
         }
         if ($action == 'delegate_to' && !empty($_REQUEST['ACTION_DELEGATE_TO_ID'])) {
             if ($isAdmin || CBPHelper::checkUserSubordination($currentUserId, $_REQUEST['ACTION_DELEGATE_TO_ID'])) {
                 CBPDocument::delegateTasks($targetUserId, $_REQUEST['ACTION_DELEGATE_TO_ID'], $ids, $arResult['ERRORS']);
             } else {
                 $arResult['ERRORS'][] = GetMessage('BPATL_ERROR_DELEGATE');
             }
         }
     }
 }
 $dbRecordsList = CBPTaskService::GetList($gridSort["sort"], $arFilter, false, $gridOptions->GetNavParams(), $arSelectFields);
 $arResult['IS_MY_TASKS'] = $currentUserId == $targetUserId;
 $arResult['TARGET_USER_ID'] = (int) $targetUserId;
 $useComments = (bool) CModule::IncludeModule("forum");
 $workflows = array();
 while ($arRecord = $dbRecordsList->getNext()) {
     if ($useComments) {
         $workflows[] = 'WF_' . $arRecord['WORKFLOW_ID'];
     }
Beispiel #3
0
     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] . '.';
         } else {
             LocalRedirect($backUrl);
         }
     }
 }
 require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
 $aMenu = array(array("TEXT" => GetMessage("BPAT_BACK"), "LINK" => $backUrl, "ICON" => "btn_list"));
 if ($showType == 'Form' && $allowAdminAccess) {
     $aMenu[] = array("TEXT" => GetMessage('BPAT_ACTION_DELEGATE'), 'ONCLICK' => 'bizprocShowDelegateDialog();');
 }
 $context = new CAdminContextMenu($aMenu);
 $context->Show();
 $APPLICATION->SetTitle(str_replace("#ID#", $taskId, GetMessage("BPAT_TITLE")));
Beispiel #4
0
global $APPLICATION, $USER;
$SITE_ID = '';
if (isset($_REQUEST["SITE_ID"]) && is_string($_REQUEST["SITE_ID"])) {
    $SITE_ID = substr(preg_replace("/[^a-z0-9_]/i", "", $_REQUEST["SITE_ID"]), 0, 2);
}
if ($SITE_ID != '') {
    define("SITE_ID", $SITE_ID);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
\Bitrix\Main\Localization\Loc::loadLanguageFile(__FILE__);
if (!check_bitrix_sessid() || !$USER->IsAuthorized()) {
    die;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'delegate') {
    CModule::IncludeModule('bizproc');
    $isAdmin = $USER->IsAdmin() || CModule::IncludeModule('bitrix24') && CBitrix24::IsPortalAdmin($USER->GetID());
    $errors = array();
    if (!empty($_REQUEST['task_id']) && !empty($_REQUEST['from_user_id']) && !empty($_REQUEST['to_user_id']) && ($isAdmin || CBPHelper::checkUserSubordination($USER->GetID(), $_REQUEST['to_user_id']))) {
        if (!CBPDocument::delegateTasks($_REQUEST['from_user_id'], $_REQUEST['to_user_id'], $_REQUEST['task_id'], $errors)) {
            $errors[] = GetMessage('BPAT_DELEGATE_NOTASKS');
        }
    } else {
        $errors[] = GetMessage('BPAT_DELEGATE_ERROR');
    }
    $message = $errors ? $errors[0] : GetMessage('BPAT_DELEGATE_SUCCESS');
    echo CUtil::PhpToJSObject(array('message' => $message, 'success' => empty($errors)));
} else {
    $APPLICATION->ShowAjaxHead();
    $APPLICATION->IncludeComponent('bitrix:intranet.user.selector.new', '.default', array('MULTIPLE' => 'N', 'NAME' => 'bp_task_delegate', 'SHOW_EXTRANET_USERS' => 'NONE', 'NAME_TEMPLATE' => COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), 'ON_SELECT' => 'BX.Bizproc.delegationOnSelect', 'SITE_ID' => SITE_ID), null, array('HIDE_ICONS' => 'Y'));
}
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';