示例#1
0
	private static function UsersArrayToStringInternal($arUsers, $arWorkflowTemplate, $arAllowableUserGroups)
	{
		if (is_array($arUsers))
		{
			$r = array();

			$keys = array_keys($arUsers);
			foreach ($keys as $key)
				$r[$key] = self::UsersArrayToStringInternal($arUsers[$key], $arWorkflowTemplate, $arAllowableUserGroups);

			if (count($r) == 2)
			{
				$keys = array_keys($r);
				if ($keys[0] == 0 && $keys[1] == 1 && is_string($r[0]) && is_string($r[1]))
				{
					if (in_array($r[0], array("Document", "Template", "Variable", "User"))
						|| preg_match("#^A\d+_\d+_\d+_\d+$#i", $r[0])
						|| is_array($arWorkflowTemplate) && CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $r[0]) != null
						)
					{
						return "{=".$r[0].":".$r[1]."}";
					}
				}
			}

			return implode(", ", $r);
		}
		else
		{
			if (array_key_exists(strtolower($arUsers), $arAllowableUserGroups))
				return $arAllowableUserGroups[strtolower($arUsers)];

			$userId = 0;
			if (substr($arUsers, 0, strlen("user_")) == "user_")
				$userId = intval(substr($arUsers, strlen("user_")));

			if ($userId > 0)
			{
				$db = CUser::GetList(
					($by = "LAST_NAME"),
					($order = "asc"),
					array("ID_EQUAL_EXACT" => $userId),
					array(
						"NAV_PARAMS" => false,
					)
				);

				if ($ar = $db->Fetch())
				{
					$str = CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $ar, true);
					$str = $str." [".$ar["ID"]."]";
					return str_replace(",", " ", $str);
				}
			}

			return str_replace(",", " ", $arUsers);
		}
	}
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array();
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#3
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("ExecuteCode" => $arCurrentValues["execute_code"]);
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#4
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $state = strlen($arCurrentValues["target_state_name_1"]) > 0 ? $arCurrentValues["target_state_name_1"] : $arCurrentValues["target_state_name"];
     $cancelCurrentState = isset($arCurrentValues['cancel_current_state']) && $arCurrentValues['cancel_current_state'] == 'Y' ? 'Y' : 'N';
     $arProperties = array('TargetStateName' => $state, 'CancelCurrentState' => $cancelCurrentState);
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("Permission" => array(), "Rewrite" => true);
     $documentService = $runtime->GetService("DocumentService");
     $arAllowableOperations = $documentService->GetAllowableOperations($documentType);
     foreach ($arAllowableOperations as $operationKey => $operationValue) {
         $arProperties["Permission"][$operationKey] = CBPHelper::UsersStringToArray($arCurrentValues["permission_" . $operationKey], $documentType, $arErrors);
         if (count($arErrors) > 0) {
             return false;
         }
     }
     $arProperties["Rewrite"] = $arCurrentValues["rewrite"] == "Y" ? "Y" : "N";
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array();
     if ($arCurrentValues["time_type_selector"] == "time") {
         if (strlen($arCurrentValues["delay_date"]) > 0 && ($d = MakeTimeStamp($arCurrentValues["delay_date"]))) {
             $arProperties["TimeoutTime"] = $d;
         } elseif (strlen($arCurrentValues["delay_date_x"]) > 0 && (preg_match('#^{=[A-Za-z0-9_]+:[A-Za-z0-9_]+}$#i', $arCurrentValues["delay_date_x"]) || substr($arCurrentValues["delay_date_x"], 0, 1) == "=")) {
             $arProperties["TimeoutTime"] = $arCurrentValues["delay_date_x"];
         }
     } else {
         $arProperties["TimeoutDuration"] = $arCurrentValues["delay_time"];
         $arProperties["TimeoutDurationType"] = $arCurrentValues["delay_type"];
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#7
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("review_users" => "Users", "approve_type" => "ApproveType", "review_overdue_date" => "OverdueDate", "review_name" => "Name", "review_description" => "Description", "review_parameters" => "Parameters", "status_message" => "StatusMessage", "set_status_message" => "SetStatusMessage", "task_button_message" => "TaskButtonMessage", "comment_label_message" => "CommentLabelMessage", "show_comment" => "ShowComment", "timeout_duration" => "TimeoutDuration", "timeout_duration_type" => "TimeoutDurationType", "access_control" => "AccessControl");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "review_users") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["review_users"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#8
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $arMap = array("group_name" => "GroupName", "owner_id" => "OwnerId", "users" => "Users");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "owner_id" || $key == "users") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["OwnerId"] = CBPHelper::UsersStringToArray($arCurrentValues["owner_id"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["users"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("FieldValue" => array());
     $documentService = $runtime->GetService("DocumentService");
     $arNewFieldsMap = array();
     if (array_key_exists("new_field_name", $arCurrentValues) && is_array($arCurrentValues["new_field_name"])) {
         $arNewFieldKeys = array_keys($arCurrentValues["new_field_name"]);
         foreach ($arNewFieldKeys as $k) {
             $code = trim($arCurrentValues["new_field_code"][$k]);
             //if (!array_key_exists($code, $arCurrentValues))
             //	continue;
             $arFieldsTmp = array("name" => $arCurrentValues["new_field_name"][$k], "code" => $code, "type" => $arCurrentValues["new_field_type"][$k], "multiple" => $arCurrentValues["new_field_mult"][$k], "required" => $arCurrentValues["new_field_req"][$k], "options" => $arCurrentValues["new_field_options"][$k]);
             $newCode = $documentService->AddDocumentField($documentType, $arFieldsTmp);
             $arNewFieldsMap[$newCode] = $code;
         }
     }
     $arDocumentFields = $documentService->GetDocumentFields($documentType);
     foreach ($arDocumentFields as $fieldKey => $fieldValue) {
         if (!$fieldValue["Editable"]) {
             continue;
         }
         $fieldKey1 = array_key_exists($fieldKey, $arNewFieldsMap) ? $arNewFieldsMap[$fieldKey] : $fieldKey;
         $arErrors = array();
         $r = $documentService->GetFieldInputValue($documentType, $fieldValue, $fieldKey1, $arCurrentValues, $arErrors);
         if (!is_null($r)) {
             $arProperties["FieldValue"][$fieldKey] = $r;
         }
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#10
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("sh_name" => "Name", "sh_user_id" => "UserId");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $arMap = array("owner_id" => "OwnerId", "users_to" => "UsersTo", "post_title" => "PostTitle", "post_message" => "PostMessage", 'post_message_type' => "PostMessageType", 'post_site' => "PostSite");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "owner_id" || $key == "users_to") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     if (strlen($arProperties["PostSite"]) <= 0) {
         $arProperties["PostSite"] = $arCurrentValues["post_site_x"];
     }
     $arProperties["OwnerId"] = CBPHelper::UsersStringToArray($arCurrentValues["owner_id"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["UsersTo"] = CBPHelper::UsersStringToArray($arCurrentValues["users_to"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#12
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $arProperties = array("Fields" => array());
     $arTaskPriority = array(0, 1, 2);
     foreach ($arTaskPriority as $k => $v) {
         $arTaskPriority[$v] = GetMessage("TASK_PRIORITY_" . $v);
     }
     $arGroups = array(GetMessage("TASK_EMPTY_GROUP"));
     if (CModule::IncludeModule("socialnetwork")) {
         $db = CSocNetGroup::GetList(array("NAME" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME"));
         while ($ar = $db->GetNext()) {
             $arGroups[$ar["ID"]] = "[" . $ar["ID"] . "]" . $ar["NAME"];
         }
     }
     $arDF = self::__GetFields();
     foreach (static::$arAllowedTasksFieldNames as $field) {
         $r = null;
         if (in_array($field, array("CREATED_BY", "RESPONSIBLE_ID", "ACCOMPLICES", "AUDITORS"))) {
             $value = $arCurrentValues[$field];
             if (strlen($value) > 0) {
                 $arErrorsTmp = array();
                 $r = CBPHelper::UsersStringToArray($value, $documentType, $arErrorsTmp);
                 if (count($arErrorsTmp) > 0) {
                     $arErrors = array_merge($arErrors, $arErrorsTmp);
                 }
             }
         } elseif (array_key_exists($field, $arCurrentValues) || array_key_exists($field . "_text", $arCurrentValues)) {
             $arValue = array();
             if (array_key_exists($field, $arCurrentValues)) {
                 $arValue = $arCurrentValues[$field];
                 if (!is_array($arValue) || is_array($arValue) && CBPHelper::IsAssociativeArray($arValue)) {
                     $arValue = array($arValue);
                 }
             }
             if (array_key_exists($field . "_text", $arCurrentValues)) {
                 $arValue[] = $arCurrentValues[$field . "_text"];
             }
             foreach ($arValue as $value) {
                 $value = trim($value);
                 if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $value) && substr($value, 0, 1) !== "=") {
                     if ($field == "PRIORITY") {
                         if (strlen($value) <= 0) {
                             $value = null;
                         }
                         if ($value != null && !array_key_exists($value, $arTaskPriority)) {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => "Priority is empty", "parameter" => $field);
                         }
                     } elseif ($field == "GROUP_ID") {
                         if (strlen($value) <= 0) {
                             $value = null;
                         }
                         if ($value != null && !array_key_exists($value, $arGroups)) {
                             $value = null;
                             $arErrors[] = array("code" => "ErrorValue", "message" => "Group is empty", "parameter" => $field);
                         }
                     } elseif (in_array($field, array("ALLOW_CHANGE_DEADLINE", "TASK_CONTROL", "ADD_IN_REPORT", 'ALLOW_TIME_TRACKING'))) {
                         if (strtoupper($value) == "Y" || $value === true || $value . "!" == "1!") {
                             $value = "Y";
                         } elseif (strtoupper($value) == "N" || $value === false || $value . "!" == "0!") {
                             $value = "N";
                         } else {
                             $value = null;
                         }
                     } else {
                         if (!is_array($value) && strlen($value) <= 0) {
                             $value = null;
                         }
                     }
                 }
                 if ($value != null) {
                     $r[] = $value;
                 }
             }
         }
         $r_orig = $r;
         if (!in_array($field, array("ACCOMPLICES", "AUDITORS"))) {
             if (count($r) > 0) {
                 $r = $r[0];
             } else {
                 $r = null;
             }
         }
         if (in_array($field, array("TITLE", "CREATED_BY", "RESPONSIBLE_ID")) && ($r == null || is_array($r) && count($r) <= 0)) {
             $arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $arDF[$field]["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
         }
         $arProperties["Fields"][$field] = $r;
         if (array_key_exists($field . "_text", $arCurrentValues) && isset($r_orig[1])) {
             $arProperties["Fields"][$field . '_text'] = $r_orig[1];
         }
     }
     $arUserFields = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("TASKS_TASK", 0, LANGUAGE_ID);
     foreach ($arUserFields as $field) {
         $r = $arCurrentValues[$field["FIELD_NAME"]];
         if ($field["MULTIPLE"] == "Y" && (!$r || is_array($r) && count($r) <= 0)) {
             $arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $field["EDIT_FORM_LABEL"], GetMessage("BPCDA_FIELD_REQUIED")));
         }
         $arProperties["Fields"][$field["FIELD_NAME"]] = $r;
     }
     $arProperties["HoldToClose"] = strtoupper($arCurrentValues["HOLD_TO_CLOSE"]) == "Y" ? true : false;
     $arProperties["AUTO_LINK_TO_CRM_ENTITY"] = strtoupper($arCurrentValues["AUTO_LINK_TO_CRM_ENTITY"]) == "Y" ? true : false;
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("message_user_from" => "MessageUserFrom", "message_user_to" => "MessageUserTo", "message_text" => "MessageText");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "message_user_from" || $key == "message_user_to") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     global $USER;
     if ($USER->IsAdmin() || CModule::IncludeModule("bitrix24") && CBitrix24::IsPortalAdmin($USER->GetID())) {
         $arProperties["MessageUserFrom"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_from"], $documentType, $arErrors);
         if (count($arErrors) > 0) {
             return false;
         }
     } else {
         $arProperties["MessageUserFrom"] = "user_" . $USER->GetID();
     }
     //global $USER;
     //if (!$USER->IsAdmin())
     //	$arProperties["MessageUserFrom"] = "user_".$USER->GetID();
     $arProperties["MessageUserTo"] = CBPHelper::UsersStringToArray($arCurrentValues["message_user_to"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#14
0
	public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
	{
		$arErrors = Array();

		$runtime = CBPRuntime::GetRuntime();

		$arProperties = array();

		$arProperties["DealId"] = $arCurrentValues["deal_id"];
		$arProperties["WaitForState"] = $arCurrentValues["stage"];

		$arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
		if (count($arErrors) > 0)
			return false;

		$arCurrentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
		$arCurrentActivity["Properties"] = $arProperties;

		return true;
	}
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("absence_user" => "AbsenceUser", "absence_name" => "AbsenceName", "absence_desrc" => "AbsenceDesrc", "absence_from" => "AbsenceFrom", "absence_to" => "AbsenceTo", "absence_state" => "AbsenceState", "absence_finish_state" => "AbsenceFinishState", "absence_type" => "AbsenceType");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "absence_user") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["AbsenceUser"] = CBPHelper::UsersStringToArray($arCurrentValues["absence_user"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#16
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("calendar_user" => "CalendarUser", "calendar_name" => "CalendarName", "calendar_desrc" => "CalendarDesrc", "calendar_from" => "CalendarFrom", "calendar_to" => "CalendarTo", "calendar_type" => "CalendarType", "calendar_owner_id" => "CalendarOwnerId", "calendar_section" => "CalendarSection");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "calendar_user") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["CalendarUser"] = CBPHelper::UsersStringToArray($arCurrentValues["calendar_user"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array();
     $arProperties["Permission"] = CBPHelper::UsersStringToArray($arCurrentValues["permission"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     $currentParent =& CBPWorkflowTemplateLoader::FindParentActivityByName($arWorkflowTemplate, $activityName);
     $c = count($currentParent['Children']);
     if ($c == 1) {
         if ($arCurrentValues["setstate"] != '') {
             $currentParent['Children'][] = array('Type' => 'SetStateActivity', 'Name' => md5(uniqid(mt_rand(), true)), 'Properties' => array('TargetStateName' => $arCurrentValues["setstate"]), 'Children' => array());
         }
     } elseif ($currentParent['Children'][$c - 1]["Type"] == 'SetStateActivity') {
         if ($arCurrentValues["setstate"] != '') {
             $currentParent['Children'][$c - 1]["Properties"]['TargetStateName'] = $arCurrentValues["setstate"];
         } else {
             unset($currentParent['Children'][$c - 1]);
         }
     }
     return true;
 }
示例#18
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("FieldValue" => array());
     /** @var CBPDocumentService $documentService */
     $documentService = $runtime->GetService("DocumentService");
     $arNewFieldsMap = array();
     if (array_key_exists("new_field_name", $arCurrentValues) && is_array($arCurrentValues["new_field_name"])) {
         $arNewFieldKeys = array_keys($arCurrentValues["new_field_name"]);
         foreach ($arNewFieldKeys as $k) {
             $code = trim($arCurrentValues["new_field_code"][$k]);
             $arFieldsTmp = array("name" => $arCurrentValues["new_field_name"][$k], "code" => $code, "type" => $arCurrentValues["new_field_type"][$k], "multiple" => $arCurrentValues["new_field_mult"][$k], "required" => $arCurrentValues["new_field_req"][$k], "options" => $arCurrentValues["new_field_options"][$k]);
             $newCode = $documentService->AddDocumentField($documentType, $arFieldsTmp);
             $property = FieldType::normalizeProperty($arFieldsTmp);
             $property['Code'] = $newCode;
             $property['Name'] = $arFieldsTmp['name'];
             $arNewFieldsMap[$code] = $property;
         }
     }
     $arDocumentFields = $documentService->GetDocumentFields($documentType);
     foreach ($arCurrentValues as $key => $value) {
         if (strpos($key, 'document_field_') !== 0) {
             continue;
         }
         $fieldKey = array_key_exists($value, $arNewFieldsMap) ? $arNewFieldsMap[$value]['Code'] : $value;
         if (!isset($arDocumentFields[$fieldKey]) || !$arDocumentFields[$fieldKey]["Editable"]) {
             continue;
         }
         $property = array_key_exists($value, $arNewFieldsMap) ? $arNewFieldsMap[$value] : $arDocumentFields[$fieldKey];
         $r = $documentService->GetFieldInputValue($documentType, $property, $value, $arCurrentValues, $arErrors);
         if (count($arErrors) > 0) {
             return false;
         }
         if (CBPHelper::getBool($property['Required']) && CBPHelper::isEmptyValue($r)) {
             $arErrors[] = array("code" => "NotExist", "parameter" => $fieldKey, "message" => GetMessage("BPSFA_ARGUMENT_NULL", array('#PARAM#' => $property['Name'])));
             return false;
         }
         $arProperties["FieldValue"][$fieldKey] = $r;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#19
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $documentService = $runtime->GetService("DocumentService");
     $arFieldTypes = $documentService->GetDocumentFieldTypes($documentType);
     $arProperties = array("VariableValue" => array());
     if (!is_array($arWorkflowVariables)) {
         $arWorkflowVariables = array();
     }
     if (count($arWorkflowVariables) <= 0) {
         $arErrors[] = array("code" => "EmptyVariables", "parameter" => "", "message" => GetMessage("BPSVA_EMPTY_VARS"));
         return false;
     }
     $l = strlen("variable_field_");
     foreach ($arCurrentValues as $key => $varCode) {
         if (substr($key, 0, $l) === "variable_field_") {
             $ind = substr($key, $l);
             if ($ind . "!" === intval($ind) . "!") {
                 if (array_key_exists($varCode, $arWorkflowVariables)) {
                     $arProperties["VariableValue"][$varCode] = $documentService->GetFieldInputValue($documentType, $arWorkflowVariables[$varCode], $varCode, $arCurrentValues, $arErrors);
                 }
             }
         }
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#20
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array();
     if (!isset($arCurrentValues["user_type"]) || !in_array($arCurrentValues["user_type"], array("boss", "random"))) {
         $arCurrentValues["user_type"] = "random";
     }
     $arProperties["UserType"] = $arCurrentValues["user_type"];
     if (!isset($arCurrentValues["max_level"]) || $arCurrentValues["max_level"] < 1 || $arCurrentValues["max_level"] > 10) {
         $arCurrentValues["max_level"] = 1;
     }
     $arProperties["MaxLevel"] = $arCurrentValues["max_level"];
     $arProperties["UserParameter"] = CBPHelper::UsersStringToArray($arCurrentValues["user_parameter"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["ReserveUserParameter"] = CBPHelper::UsersStringToArray($arCurrentValues["reserve_user_parameter"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     if (!isset($arCurrentValues["skip_absent"]) || !in_array($arCurrentValues["skip_absent"], array("Y", "N"))) {
         $arCurrentValues["skip_absent"] = "Y";
     }
     $arProperties["SkipAbsent"] = $arCurrentValues["skip_absent"];
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#21
0
 public static function &FindActivityInTemplate(&$arWorkflowTemplate, $activityName)
 {
     return CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
 }
示例#22
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$workflowTemplate, &$workflowParameters, &$workflowVariables, $currentValues, &$errors)
 {
     $runtime = CBPRuntime::GetRuntime();
     $errors = array();
     $map = array('setstatusmessage' => 'SetStatusMessage', 'statusmessage' => 'StatusMessage', 'usesubscription' => 'UseSubscription', 'timeoutduration' => 'TimeoutDuration', 'timeoutdurationtype' => 'TimeoutDurationType');
     $properties = array();
     foreach ($map as $key => $value) {
         $properties[$value] = $currentValues[$key];
     }
     $activityData = self::getRestActivityData();
     $activityProperties = isset($activityData['PROPERTIES']) && is_array($activityData['PROPERTIES']) ? $activityData['PROPERTIES'] : array();
     /** @var CBPDocumentService $documentService */
     $documentService = $runtime->GetService('DocumentService');
     $activityDocumentType = is_array($activityData['DOCUMENT_TYPE']) ? $activityData['DOCUMENT_TYPE'] : $documentType;
     foreach ($activityProperties as $name => $property) {
         $requestName = strtolower($name);
         if (isset($properties[$requestName])) {
             continue;
         }
         $errors = array();
         $properties[$name] = $documentService->GetFieldInputValue($activityDocumentType, $property, $requestName, $currentValues, $errors);
         if (count($errors) > 0) {
             return false;
         }
     }
     if (static::checkAdminPermissions()) {
         $properties['AuthUserId'] = CBPHelper::usersStringToArray($currentValues['authuserid'], $documentType, $errors);
         if (count($errors) > 0) {
             return false;
         }
     } else {
         unset($properties['AuthUserId']);
     }
     if (!empty($activityData['USE_SUBSCRIPTION'])) {
         $properties['UseSubscription'] = $activityData['USE_SUBSCRIPTION'];
     }
     $errors = self::ValidateProperties($properties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($errors) > 0) {
         return false;
     }
     $currentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($workflowTemplate, $activityName);
     $currentActivity["Properties"] = $properties;
     return true;
 }
示例#23
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("Fields" => array());
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFields = $documentService->GetDocumentFields($documentType);
     foreach ($arDocumentFields as $fieldKey => $fieldValue) {
         if (!$fieldValue["Editable"]) {
             continue;
         }
         $arFieldErrors = array();
         $r = $documentService->GetFieldInputValue($documentType, $fieldValue, $fieldKey, $arCurrentValues, $arFieldErrors);
         if (is_array($arFieldErrors) && !empty($arFieldErrors)) {
             $arErrors = array_merge($arErrors, $arFieldErrors);
         }
         if ($fieldValue["BaseType"] == "user") {
             if ($r === "author") {
                 //HACK: We can't resolve author for new document - setup target user as author.
                 $r = "{=Template:TargetUser}";
             } elseif (is_array($r)) {
                 $qty = count($r);
                 if ($qty == 0) {
                     $r = null;
                 } elseif ($qty == 1) {
                     $r = $r[0];
                 }
             }
         }
         if ($fieldValue["Required"] && $r == null) {
             $arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $fieldValue["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
         }
         if ($r != null) {
             $arProperties["Fields"][$fieldKey] = $r;
         }
     }
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
示例#24
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("task_type" => "TaskType", "task_owner_id" => "TaskOwnerId", "task_created_by" => "TaskCreatedBy", "task_active_from" => "TaskActiveFrom", "task_active_to" => "TaskActiveTo", "task_name" => "TaskName", "task_detail_text" => "TaskDetailText", "task_priority" => "TaskPriority", "task_assigned_to" => "TaskAssignedTo", "task_trackers" => "TaskTrackers", "task_forum_id" => "TaskForumId");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "task_created_by" || $key == "task_assigned_to" || $key == "task_trackers") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["TaskCreatedBy"] = CBPHelper::UsersStringToArray($arCurrentValues["task_created_by"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["TaskAssignedTo"] = CBPHelper::UsersStringToArray($arCurrentValues["task_assigned_to"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["TaskTrackers"] = CBPHelper::UsersStringToArray($arCurrentValues["task_trackers"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
">

<table style="width:100% !important" cellpadding="0" cellspacing="0" border="0">
<?php 
if (count($arErrors) > 0) {
    echo '<tr><td colspan="2">';
    foreach ($arErrors as $e) {
        echo '<font color="red">' . $e["message"] . '</font><br>';
    }
    echo '</td></tr>';
}
if ($_POST["postback"] == "Y") {
    $val = $_POST["title"];
    $activity_id = $_POST["activity_id"];
} else {
    $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
    $val = $arCurrentActivity["Properties"]["Title"];
    $activity_id = $activityName;
}
?>
<script>
function HideShowId()
{
	var act_id = BX('id_activity_name');
	if(act_id.style.display == 'none')
		act_id.style.display = '';
	else
		act_id.style.display = 'none';
}
</script>
<tr>
示例#26
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("mail_user_from" => "MailUserFrom", "mail_user_to" => "MailUserTo", "mail_subject" => "MailSubject", "mail_text" => "MailText", "mail_message_type" => "MailMessageType", "mail_charset" => "MailCharset", "dirrect_mail" => "DirrectMail", "mail_site" => "MailSite");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "mail_user_from" || $key == "mail_user_to") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     if (strlen($arProperties["MailSite"]) <= 0) {
         $arProperties["MailSite"] = $arCurrentValues["mail_site_x"];
     }
     list($mailUserFromArray, $mailUserFrom) = CBPHelper::UsersStringToArray($arCurrentValues["mail_user_from"], $documentType, $arErrors, array(__CLASS__, "CheckEmailUserValue"));
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["MailUserFrom"] = implode(", ", $mailUserFrom);
     $arProperties["MailUserFromArray"] = $mailUserFromArray;
     list($mailUserToArray, $mailUserTo) = CBPHelper::UsersStringToArray($arCurrentValues["mail_user_to"], $documentType, $arErrors, array(__CLASS__, "CheckEmailUserValue"));
     if (count($arErrors) > 0) {
         return false;
     }
     $arProperties["MailUserTo"] = implode(", ", $mailUserTo);
     $arProperties["MailUserToArray"] = $mailUserToArray;
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     if (!IsModuleInstalled('controller')) {
         $arErrors[] = array("code" => "module", "message" => GetMessage("BPCRIA_NO_MODULE"));
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = array();
     $arCurrentActivity["Properties"]["SitesFilterType"] = $arCurrentValues["sites_filter_type"];
     if ($arCurrentValues["sites_filter_type"] == "groups" && is_array($arCurrentValues["sites_filter_groups"])) {
         $arCurrentActivity["Properties"]["SitesFilterGroups"] = $arCurrentValues["sites_filter_groups"];
     } else {
         $arCurrentActivity["Properties"]["SitesFilterGroups"] = array();
     }
     if ($arCurrentValues["sites_filter_type"] == "sites") {
         $arCurrentActivity["Properties"]["SitesFilterSitesGroup"] = $arCurrentValues["sites_filter_sites_group"];
         if (is_array($arCurrentValues["sites_filter_sites"])) {
             $arCurrentActivity["Properties"]["SitesFilterSites"] = $arCurrentValues["sites_filter_sites"];
         } else {
             $arCurrentActivity["Properties"]["SitesFilterSites"] = array();
         }
     }
     $arCurrentActivity["Properties"]["SyncTime"] = $arCurrentValues["sync_time"];
     return true;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arMap = array("requested_users" => "Users", "requested_overdue_date" => "OverdueDate", "requested_name" => "Name", "requested_description" => "Description", "requested_parameters" => "Parameters", "requested_information" => "RequestedInformation", "task_button_message" => "TaskButtonMessage", "comment_label_message" => "CommentLabelMessage", "show_comment" => "ShowComment", "status_message" => "StatusMessage", "set_status_message" => "SetStatusMessage", 'access_control' => 'AccessControl', "timeout_duration" => "TimeoutDuration", "timeout_duration_type" => "TimeoutDurationType");
     $arProperties = array();
     foreach ($arMap as $key => $value) {
         if ($key == "requested_users") {
             continue;
         }
         $arProperties[$value] = $arCurrentValues[$key];
     }
     $arProperties["Users"] = CBPHelper::UsersStringToArray($arCurrentValues["requested_users"], $documentType, $arErrors);
     if (count($arErrors) > 0) {
         return false;
     }
     $ar = array();
     $j = -1;
     if (array_key_exists("RequestedInformation", $arProperties) && is_array($arProperties["RequestedInformation"])) {
         foreach ($arProperties["RequestedInformation"] as $arRI) {
             if (strlen($arRI["Name"]) <= 0) {
                 continue;
             }
             $j++;
             $ar[$j] = $arRI;
             $ar[$j]["Required"] = $arRI["Required"] == "Y";
             $ar[$j]["Multiple"] = $arRI["Multiple"] == "Y";
         }
     }
     $arProperties["RequestedInformation"] = $ar;
     $arErrors = self::ValidateProperties($arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser));
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     if (is_array($arProperties["RequestedInformation"])) {
         foreach ($arProperties["RequestedInformation"] as $v) {
             $arWorkflowVariables[$v["Name"]] = $v;
             $arWorkflowVariables[$v["Name"]]["Name"] = $v["Title"];
         }
     }
     return true;
 }
示例#29
0
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $runtime = CBPRuntime::GetRuntime();
     $arActivities = $runtime->SearchActivitiesByType("condition");
     if (!array_key_exists($arCurrentValues["condition_type"], $arActivities)) {
         $arErrors[] = array("code" => "", "message" => GetMessage("BPWA_INVALID_CONDITION_TYPE"));
         return false;
     }
     $condition = CBPActivityCondition::CallStaticMethod($arCurrentValues["condition_type"], "GetPropertiesDialogValues", array($documentType, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues, &$arErrors));
     if ($condition != null) {
         $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
         //if (!is_array($arCurrentActivity["Properties"]))
         $arCurrentActivity["Properties"] = array();
         $arCurrentActivity["Properties"][$arCurrentValues["condition_type"]] = $condition;
         return true;
     }
     return false;
 }
 public static function GetPropertiesDialogValues($documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors)
 {
     $arErrors = array();
     $runtime = CBPRuntime::GetRuntime();
     $arProperties = array("Fields" => array());
     $documentService = $runtime->GetService("DocumentService");
     $arDocumentFields = $documentService->GetDocumentFields($documentType);
     foreach ($arDocumentFields as $fieldKey => $fieldValue) {
         if (!$fieldValue["Editable"]) {
             continue;
         }
         $arErrors = array();
         $r = $documentService->GetFieldInputValue($documentType, $fieldValue, $fieldKey, $arCurrentValues, $arErrors);
         if ($fieldValue["BaseType"] == "user" && !CBPDocument::IsExpression($r)) {
             if (!is_array($r)) {
                 $r = array($r);
             }
             $ar = array();
             foreach ($r as $v) {
                 if (substr($v, 0, strlen("user_")) == "user_") {
                     $ar[] = substr($v, strlen("user_"));
                 }
             }
             if (count($ar) == 0) {
                 $r = null;
             } elseif (count($ar) == 1) {
                 $r = $ar[0];
             } else {
                 $r = $ar;
             }
         }
         if ($fieldValue["Required"] && $r == null) {
             $arErrors[] = array("code" => "emptyRequiredField", "message" => str_replace("#FIELD#", $fieldValue["Name"], GetMessage("BPCDA_FIELD_REQUIED")));
         }
         if ($r != null) {
             $arProperties["Fields"][$fieldKey] = $r;
         }
     }
     if (count($arErrors) > 0) {
         return false;
     }
     $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName);
     $arCurrentActivity["Properties"] = $arProperties;
     return true;
 }