...Человеческий поиск в разработке...
- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/classes/general/helper.php
- Класс: CBPHelper
- Вызов: CBPHelper::getFieldInputValue
static function getFieldInputValue($documentType, $arFieldType, $arFieldName, $arRequest, &$arErrors) { $result = []; if ($arFieldType["Type"] == "user") { $value = $arRequest[$arFieldName["Field"]]; if ($value <> '') { $result = CBPHelper::UsersStringToArray($value, $documentType, $arErrors); if (count($arErrors) > 0) { foreach ($arErrors as $e) { $arErrors[] = $e; } } } } elseif (array_key_exists($arFieldName["Field"], $arRequest) || array_key_exists($arFieldName["Field"]."_text", $arRequest)) { $arValue = []; if (array_key_exists($arFieldName["Field"], $arRequest)) { $arValue = $arRequest[$arFieldName["Field"]]; if (!is_array($arValue) || is_array($arValue) && CBPHelper::IsAssociativeArray($arValue)) { $arValue = array($arValue); } } if (array_key_exists($arFieldName["Field"]."_text", $arRequest)) { $arValue[] = $arRequest[$arFieldName["Field"]."_text"]; } foreach ($arValue as $value) { if (!CBPActivity::isExpression($value)) { if ($arFieldType["Type"] == "int") { if ($value <> '') { $value = str_replace(" ", "", $value); if ($value."|" == intval($value)."|") { $value = intval($value); } else { $value = null; $arErrors[] = array( "code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID1"), "parameter" => $arFieldName["Field"], ); } } else { $value = null; } } elseif ($arFieldType["Type"] == "double") { if ($value <> '') { $value = str_replace(" ", "", str_replace(",", ".", $value)); if ($value."|" == doubleval($value)."|") { $value = doubleval($value); } else { $value = null; $arErrors[] = array( "code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID11"), "parameter" => $arFieldName["Field"], ); } } else { $value = null; } } elseif ($arFieldType["Type"] == "select") { if (!is_array($arFieldType["Options"]) || count($arFieldType["Options"]) <= 0 || $value == '') { $value = null; } elseif (!array_key_exists($value, $arFieldType["Options"])) { $value = null; $arErrors[] = array( "code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID35"), "parameter" => $arFieldName["Field"], ); } } elseif ($arFieldType["Type"] == "bool") { if ($value !== "Y" && $value !== "N") { if ($value === true) { $value = "Y"; } elseif ($value === false) { $value = "N"; } elseif ($value <> '') { $value = mb_strtolower($value); if (in_array($value, array("y", "yes", "true", "1"))) { $value = "Y"; } elseif (in_array($value, array("n", "no", "false", "0"))) { $value = "N"; } else { $value = null; $arErrors[] = array( "code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID45"), "parameter" => $arFieldName["Field"], ); } } else { $value = null; } } } elseif ($arFieldType["Type"] == "file") { if (array_key_exists("name", $value) && $value["name"] <> '') { if (!array_key_exists("MODULE_ID", $value) || $value["MODULE_ID"] == '') $value["MODULE_ID"] = "bizproc"; $value = CFile::SaveFile($value, "bizproc_wf"); if (!$value) { $value = null; $arErrors[] = array( "code" => "ErrorValue", "message" => GetMessage("BPCGWTL_INVALID915"), "parameter" => $arFieldName["Field"], ); } } else { $value = null; } } else { if (!is_array($value) && $value == '') $value = null; } } if ($value != null) $result[] = $value; } } if (!$arFieldType["Multiple"]) { if (count($result) > 0) $result = $result[0]; else $result = null; } return $result; }