199 self::clearManualEditFlag($userField);
204 if (!Loader::includeModule(
'location') || self::isRawValue($value))
208 $fieldName = ($userField[
'FIELD_NAME'] ??
null);
209 $isManualAddressEdit = $_POST[$fieldName .
'_manual_edit'] ??
null;
210 if (!$isManualAddressEdit)
213 $value = $parsedValue[0] .
'|' . $parsedValue[1][0] .
';' . $parsedValue[1][1];
216 self::clearManualEditFlag($userField);
221 if (mb_strlen($value) > 4 && mb_substr($value, -4) ===
'_del')
223 $oldAddressId = (int)substr($value, 0, -4);
227 $oldAddress->delete();
230 self::clearManualEditFlag($userField);
238 $convertedValue = Encoding::convertEncoding($value, LANG_CHARSET,
'UTF-8');
243 if (is_string($value))
245 $addressFields = self::getAddressFieldsFromString($value);
252 self::clearManualEditFlag($userField);
257 $saveResult = $address->save();
258 if ($saveResult->isSuccess())
260 $value = self::formatAddressToString($address);
264 $value = self::getTextAddress($address);
267 self::clearManualEditFlag($userField);
289 if(mb_strpos($value,
'|') !==
false)
291 [$value, $coords, $addressId] = explode(
'|', $value);
294 $addressId = (int)$addressId;
296 if($coords !==
'' && mb_strpos($coords,
';') !==
false)
298 $coords = explode(
';', $coords);
312 $json = $address->toJson();
317 $address = self::tryConvertFromJsonToAddress($value);
321 $value = self::getTextAddress($address);
370 $valueParts = explode(
'|', $value);
371 $valuePartsCount = count($valueParts);
372 if ($valuePartsCount < 2)
377 if (mb_strpos($valueParts[1],
';') ===
false)
382 $possibleCoords = explode(
';', $valueParts[1]);
384 count($possibleCoords) !== 2
386 (!is_numeric($possibleCoords[0]) || !is_numeric($possibleCoords[1]))
387 && !($possibleCoords[0] ===
'' && $possibleCoords[1] ===
'')