예제 #1
0
 public static function getWorkflowTasks($workflowId, $withUsers = false, $extendUserInfo = false)
 {
     $withUsers = $withUsers ? 1 : 0;
     $extendUserInfo = $extendUserInfo ? 1 : 0;
     if (!isset(self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo])) {
         $tasks = array('COMPLETED' => array(), 'RUNNING' => array());
         $ids = array();
         $taskIterator = CBPTaskService::GetList(array('MODIFIED' => 'DESC'), array('WORKFLOW_ID' => $workflowId), false, false, array('ID', 'MODIFIED', 'NAME', 'DESCRIPTION', 'PARAMETERS', 'STATUS', 'IS_INLINE', 'ACTIVITY'));
         while ($task = $taskIterator->getNext()) {
             $key = $task['STATUS'] == CBPTaskStatus::Running ? 'RUNNING' : 'COMPLETED';
             $tasks[$key][] = $task;
             $ids[] = $task['ID'];
         }
         if ($withUsers && sizeof($ids)) {
             $taskUsers = \CBPTaskService::getTaskUsers($ids);
             self::joinUsersToTasks($tasks['COMPLETED'], $taskUsers, $extendUserInfo);
             $tasks['RUNNING_ALL_USERS'] = self::joinUsersToTasks($tasks['RUNNING'], $taskUsers, $extendUserInfo);
         }
         $tasks['COMPLETED_CNT'] = sizeof($tasks['COMPLETED']);
         $tasks['RUNNING_CNT'] = sizeof($tasks['RUNNING']);
         self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo] = $tasks;
     }
     return self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo];
 }
예제 #2
0
$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"]);
        }
        $e = new CAdminException($arError);
예제 #3
0
    $arFilter["<=MODIFIED"] = $filter_modified_2;
}
if (strlen($filter_name) > 0) {
    $arFilter["~NAME"] = "%" . $filter_name . "%";
}
$arAddHeaders = array(array("id" => "ID", "content" => "ID", "sort" => "ID", "default" => true), array("id" => "NAME", "content" => GetMessage("BPATL_NAME"), "sort" => "NAME", "default" => true), array("id" => "DESCRIPTION", "content" => GetMessage("BPATL_DESCR"), "default" => true), array("id" => "DESCRIPTION_FULL", "content" => GetMessage("BPATL_DESCR_FULL"), "default" => false), array("id" => "MODIFIED", "content" => GetMessage("BPATL_MODIFIED"), "sort" => "MODIFIED", "default" => true), array("id" => "WORKFLOW_NAME", "content" => GetMessage("BPATL_WORKFLOW_NAME"), "default" => true, "sort" => ""), array("id" => "WORKFLOW_STATE", "content" => GetMessage("BPATL_WORKFLOW_STATE"), "default" => true, "sort" => ""));
if ($allowAdminAccess) {
    $arAddHeaders[] = array("id" => "USER", "content" => GetMessage("BPATL_USER"), "default" => true, "sort" => "");
}
$lAdmin->AddHeaders($arAddHeaders);
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
$arSelectFields = array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS");
if (in_array("USER", $arVisibleColumns) && $allowAdminAccess) {
    $arSelectFields[] = "USER_ID";
}
$dbResultList = CBPTaskService::GetList(array($by => $order), $arFilter, false, false, $arSelectFields);
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("BPATL_NAV")));
while ($arResultItem = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arResultItem);
    $s = $allowAdminAccess ? "&uid=" . intval($arResultItem["USER_ID"]) : "";
    $row->AddField("ID", '<a href="bizproc_task.php?id=' . $f_ID . $s . '&back_url=' . urlencode($APPLICATION->GetCurPageParam("lang=" . LANGUAGE_ID, array("lang"))) . '" title="' . GetMessage("BPATL_VIEW") . '">' . $f_ID . '</a>');
    $row->AddField("NAME", $f_NAME);
    $description = $f_DESCRIPTION;
    if (strlen($description) > 100) {
        $description = substr($description, 0, 97) . "...";
    }
    $row->AddField("DESCRIPTION", $description);
    $row->AddField("DESCRIPTION_FULL", $f_DESCRIPTION);
    $row->AddField("MODIFIED", $f_MODIFIED);
예제 #4
0
파일: component.php 프로젝트: vim84/b-markt
     } else {
         $op = "";
         $newKey = $key;
     }
     if (!in_array($newKey, array("NAME", "MODIFIED", "OVERDUE_DATE", "WORKFLOW_TEMPLATE_ID", "DESCRIPTION"))) {
         continue;
     }
     if (in_array($newKey, array("NAME", "DESCRIPTION")) && $op == "") {
         $op = "~";
         $value = "%" . $value . "%";
     }
     $arFilter[$op . $newKey] = $value;
 }
 $arResult["SORT"] = $gridSort["sort"];
 $arResult["RECORDS"] = array();
 $dbRecordsList = CBPTaskService::GetList($gridSort["sort"], $arFilter, false, $gridOptions->GetNavParams(), $arSelectFields);
 while ($arRecord = $dbRecordsList->GetNext()) {
     $arRecord['MODIFIED'] = FormatDateFromDB($arRecord['MODIFIED']);
     $arRecord["DOCUMENT_URL"] = CBPDocument::GetDocumentAdminPage($arRecord["PARAMETERS"]["DOCUMENT_ID"]);
     $arRecord["MODULE_ID"] = $arRecord["PARAMETERS"]["DOCUMENT_ID"][0];
     $arRecord["ENTITY"] = $arRecord["PARAMETERS"]["DOCUMENT_ID"][1];
     $arRecord["DOCUMENT_ID"] = $arRecord["PARAMETERS"]["DOCUMENT_ID"][2];
     $arRecord["URL"] = array("~TASK" => CComponentEngine::MakePathFromTemplate($arParams["~TASK_EDIT_URL"], $arRecord), "TASK" => CComponentEngine::MakePathFromTemplate($arParams["TASK_EDIT_URL"], $arRecord));
     if (array_key_exists("DESCRIPTION", $arRecord)) {
         $arRecord["DESCRIPTION"] = nl2br($arRecord["DESCRIPTION"]);
     }
     if (count(array_intersect($arSelectFields, array("WORKFLOW_NAME", "WORKFLOW_STATE", "WORKFLOW_STARTED", "WORKFLOW_STARTED_BY"))) > 0) {
         $arState = CBPStateService::GetWorkflowState($arRecord["WORKFLOW_ID"]);
         $arRecord["WORKFLOW_NAME"] = $arState["TEMPLATE_NAME"];
         $arRecord["WORKFLOW_STATE"] = $arState["STATE_TITLE"];
         $arRecord["WORKFLOW_STARTED"] = FormatDateFromDB($arState["STARTED_FORMATTED"]);
예제 #5
0
 protected static function onTaskChange($taskId, $taskData, $status)
 {
     $workflowId = isset($taskData['WORKFLOW_ID']) ? $taskData['WORKFLOW_ID'] : null;
     if (!$workflowId) {
         $iterator = CBPTaskService::GetList(array('ID' => 'DESC'), array('ID' => $taskId), false, false, array('WORKFLOW_ID'));
         $row = $iterator->fetch();
         if (!$row) {
             return false;
         }
         $workflowId = $row['WORKFLOW_ID'];
         $taskData['WORKFLOW_ID'] = $workflowId;
     }
     //clean counters cache
     $users = array();
     if (!empty($taskData['USERS'])) {
         $users = $taskData['USERS'];
     }
     if (!empty($taskData['USERS_REMOVED'])) {
         $users = array_merge($users, $taskData['USERS_REMOVED']);
     }
     if (!empty($taskData['USERS_STATUSES'])) {
         $users = array_merge($users, array_keys($taskData['USERS_STATUSES']));
     }
     self::cleanCountersCache($users);
     //ping document
     $runtime = CBPRuntime::GetRuntime();
     $runtime->StartRuntime();
     $documentId = CBPStateService::GetStateDocumentId($workflowId);
     $documentService = $runtime->GetService('DocumentService');
     try {
         $documentService->onTaskChange($documentId, $taskId, $taskData, $status);
     } catch (Exception $e) {
     }
     return true;
 }
예제 #6
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 />";
            }
        }
    }
예제 #7
0
         }
     }
     $CACHE_MANAGER->RegisterTag("USER_CARD_" . intval($arUser['ID'] / TAGGED_user_card_size));
     $CACHE_MANAGER->EndTagCache();
     if ($obUserCache->StartDataCache()) {
         $obUserCache->EndDataCache(array('USER_NAME_FORMATTED' => $arResult['USER_NAME_FORMATTED'], 'USER_PERSONAL_PHOTO_SRC' => $arResult['USER_PERSONAL_PHOTO_SRC']));
     }
 }
 $arResult["SHOW_BIZPROC"] = false;
 if (CModule::IncludeModule("bizproc") && IsModuleInstalled("socialnetwork")) {
     $arResult["SHOW_BIZPROC"] = true;
     $arFilter = array("USER_ID" => $GLOBALS["USER"]->GetID());
     if (class_exists('CBPTaskUserStatus')) {
         $arFilter['USER_STATUS'] = CBPTaskUserStatus::Waiting;
     }
     $dbResultList = CBPTaskService::GetList(array(), $arFilter, array("USER_ID"), false, array("COUNT" => "ID"));
     $arResult["BZP_CNT"] = 0;
     if ($arResultList = $dbResultList->Fetch()) {
         $arResult["BZP_CNT"] = intval($arResultList["CNT"]);
     }
 }
 // live updates counter
 $arCounters = CUserCounter::GetValues($GLOBALS["USER"]->GetID(), SITE_ID);
 $arResult["LOG_ITEMS_TOTAL"] = isset($arCounters["**"]) ? intval($arCounters["**"]) : 0;
 // external mailbox messages counter
 $arResult["urlToExternalMailbox"] = "";
 $arResult["EXTERNAL_MAIL_CNT"] = 0;
 // exchange messages counter
 $arResult["urlToExchangeBox"] = "";
 $arResult["EXCHANGE_CNT"] = 0;
 if (CModule::IncludeModule("intranet") && CIntranetUtils::IsExternalMailAvailable()) {
예제 #8
0
			</select>
		</td>
	</tr>
	<tr>
		<td><?php 
echo GetMessage("BPATL_WORKFLOW_NAME");
?>
:</td>
		<td>
			<select name="filter_workflow_template_id">
				<option value=""><?php 
echo GetMessage("BPATL_FILTER_STATUS_ALL");
?>
</option>
				<?php 
$dbResTmp = CBPTaskService::GetList(array("WORKFLOW_TEMPLATE_NAME" => "ASC"), array(), array("WORKFLOW_TEMPLATE_TEMPLATE_ID", "WORKFLOW_TEMPLATE_NAME"), false, array("WORKFLOW_TEMPLATE_TEMPLATE_ID", "WORKFLOW_TEMPLATE_NAME"));
while ($arResTmp = $dbResTmp->GetNext()) {
    ?>
					<option value="<?php 
    echo $arResTmp["WORKFLOW_TEMPLATE_TEMPLATE_ID"];
    ?>
"><?php 
    echo $arResTmp["WORKFLOW_TEMPLATE_NAME"];
    ?>
</option>
				<?php 
}
?>
			</select>
		</td>
	</tr>
예제 #9
0
	/**
	* Метод возвращает массив заданий для данного пользователя в данном рабочем потоке.
	* Возвращаемый массив имеет вид:
	*	array(
	*		array(
	*			"ID" => код_задания,
	*			"NAME" => название_задания,
	*			"DESCRIPTION" => описание_задания,
	*		),
	*		. . .
	*	)
	*
	* @param int $userId - код пользователя.
	* @param string $workflowId - код рабочего потока.
	* @return array - массив заданий.
	*/
	public static function GetUserTasksForWorkflow($userId, $workflowId)
	{
		$userId = intval($userId);
		if ($userId <= 0)
			return array();

		$workflowId = trim($workflowId);
		if (strlen($workflowId) <= 0)
			return array();

		$arResult = array();

		$dbTask = CBPTaskService::GetList(
			array(),
			array("WORKFLOW_ID" => $workflowId, "USER_ID" => $userId),
			false,
			false,
			array("ID", "WORKFLOW_ID", "NAME", "DESCRIPTION")
		);
		while ($arTask = $dbTask->GetNext())
			$arResult[] = $arTask;

		return $arResult;
	}
예제 #10
0
             }
         }
     }
 }
 if ($bCanStartWorkflow) {
     $documentId = CBPVirtualDocument::CreateDocument(0, array("IBLOCK_ID" => $arParams["BLOCK_ID"], "NAME" => GetMessage("BPWC_WRC_Z"), "CREATED_BY" => "user_" . $GLOBALS["USER"]->GetID()));
     $arErrorsTmp = array();
     $wfId = CBPDocument::StartWorkflow($workflowTemplateId, array("bizproc", "CBPVirtualDocument", $documentId), array_merge($arWorkflowParameters, array("TargetUser" => "user_" . intval($GLOBALS["USER"]->GetID()))), $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $arResult["ShowMode"] = "StartWorkflowError";
         foreach ($arErrorsTmp as $e) {
             $arResult["ErrorMessage"] .= "[" . $e["code"] . "] " . $e["message"] . "<br />";
         }
     } else {
         $arResult["ShowMode"] = "StartWorkflowSuccess";
         $d = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $wfId, "USER_ID" => intval($GLOBALS["USER"]->GetID())), 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"];
         }
         LocalRedirect($backUrl);
         die;
     }
 } else {
     $p = $_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["DoStartParamWorkflow"]) > 0;
     $keys = array_keys($arResult["TEMPLATE"]["PARAMETERS"]);
     foreach ($keys as $key) {
         $v = $p ? $_REQUEST[$key] : $arResult["TEMPLATE"]["PARAMETERS"][$key]["Default"];
         if (!is_array($v)) {
             $arResult["ParametersValues"][$key] = CBPHelper::ConvertParameterValues($v);
예제 #11
0
}
$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"]), 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"]);
        }
        $e = new CAdminException($arError);
예제 #12
0
if (!$GLOBALS["USER"]->IsAuthorized() || !check_bitrix_sessid() || !CModule::IncludeModule("bizproc")) {
    die;
}
$taskId = isset($_REQUEST['TASK_ID']) ? (int) $_REQUEST['TASK_ID'] : 0;
$userId = isset($_REQUEST['USER_ID']) ? (int) $_REQUEST['USER_ID'] : 0;
if (!$userId) {
    $userId = $GLOBALS['USER']->getId();
}
if ($userId != $GLOBALS["USER"]->getId()) {
    if (!CBPHelper::checkUserSubordination($GLOBALS["USER"]->GetID(), $userId)) {
        die;
    }
}
$task = null;
if ($taskId > 0) {
    $dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID"));
    $task = $dbTask->fetch();
}
if (!$task) {
    die;
}
$APPLICATION->RestartBuffer();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
echo LANGUAGE_ID;
?>
" lang="<?php 
echo LANGUAGE_ID;
?>
">
예제 #13
0
<?php

define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$arJsonData = array();
if (!CModule::IncludeModule("bizproc")) {
    $arJsonData["error"] = "Module is not installed";
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["action"] == "doTask" && check_bitrix_sessid()) {
    if ($_POST["TASK_ID"] > 0) {
        $dbTask = CBPTaskService::GetList(array(), array("ID" => $_POST["TASK_ID"], "USER_ID" => $GLOBALS["USER"]->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS", 'USER_STATUS'));
        $curTask = $dbTask->GetNext();
        if ($curTask) {
            if (isset($curTask['USER_STATUS']) && class_exists('CBPTaskUserStatus') && $curTask['USER_STATUS'] > CBPTaskUserStatus::Waiting) {
                $arJsonData["success"] = "Y";
            } else {
                $arErrorsTmp = array();
                if (CBPDocument::PostTaskForm($curTask, $GLOBALS["USER"]->GetID(), $_REQUEST + $_FILES, $arErrorsTmp, $GLOBALS["USER"]->GetFormattedName(false))) {
                    $arJsonData["success"] = "Y";
                } else {
                    $arError = array();
                    foreach ($arErrorsTmp as $e) {
                        $arError[] = $e["message"];
                    }
                    $arJsonData["error"] = implode("", $arError);
                }
            }
        } else {
            $arJsonData["error"] = "Task not found.";
        }
    } else {
예제 #14
0
if ($allowAdminAccess) {
    if ($userId <= 0) {
        $userId = $USER->GetID();
    }
} else {
    $userId = $USER->GetID();
}
$arTask = false;
if ($taskId > 0) {
    $dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $allowAdminAccess ? $userId : $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS", "USER_ID"));
    $arTask = $dbTask->GetNext();
}
if (!$arTask) {
    $workflowId = trim($_REQUEST["workflow_id"]);
    if (strlen($workflowId) > 0) {
        $dbTask = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $workflowId, "USER_ID" => $allowAdminAccess ? $userId : $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS", "USER_ID"));
        $arTask = $dbTask->GetNext();
    }
}
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"]);
    }
예제 #15
0
define("STOP_STATISTICS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
$result = array('SUCCESS' => true);
$user = $GLOBALS["USER"];
if (!CModule::IncludeModule("bizproc") || !CModule::IncludeModule("iblock")) {
    $result['SUCCESS'] = false;
}
if ($_SERVER["REQUEST_METHOD"] != "POST" || !$user->IsAuthorized() || !check_bitrix_sessid()) {
    $result['SUCCESS'] = false;
    $result['ERROR'] = 'Access denied.';
}
if ($result['SUCCESS']) {
    $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);
        }
예제 #16
0
파일: task.php 프로젝트: Satariall/izurit
$errorMessage = "";
$allowAdminAccess = $USER->IsAdmin();
$taskId = intval($_REQUEST["id"]);
$userId = intval($_REQUEST["uid"]);
if (!$allowAdminAccess || $userId <= 0) {
    $userId = $USER->GetID();
}
$arTask = false;
if ($taskId > 0) {
    $dbTask = CBPTaskService::GetList(array(), array("ID" => $taskId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS", "USER_ID", 'STATUS', 'USER_STATUS'));
    $arTask = $dbTask->GetNext();
}
if (!$arTask) {
    $workflowId = trim($_REQUEST["workflow_id"]);
    if (strlen($workflowId) > 0) {
        $dbTask = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $workflowId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS", "USER_ID", 'STATUS', 'USER_STATUS'));
        $arTask = $dbTask->GetNext();
    }
}
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 {
    $arTask["PARAMETERS"]["DOCUMENT_ID"] = CBPStateService::GetStateDocumentId($arTask['WORKFLOW_ID']);
    $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"]);
예제 #17
0
 public static function GetUserWorkflowTaskCount($workflowIDs, $userID = 0)
 {
     if (!is_array($workflowIDs)) {
         return 0;
     }
     if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) {
         return 0;
     }
     $userID = intval($userID);
     if ($userID <= 0) {
         $userID = CCrmSecurityHelper::GetCurrentUserID();
     }
     $filter = array('USER_ID' => $userID);
     $workflowQty = count($workflowIDs);
     if ($workflowQty > 1) {
         //IMPORTANT: will produce SQL error due to CBPTaskService::GetList bug
         //$filter['@WORKFLOW_ID'] = $workflowIDs;
         $filter['WORKFLOW_ID'] = $workflowIDs[0];
     }
     /*elseif($workflowQty === 1)
     		{
     			$filter['WORKFLOW_ID'] = $workflowIDs[0];
     		}*/
     $result = CBPTaskService::GetList(array(), $filter, array(), false, array());
     return is_int($result) ? $result : 0;
 }
예제 #18
0
    $arParams["PAGE_VAR"] = "page";
}
$arParams["PATH_TO_BIZPROC_EDIT"] = trim($arParams["PATH_TO_BIZPROC_EDIT"]);
if (strlen($arParams["PATH_TO_BIZPROC_EDIT"]) <= 0) {
    $arParams["PATH_TO_BIZPROC_EDIT"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . $arParams["PAGE_VAR"] . "=bizproc_edit&" . $arParams["TASK_VAR"] . "=#task_id#");
}
if (!$GLOBALS["USER"]->IsAuthorized()) {
    $arResult["NEED_AUTH"] = "Y";
} else {
    if ($arParams["SET_TITLE"] == "Y") {
        $APPLICATION->SetTitle(GetMessage("SONET_BIZPROC_TITLE"));
    }
    if ($arParams["SET_NAV_CHAIN"] != "N") {
        $APPLICATION->AddChainItem(GetMessage("SONET_BIZPROC_TITLE"));
    }
    $dbResultList = CBPTaskService::GetList(array("MODIFIED" => "DESC"), array("USER_ID" => $USER->GetID()), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
    while ($arResultItem = $dbResultList->GetNext()) {
        if (strlen($arResultItem["DESCRIPTION"]) > 100) {
            $arResultItem["DESCRIPTION"] = substr($arResultItem["DESCRIPTION"], 0, 97) . "...";
        }
        $arResultItem["EditUrl"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BIZPROC_EDIT"], array("task_id" => $arResultItem["ID"]));
        $arResult["TASKS"][] = $arResultItem;
    }
    $dbTracking = CBPTrackingService::GetList(array("MODIFIED" => "DESC"), array("MODIFIED_BY" => $USER->GetID()));
    while ($arTracking = $dbTracking->GetNext()) {
        if (strlen($arTracking["WORKFLOW_ID"]) > 0) {
            $arTracking["STATE"] = CBPStateService::GetWorkflowState($arTracking["WORKFLOW_ID"]);
            $arTracking["STATE"]["Url"] = CBPDocument::GetDocumentAdminPage($arTracking["STATE"]["DOCUMENT_ID"]);
        }
        $arResult["TRACKING"][] = $arTracking;
    }
예제 #19
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$sTplDir = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/"));
$arParams["TASK_ID"] = intval($arResult["VARIABLES"]["ID"]);
$arParams["USER_ID"] = intval(empty($arParams["USER_ID"]) ? $GLOBALS["USER"]->GetID() : $arParams["USER_ID"]);
if ($arParams["TASK_ID"] > 0) {
    $dbTask = CBPTaskService::GetList(array(), array("ID" => $arParams["TASK_ID"], "USER_ID" => $arParams["USER_ID"]), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS"));
    $arResult["TASK"] = $dbTask->GetNext();
}
if ($arResult["TASK"]) {
    $docID = $arResult["TASK"]["PARAMETERS"]["DOCUMENT_ID"][2];
    $arResult["VARIABLES"]["ELEMENT_ID"] = $docID;
    $arResult["VARIABLES"]["ACTION"] = "EDIT";
    $arInfo = (include $sTplDir . "tab_edit.php");
    if ($arParams["WORKFLOW"] == "bizproc") {
        include $sTplDir . "tab_bizproc_history.php";
        include $sTplDir . "tab_bizproc_task.php";
        include $sTplDir . "tab_versions.php";
    } elseif ($arParams["WORKFLOW"] == "workflow") {
        include $sTplDir . "tab_workflow_history.php";
    } else {
        include $sTplDir . "tab_bizproc_history.php";
    }
    include $sTplDir . "tab_comments.php";
    if (!isset($_GET[$arParams["FORM_ID"] . '_active_tab'])) {
        $_REQUEST[$arParams["FORM_ID"] . '_active_tab'] = "tab_bizproc_view";
    }
    if (!$arParams["FORM_ID"]) {