public static function getFieldInputValue($documentType, $fieldType, $fieldName, $request, &$errors)
 {
     $storageId = self::getStorageIdByType($documentType);
     if (!$storageId) {
         throw new CBPArgumentOutOfRangeException('documentType');
     }
     $result = array();
     if ($fieldType["Type"] == "user" || $fieldType['Type'] == static::getPrefixForCustomType() . 'employee') {
         $value = $request[$fieldName["Field"]];
         if (strlen($value) > 0) {
             $result = CBPHelper::usersStringToArray($value, self::generateDocumentComplexType($storageId), $errors);
             if (count($errors) > 0) {
                 foreach ($errors as $e) {
                     $errors[] = $e;
                 }
             }
         }
     } elseif (array_key_exists($fieldName["Field"], $request) || array_key_exists($fieldName["Field"] . "_text", $request)) {
         $valueArray = array();
         if (array_key_exists($fieldName["Field"], $request)) {
             $valueArray = $request[$fieldName["Field"]];
             if (!is_array($valueArray) || is_array($valueArray) && CBPHelper::isAssociativeArray($valueArray)) {
                 $valueArray = array($valueArray);
             }
         }
         if (array_key_exists($fieldName["Field"] . "_text", $request)) {
             $valueArray[] = $request[$fieldName["Field"] . "_text"];
         }
         foreach ($valueArray as $value) {
             if (is_array($value) || !is_array($value) && !\CBPDocument::isExpression(trim($value))) {
                 if ($fieldType["Type"] == "int") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", $value);
                         if ($value . "|" == intval($value) . "|") {
                             $value = intval($value);
                         } else {
                             $value = null;
                             $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_INVALID1"), "parameter" => $fieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($fieldType["Type"] == "double") {
                     if (strlen($value) > 0) {
                         $value = str_replace(" ", "", str_replace(",", ".", $value));
                         if (is_numeric($value)) {
                             $value = doubleval($value);
                         } else {
                             $value = null;
                             $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_INVALID1"), "parameter" => $fieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif ($fieldType["Type"] == "select") {
                     if (!is_array($fieldType["Options"]) || count($fieldType["Options"]) <= 0 || strlen($value) <= 0) {
                         $value = null;
                     } else {
                         $ar = array_values($fieldType["Options"]);
                         if (is_array($ar[0])) {
                             $b = false;
                             foreach ($ar as $a) {
                                 if ($a[0] == $value) {
                                     $b = true;
                                     break;
                                 }
                             }
                             if (!$b) {
                                 $value = null;
                                 $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
                             }
                         } else {
                             if (!array_key_exists($value, $fieldType["Options"])) {
                                 $value = null;
                                 $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
                             }
                         }
                     }
                 } elseif ($fieldType["Type"] == "bool") {
                     if ($value !== "Y" && $value !== "N") {
                         if ($value === true) {
                             $value = "Y";
                         } elseif ($value === false) {
                             $value = "N";
                         } elseif (strlen($value) > 0) {
                             $value = 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;
                                 $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
                             }
                         } else {
                             $value = null;
                         }
                     }
                 } elseif ($fieldType["Type"] == "file") {
                     if (is_array($value) && array_key_exists("name", $value) && strlen($value["name"]) > 0) {
                         if (!array_key_exists("MODULE_ID", $value) || strlen($value["MODULE_ID"]) <= 0) {
                             $value["MODULE_ID"] = "bizproc";
                         }
                         $value = CFile::saveFile($value, "bizproc_wf", true, true);
                         if (!$value) {
                             $value = null;
                             $errors[] = array("code" => "ErrorValue", "message" => Loc::getMessage("DISK_UNKNOW"), "parameter" => $fieldName["Field"]);
                         }
                     } else {
                         $value = null;
                     }
                 } elseif (strpos($fieldType["Type"], ":") !== false) {
                     global $USER_FIELD_MANAGER;
                     $customTypeID = str_replace(static::getPrefixForCustomType(), '', $fieldType['Type']);
                     $customType = $USER_FIELD_MANAGER->getUserType($customTypeID);
                     if (is_bool($customType)) {
                         $customType = array();
                     }
                     if ($value !== null && array_key_exists("CheckFields", $customType)) {
                         $errorsTmp1 = call_user_func_array($customType["CheckFields"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value)));
                         if (count($errorsTmp1) > 0) {
                             $value = null;
                             foreach ($errorsTmp1 as $e) {
                                 $errors[] = array("code" => "ErrorValue", "message" => $e, "parameter" => $fieldName["Field"]);
                             }
                         }
                     }
                     if ($value !== null && $fieldType["Type"] == static::getPrefixForCustomType() . "employee") {
                         $value = "user_" . $value;
                     }
                     if (!is_array($value) && strlen($value) == 0 || is_array($value) && (count($value) == 0 || count($value) == 1 && isset($value["VALUE"]) && !is_array($value["VALUE"]) && strlen($value["VALUE"]) == 0)) {
                         $value = null;
                     }
                 } else {
                     if (!is_array($value) && strlen($value) <= 0) {
                         $value = null;
                     }
                 }
             }
             if ($value !== null) {
                 $result[] = $value;
             }
         }
     }
     if (!$fieldType["Multiple"]) {
         if (count($result) > 0) {
             $result = $result[0];
         } else {
             $result = null;
         }
     }
     return $result;
 }