7 public function Write($workflowId,
$type, $actionName, $executionStatus, $executionResult, $actionTitle =
"", $actionNote =
"", $modifiedBy = 0)
14 $workflowId = trim($workflowId);
15 if (strlen($workflowId) <= 0)
16 throw new Exception(
"workflowId");
18 $actionName = trim($actionName);
19 if (strlen($actionName) <= 0)
20 throw new Exception(
"actionName");
23 $executionStatus = intval($executionStatus);
24 $executionResult = intval($executionResult);
25 $actionNote = trim($actionNote);
27 $modifiedBy = intval($modifiedBy);
30 "INSERT INTO b_bp_tracking(WORKFLOW_ID, TYPE, MODIFIED, ACTION_NAME, ACTION_TITLE, EXECUTION_STATUS, EXECUTION_RESULT, ACTION_NOTE, MODIFIED_BY) ".
31 "VALUES('".
$DB->ForSql($workflowId, 32).
"', ".intval(
$type).
", ".
$DB->CurrentTimeFunction().
", '".
$DB->ForSql($actionName, 128).
"', '".
$DB->ForSql($actionTitle, 255).
"', ".intval($executionStatus).
", ".intval($executionResult).
", ".(strlen($actionNote) > 0 ?
"'".
$DB->ForSql($actionNote).
"'" :
"NULL").
", ".($modifiedBy > 0 ? $modifiedBy :
"NULL").
")"
39 if (
count($arSelectFields) <= 0)
40 $arSelectFields =
array(
"ID",
"WORKFLOW_ID",
"TYPE",
"MODIFIED",
"ACTION_NAME",
"ACTION_TITLE",
"EXECUTION_STATUS",
"EXECUTION_RESULT",
"ACTION_NOTE",
"MODIFIED_BY");
43 "ID" => Array(
"FIELD" =>
"T.ID",
"TYPE" =>
"int"),
44 "WORKFLOW_ID" => Array(
"FIELD" =>
"T.WORKFLOW_ID",
"TYPE" =>
"string"),
45 "TYPE" => Array(
"FIELD" =>
"T.TYPE",
"TYPE" =>
"int"),
46 "ACTION_NAME" => Array(
"FIELD" =>
"T.ACTION_NAME",
"TYPE" =>
"string"),
47 "ACTION_TITLE" => Array(
"FIELD" =>
"T.ACTION_TITLE",
"TYPE" =>
"string"),
48 "MODIFIED" => Array(
"FIELD" =>
"T.MODIFIED",
"TYPE" =>
"datetime"),
49 "EXECUTION_STATUS" => Array(
"FIELD" =>
"T.EXECUTION_STATUS",
"TYPE" =>
"int"),
50 "EXECUTION_RESULT" => Array(
"FIELD" =>
"T.EXECUTION_RESULT",
"TYPE" =>
"int"),
51 "ACTION_NOTE" => Array(
"FIELD" =>
"T.ACTION_NOTE",
"TYPE" =>
"string"),
52 "MODIFIED_BY" => Array(
"FIELD" =>
"T.MODIFIED_BY",
"TYPE" =>
"int"),
55 $arSqls = CBPHelper::PrepareSql(
$arFields, $arOrder,
$arFilter, $arGroupBy, $arSelectFields);
57 $arSqls[
"SELECT"] = str_replace(
"%%_DISTINCT_%%",
"", $arSqls[
"SELECT"]);
59 if (is_array($arGroupBy) &&
count($arGroupBy)==0)
62 "SELECT ".$arSqls[
"SELECT"].
" ".
63 "FROM b_bp_tracking T ".
64 " ".$arSqls[
"FROM"].
" ";
65 if (strlen($arSqls[
"WHERE"]) > 0)
66 $strSql .=
"WHERE ".$arSqls[
"WHERE"].
" ";
67 if (strlen($arSqls[
"GROUPBY"]) > 0)
68 $strSql .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
70 $dbRes =
$DB->Query($strSql,
false,
"File: ".__FILE__.
"<br>Line: ".__LINE__);
78 "SELECT ".$arSqls[
"SELECT"].
" ".
79 "FROM b_bp_tracking T ".
80 " ".$arSqls[
"FROM"].
" ";
81 if (strlen($arSqls[
"WHERE"]) > 0)
82 $strSql .=
"WHERE ".$arSqls[
"WHERE"].
" ";
83 if (strlen($arSqls[
"GROUPBY"]) > 0)
84 $strSql .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
85 if (strlen($arSqls[
"ORDERBY"]) > 0)
86 $strSql .=
"ORDER BY ".$arSqls[
"ORDERBY"].
" ";
88 if (is_array($arNavStartParams) && IntVal($arNavStartParams[
"nTopCount"]) <= 0)
91 "SELECT COUNT('x') as CNT ".
92 "FROM b_bp_tracking T ".
93 " ".$arSqls[
"FROM"].
" ";
94 if (strlen($arSqls[
"WHERE"]) > 0)
95 $strSql_tmp .=
"WHERE ".$arSqls[
"WHERE"].
" ";
96 if (strlen($arSqls[
"GROUPBY"]) > 0)
97 $strSql_tmp .=
"GROUP BY ".$arSqls[
"GROUPBY"].
" ";
99 $dbRes =
$DB->Query($strSql_tmp,
false,
"File: ".__FILE__.
"<br>Line: ".__LINE__);
101 if (strlen($arSqls[
"GROUPBY"]) <= 0)
109 $cnt =
$dbRes->SelectedRowsCount();
113 $dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
117 if (is_array($arNavStartParams) && IntVal($arNavStartParams[
"nTopCount"]) > 0)
118 $strSql .=
"LIMIT ".intval($arNavStartParams[
"nTopCount"]);
120 $dbRes =
$DB->Query($strSql,
false,
"File: ".__FILE__.
"<br>Line: ".__LINE__);
Write($workflowId, $type, $actionName, $executionStatus, $executionResult, $actionTitle="", $actionNote="", $modifiedBy=0)