$arFields["CITY"] = $arCity; } //region if (isset($_POST["REGION_ID"]) && $_POST["REGION_ID"] != "") { $arRegion = array("NAME" => isset($_POST['REGION_NAME']) ? $_POST['REGION_NAME'] : '', "SHORT_NAME" => isset($_POST['REGION_SHORT_NAME']) ? $_POST['REGION_SHORT_NAME'] : ''); for ($i = 0; $i < $countLang; $i++) { $arRegion[$arSysLangs[$i]] = array("LID" => $arSysLangs[$i], "NAME" => $arRegion["NAME"], "SHORT_NAME" => $arRegion["SHORT_NAME"]); } $arFields["REGION"] = $arRegion; } $arFields["LOC_DEFAULT"] = "N"; if (isset($_POST['LOC_DEFAULT']) && strlen($_POST['LOC_DEFAULT']) > 0) { $arFields["LOC_DEFAULT"] = $_POST['LOC_DEFAULT']; } if ($ID > 0) { $ID = CSaleLocation::Update($ID, $arFields); if (IntVal($ID) <= 0) { if ($ex = $APPLICATION->GetException()) { $strError .= $ex->GetString() . "<br>"; } else { $strError .= GetMessage("CRM_LOC_UPDATE_UNKNOWN_ERROR") . "<br>"; } } } else { $ID = CSaleLocation::Add($arFields); if (IntVal($ID) <= 0) { if ($ex = $APPLICATION->GetException()) { $strError = $ex->GetString() . "<br>"; } else { $strError .= GetMessage("CRM_LOC_ADD_UNKNOWN_ERROR") . "<br>"; }
$arFields["CITY"] = $arCity; } //region if (isset($_POST["REGION_ID"]) && $_POST["REGION_ID"] != "") { $arRegion = array("NAME" => $REGION_NAME, "SHORT_NAME" => $REGION_SHORT_NAME); for ($i = 0; $i < count($arSysLangs); $i++) { $arRegion[$arSysLangs[$i]] = array("LID" => $arSysLangs[$i], "NAME" => ${"REGION_NAME_" . $arSysLangs[$i]}, "SHORT_NAME" => ${"REGION_SHORT_NAME_" . $arSysLangs[$i]}); } $arFields["REGION"] = $arRegion; } $arFields["LOC_DEFAULT"] = "N"; if (strlen($LOC_DEFAULT) > 0) { $arFields["LOC_DEFAULT"] = $LOC_DEFAULT; } if ($ID > 0) { if (!CSaleLocation::Update($ID, $arFields)) { $strError .= GetMessage("ERROR_EDIT_LOCAT") . "<br>"; } } else { $ID = CSaleLocation::Add($arFields); if (IntVal($ID) <= 0) { $strError .= GetMessage("ERROR_ADD_LOCAT") . "<br>"; } } if ($ID > 0 && strlen($strError) <= 0) { $arZipList = $_REQUEST["ZIP"]; CSaleLocation::SetLocationZIP($ID, $arZipList); } } if (strlen($strError) > 0) { $bInitVars = True;