示例#1
0
 protected static function prepareParamsForSaving(array $params = array(), $deliveryId = 0)
 {
     if ($deliveryId > 0) {
         $arLocation = array();
         if (!!\CSaleLocation::isLocationProEnabled()) {
             if (strlen($params["LOCATION"]['L'])) {
                 $LOCATION1 = explode(':', $params["LOCATION"]['L']);
             }
             if (strlen($params["LOCATION"]['G'])) {
                 $LOCATION2 = explode(':', $params["LOCATION"]['G']);
             }
         }
         if (isset($LOCATION1) && is_array($LOCATION1) && count($LOCATION1) > 0) {
             $arLocation["L"] = array();
             $locationCount = count($LOCATION1);
             for ($i = 0; $i < $locationCount; $i++) {
                 if (strlen($LOCATION1[$i])) {
                     $arLocation["L"][] = $LOCATION1[$i];
                 }
             }
         }
         if (isset($LOCATION2) && is_array($LOCATION2) && count($LOCATION2) > 0) {
             $arLocation["G"] = array();
             $locationCount = count($LOCATION2);
             for ($i = 0; $i < $locationCount; $i++) {
                 if (strlen($LOCATION2[$i])) {
                     $arLocation["G"][] = $LOCATION2[$i];
                 }
             }
         }
         DeliveryLocationTable::resetMultipleForOwner($deliveryId, $arLocation);
     }
     return array();
 }
示例#2
0
use Bitrix\Sale\Location;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
$saleModulePermissions = $APPLICATION->GetGroupRight("sale");
if ($saleModulePermissions < "W") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/include.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/prolog.php";
$ID = IntVal($ID);
ClearVars();
ClearVars("fp_");
$strError = "";
$bInitVars = false;
$lpEnabled = CSaleLocation::isLocationProEnabled();
if ((strlen($save) > 0 || strlen($apply) > 0) && $REQUEST_METHOD == "POST" && $saleModulePermissions == "W" && check_bitrix_sessid()) {
    $TAX_ID = IntVal($TAX_ID);
    if ($TAX_ID <= 0) {
        $strError .= GetMessage("ERROR_NO_TAX_ID") . "<br>";
    }
    $VALUE = str_replace(",", ".", $VALUE);
    $VALUE = DoubleVal($VALUE);
    if ($VALUE <= 0) {
        $strError .= GetMessage("ERROR_NO_VALUE") . "<br>";
    }
    if ($IS_IN_PRICE != "Y") {
        $IS_IN_PRICE = "N";
    }
    if ($ACTIVE != "Y") {
        $ACTIVE = "N";
示例#3
0
			transition : BX.easing.makeEaseOut(BX.easing.transitions.quart),
			step : function(state){
				pFormCont.style.height = state.height + "px";
				pFormCont.style.opacity = state.opacity / 100;
			},
			complete : function(){
					BX('sale_order_props').style.display = display;
					BX('sale_order_props').style.height = '';

					pFormCont.style.overflow = "visible";
			}
		})).animate();
	}
</script>

<?if(!CSaleLocation::isLocationProEnabled()):?>
	<div style="display:none;">

		<?$APPLICATION->IncludeComponent(
			"bitrix:sale.ajax.locations",
			$arParams["TEMPLATE_LOCATION"],
			array(
				"AJAX_CALL" => "N",
				"COUNTRY_INPUT_NAME" => "COUNTRY_tmp",
				"REGION_INPUT_NAME" => "REGION_tmp",
				"CITY_INPUT_NAME" => "tmp",
				"CITY_OUT_LOCATION" => "Y",
				"LOCATION_VALUE" => "",
				"ONCITYCHANGE" => "submitForm()",
			),
			null,
示例#4
0
	function PrintPropsForm($arSource = array(), $locationTemplate = ".default")
	{
		if (!empty($arSource))
		{
			?>
				<div>
					<?
					foreach ($arSource as $arProperties)
					{
						if(CSaleLocation::isLocationProMigrated())
						{
							$propertyAttributes = array(
								'type' => $arProperties["TYPE"],
								'valueSource' => $arProperties['SOURCE'] == 'DEFAULT' ? 'default' : 'form'
							);

							if(intval($arProperties['IS_ALTERNATE_LOCATION_FOR']))
								$propertyAttributes['isAltLocationFor'] = intval($arProperties['IS_ALTERNATE_LOCATION_FOR']);

							if(intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION']))
								$propertyAttributes['altLocationPropId'] = intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION']);

							if($arProperties['IS_ZIP'] == 'Y')
								$propertyAttributes['isZip'] = true;
						}
						?>
						<div data-property-id-row="<?php 
echo intval(intval($arProperties["ID"]));
?>
">

						<?
						if ($arProperties["TYPE"] == "CHECKBOX")
						{
							?>
							<input type="hidden" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" value="">

							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r1x3 pt8">
								<input type="checkbox" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" value="Y"<?if ($arProperties["CHECKED"]=="Y") echo " checked";?>>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>

							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "TEXT")
						{
							?>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<input type="text" maxlength="250" size="<?php 
echo $arProperties["SIZE1"];
?>
" value="<?php 
echo $arProperties["VALUE"];
?>
" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" />

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>
							<div style="clear: both;"></div><br/>
							<?
						}
						elseif ($arProperties["TYPE"] == "SELECT")
						{
							?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<select name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" size="<?php 
echo $arProperties["SIZE1"];
?>
">
									<?
									foreach($arProperties["VARIANTS"] as $arVariants):
									?>
										<option value="<?php 
echo $arVariants["VALUE"];
?>
"<?if ($arVariants["SELECTED"] == "Y") echo " selected";?>><?php 
echo $arVariants["NAME"];
?>
</option>
									<?
									endforeach;
									?>
								</select>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>
							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "MULTISELECT")
						{
							?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<select multiple name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" size="<?php 
echo $arProperties["SIZE1"];
?>
">
									<?
									foreach($arProperties["VARIANTS"] as $arVariants):
									?>
										<option value="<?php 
echo $arVariants["VALUE"];
?>
"<?if ($arVariants["SELECTED"] == "Y") echo " selected";?>><?php 
echo $arVariants["NAME"];
?>
</option>
									<?
									endforeach;
									?>
								</select>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>
							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "TEXTAREA")
						{
							$rows = ($arProperties["SIZE2"] > 10) ? 4 : $arProperties["SIZE2"];
							?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<textarea rows="<?php 
echo $rows;
?>
" cols="<?php 
echo $arProperties["SIZE1"];
?>
" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
"><?php 
echo $arProperties["VALUE"];
?>
</textarea>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>
							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "LOCATION")
						{
							?>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">

								<?
								$value = 0;
								if (is_array($arProperties["VARIANTS"]) && count($arProperties["VARIANTS"]) > 0)
								{
									foreach ($arProperties["VARIANTS"] as $arVariant)
									{
										if ($arVariant["SELECTED"] == "Y")
										{
											$value = $arVariant["ID"];
											break;
										}
									}
								}

								// here we can get '' or 'popup'
								// map them, if needed
								if(CSaleLocation::isLocationProMigrated())
								{
									$locationTemplate = $locationTemplate == 'popup' ? 'search' : 'steps';
									$locationTemplate = $_REQUEST['PERMANENT_MODE_STEPS'] == 1 ? 'steps' : $locationTemplate; // force to "steps"
								}
								?>

								<?if($locationTemplate == 'steps'):?>
									<input type="hidden" id="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
echo intval($arProperties["ID"]);
?>
]" name="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
echo intval($arProperties["ID"]);
?>
]" value="<?php 
echo $_REQUEST['LOCATION_ALT_PROP_DISPLAY_MANUAL'][intval($arProperties["ID"])] ? '1' : '0';
?>
" />
								<?endif?>

								<?CSaleLocation::proxySaleAjaxLocationsComponent(array(
									"AJAX_CALL" => "N",
									"COUNTRY_INPUT_NAME" => "COUNTRY",
									"REGION_INPUT_NAME" => "REGION",
									"CITY_INPUT_NAME" => $arProperties["FIELD_NAME"],
									"CITY_OUT_LOCATION" => "Y",
									"LOCATION_VALUE" => $value,
									"ORDER_PROPS_ID" => $arProperties["ID"],
									"ONCITYCHANGE" => ($arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y") ? "submitForm()" : "",
									"SIZE1" => $arProperties["SIZE1"],
								),
								array(
									"ID" => $value,
									"CODE" => "",
									"SHOW_DEFAULT_LOCATIONS" => "Y",

									// function called on each location change caused by user or by program
									// it may be replaced with global component dispatch mechanism coming soon
									"JS_CALLBACK" => "submitFormProxy", //($arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y") ? "submitFormProxy" : "",

									// function window.BX.locationsDeferred['X'] will be created and lately called on each form re-draw.
									// it may be removed when sale.order.ajax will use real ajax form posting with BX.ProcessHTML() and other stuff instead of just simple iframe transfer
									"JS_CONTROL_DEFERRED_INIT" => intval($arProperties["ID"]),

									// an instance of this control will be placed to window.BX.locationSelectors['X'] and lately will be available from everywhere
									// it may be replaced with global component dispatch mechanism coming soon
									"JS_CONTROL_GLOBAL_ID" => intval($arProperties["ID"]),

									"DISABLE_KEYBOARD_INPUT" => 'Y',
									"PRECACHE_LAST_LEVEL" => "Y",
								),
								$locationTemplate,
								true,
								'location-block-wrapper'
								)?>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>

							</div>
							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "RADIO")
						{
							?>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<?
								if (is_array($arProperties["VARIANTS"]))
								{
									foreach($arProperties["VARIANTS"] as $arVariants):
									?>
										<input
											type="radio"
											name="<?php 
echo $arProperties["FIELD_NAME"];
?>
"
											id="<?php 
echo $arProperties["FIELD_NAME"];
?>
_<?php 
echo $arVariants["VALUE"];
?>
"
											value="<?php 
echo $arVariants["VALUE"];
?>
" <?if($arVariants["CHECKED"] == "Y") echo " checked";?> />

										<label for="<?php 
echo $arProperties["FIELD_NAME"];
?>
_<?php 
echo $arVariants["VALUE"];
?>
"><?php 
echo $arVariants["NAME"];
?>
</label></br>
									<?
									endforeach;
								}
								?>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>
							<div style="clear: both;"></div>
							<?
						}
						elseif ($arProperties["TYPE"] == "FILE")
						{
							?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
echo $arProperties["NAME"];
?>
								<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
									<span class="bx_sof_req">*</span>
								<?endif;?>
							</div>

							<div class="bx_block r3x1">
								<?php 
echo showFilePropertyField("ORDER_PROP_" . $arProperties["ID"], $arProperties, $arProperties["VALUE"], $arProperties["SIZE1"]);
?>

								<?
								if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
								?>
								<div class="bx_description">
									<?php 
echo $arProperties["DESCRIPTION"];
?>
								</div>
								<?
								endif;
								?>
							</div>

							<div style="clear: both;"></div><br/>
							<?
						}
						?>
						</div>

						<?if(CSaleLocation::isLocationProEnabled()):?>
							<script>

								(window.top.BX || BX).saleOrderAjax.addPropertyDesc(<?php 
echo CUtil::PhpToJSObject(array('id' => intval($arProperties["ID"]), 'attributes' => $propertyAttributes));
?>
);

							</script>
						<?endif?>

						<?
					}
					?>
				</div>
			<?
		}
	}
示例#5
0
function getOrderPropFormated($arProperties, $arResult, &$arUserResult, &$arDeleteFieldLocation = array())
{
	global $USER;

	$isProfileChanged = ($arUserResult["PROFILE_CHANGE"] == "Y");

	$isEmptyUserResult = (empty($arUserResult["ORDER_PROP"]));

	$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	$curLocation = false;
	static $propertyGroupID = 0;
	static $propertyUSER_PROPS = "";

	// take data from user profile
	if ($arUserResult["PROFILE_CHANGE"] == "Y"
		&& intval($arUserResult["PROFILE_ID"]) > 0
		&& !($arResult["HAVE_PREPAYMENT"]
		&& $arUserResult["PROFILE_DEFAULT"] == "Y"
		&& !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]])))
	{
		$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(
			array("SORT" => "ASC"),
			array(
				"USER_PROPS_ID" => $arUserResult["PROFILE_ID"],
				"ORDER_PROPS_ID" => $arProperties["ID"],
				"USER_ID" => intval($USER->GetID()),
			),
			false,
			false,
			array("VALUE", "PROP_TYPE", "VARIANT_NAME", "SORT", "ORDER_PROPS_ID")
		);
		if ($arUserPropsValues = $dbUserPropsValues->Fetch())
		{
			$valueTmp = "";
			if ($arUserPropsValues["PROP_TYPE"] == "MULTISELECT")
			{
				$arUserPropsValues["VALUE"] = explode(",", $arUserPropsValues["VALUE"]);
			}
			$curVal = $arUserPropsValues["VALUE"];
		}
	}
	elseif($arUserResult["PROFILE_CHANGE"] == "Y" && intval($arUserResult["PROFILE_ID"]) <= 0)
	{
		if (isset($curVal))
			unset($curVal);
	}
	elseif(isset($arUserResult["ORDER_PROP"][$arProperties["ID"]]))
		$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	elseif($arResult["HAVE_PREPAYMENT"] && !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]]))
	{
		$curVal = $arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]];
		if($arProperties["TYPE"] == "LOCATION")
			$curLocation = $curVal;
	}

	if (intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]) > 0)
		$curVal = intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]);

	$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"];

	if(strlen($arProperties["CODE"]) > 0)
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["CODE"];
	else
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["ID"];

	if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID || $propertyUSER_PROPS != $arProperties["USER_PROPS"])
		$arProperties["SHOW_GROUP_NAME"] = "Y";

	$propertyGroupID = $arProperties["PROPS_GROUP_ID"];
	$propertyUSER_PROPS = $arProperties["USER_PROPS"];

	if ($arProperties["REQUIED"]=="Y" || $arProperties["IS_EMAIL"]=="Y" || $arProperties["IS_PROFILE_NAME"]=="Y" || $arProperties["IS_LOCATION"]=="Y" || $arProperties["IS_LOCATION4TAX"]=="Y" || $arProperties["IS_PAYER"]=="Y" || $arProperties["IS_ZIP"]=="Y")
		$arProperties["REQUIED_FORMATED"]="Y";

	if ($arProperties["TYPE"] == "CHECKBOX")
	{
		if ($curVal=="Y" || !isset($curVal) && $arProperties["DEFAULT_VALUE"]=="Y")
		{
			$arProperties["CHECKED"] = "Y";
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_Y");
		}
		else
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_N");

		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 30);

		if ($isProfileChanged || $isEmptyUserResult)
		{
			$arUserResult["ORDER_PROP"][$arProperties["ID"]] = (isset($arProperties["CHECKED"]) && $arProperties["CHECKED"] == "Y" ? 'Y' : "N");

		}

	}
	elseif ($arProperties["TYPE"] == "TEXT")
	{
		if (strlen($curVal) <= 0)
		{
			if(strlen($arProperties["DEFAULT_VALUE"])>0 && !isset($curVal))
				$arProperties["VALUE"] = $arProperties["DEFAULT_VALUE"];
			elseif ($arProperties["IS_EMAIL"] == "Y")
				$arProperties["VALUE"] = $USER->GetEmail();
			elseif ($arProperties["IS_PAYER"] == "Y")
			{
				//$arProperties["VALUE"] = $USER->GetFullName();
				$rsUser = CUser::GetByID($USER->GetID());
				$fio = "";
				if ($arUser = $rsUser->Fetch())
				{
					$fio = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"]), false, false);
				}
				$arProperties["VALUE"] = $fio;
			}

			$arProperties["SOURCE"] = 'DEFAULT';
		}
		else
		{
			$arProperties["VALUE"] = $curVal;
			$arProperties["SOURCE"] = 'FORM';
		}

		//select ZIP for LOCATION
		if ($arProperties["IS_ZIP"] == "Y" && $arUserResult["PROFILE_CHANGE"] == "N")
		{
			$dbPropertiesLoc = CSaleOrderProps::GetList(
					array("ID" => "DESC"),
					array(
						"PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"],
						"ACTIVE" => "Y",
						"UTIL" => "N",
						"IS_LOCATION" => "Y"
						),
					false,
					false,
					array("ID")
				);
			$arPropertiesLoc = $dbPropertiesLoc->Fetch();

			if ($arPropertiesLoc["ID"] > 0)
			{
				$arZipLocation = array();
				if(strlen($curVal) > 0)
					$arZipLocation = CSaleLocation::GetByZIP($curVal);

				$rsZipList = CSaleLocation::GetLocationZIP($arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]);
				if($arZip = $rsZipList->Fetch())
				{
					if (strlen($arZip["ZIP"]) > 0 && (empty($arZipLocation) || $arZipLocation["ID"] != $arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]))
						$arProperties["VALUE"] = $arZip["ZIP"];
				}
			}
		}

		if ($arProperties["IS_ZIP"]=="Y")
			$arUserResult["DELIVERY_LOCATION_ZIP"] = $arProperties["VALUE"];


		$arProperties["VALUE"] = htmlspecialcharsEx($arProperties["VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];

		if ($isProfileChanged || $isEmptyUserResult)
		{
			$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
		}

	}
	elseif ($arProperties["TYPE"] == "SELECT")
	{
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC", "NAME" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")

		);
		$flagDefault = "N";
		$nameProperty = "";
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($flagDefault == "N" && $nameProperty == "")
			{
				$nameProperty = $arVariants["NAME"];
			}
			if (($arVariants["VALUE"] == $curVal) || ((!isset($curVal) || $curVal == "") && ($arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])))
			{
				$arVariants["SELECTED"] = "Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
				$flagDefault = "Y";

				if ($isProfileChanged || $isEmptyUserResult)
				{
					$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arVariants["NAME"];
				}
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}
		if ($flagDefault == "N")
		{
			$arProperties["VARIANTS"][0]["SELECTED"]= "Y";
			$arProperties["VARIANTS"][0]["VALUE_FORMATED"] = $nameProperty;
			if ($isProfileChanged || $isEmptyUserResult)
			{
				$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $nameProperty;
			}
		}
	}
	elseif ($arProperties["TYPE"] == "MULTISELECT")
	{

		$setValue = array();
		$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"].'[]';
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 5);
		$arDefVal = explode(",", $arProperties["DEFAULT_VALUE"]);
		$countDefVal = count($arDefVal);
		for ($i = 0; $i < $countDefVal; $i++)
			$arDefVal[$i] = Trim($arDefVal[$i]);

		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		$i = 0;
		while ($arVariants = $dbVariants->GetNext())
		{
			if ((is_array($curVal) && in_array($arVariants["VALUE"], $curVal)) || (!isset($curVal) && in_array($arVariants["VALUE"], $arDefVal)))
			{
				$arVariants["SELECTED"] = "Y";
				if ($i > 0)
					$arProperties["VALUE_FORMATED"] .= ", ";
				$arProperties["VALUE_FORMATED"] .= $arVariants["NAME"];
				$setValue[] = $arVariants["VALUE"];
				$i++;
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}

		if ($isProfileChanged || $isEmptyUserResult)
		{
			$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $setValue;
		}
	}
	elseif ($arProperties["TYPE"] == "TEXTAREA")
	{
		$arProperties["SIZE2"] = ((intval($arProperties["SIZE2"]) > 0) ? $arProperties["SIZE2"] : 4);
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 40);
		$arProperties["VALUE"] = htmlspecialcharsEx(isset($curVal) ? $curVal : $arProperties["DEFAULT_VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];

		if ($isProfileChanged || $isEmptyUserResult)
		{
			$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
		}
	}
	elseif ($arProperties["TYPE"] == "LOCATION")
	{
		if(CSaleLocation::isLocationProEnabled())
		{
			$arProperties["VALUE"] = $curVal;

			// variants
			$locationFound = false;
			$dbVariants = CSaleLocation::GetList(
					array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
					array("LID" => LANGUAGE_ID),
					false,
					false,
					array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG", "CITY_ID")
				);
			while ($arVariants = $dbVariants->GetNext())
			{
				if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
				{
					// set formatted value
					$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];

					// location found, set it as DELIVERY_LOCATION and TAX_LOCATION

					$arUserResult["DELIVERY_LOCATION"] = $arVariants['ID'];
					if($arProperties["IS_LOCATION4TAX"]=="Y")
						$arUserResult["TAX_LOCATION"] = $arVariants['ID'];

					$locationFound = $arVariants;
					$arVariants["SELECTED"] = "Y";

					if ($isProfileChanged || $isEmptyUserResult)
					{
						$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arVariants['ID'];
					}
				}
				$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];

				// save to variants
				$arProperties["VARIANTS"][] = $arVariants;
			}

			// this is not a COUNTRY, REGION or CITY, but must appear in $arProperties["VARIANTS"]
			if(!$locationFound && IntVal($curVal))
			{
				$item = CSaleLocation::GetById($curVal);
				if($item)
				{
					// set formatted value
					$arProperties["VALUE_FORMATED"] = $item["COUNTRY_NAME"].((strlen($item["CITY_NAME"]) > 0) ? " - " : "").$item["CITY_NAME"];

					// location found, set it as DELIVERY_LOCATION and TAX_LOCATION
					$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
					if($arProperties["IS_LOCATION4TAX"]=="Y")
						$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

					if ($isProfileChanged || $isEmptyUserResult)
					{
						$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
					}
					$locationFound = $item;
					$item['SELECTED'] = 'Y';
					$item['NAME'] = $item["COUNTRY_NAME"].((strlen($item["CITY_NAME"]) > 0) ? " - " : "").$item["CITY_NAME"];

					// save to variants
					$arProperties["VARIANTS"][] = $item;
				}
			}

			if($locationFound)
			{

				// enable location town text
				if(isset($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'])) // its an ajax-hit and sale.location.selector.steps is used
				{
					if(intval($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'][$arProperties["ID"]])) // user MANUALLY selected "Other location" in the selector
					{
						// Manually chosen, decide...

						//if(intval($locationFound['CITY_ID'])) // we are already selected CITY, no town property needed
						//	$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
						//else // somewhere above
							unset($arDeleteFieldLocation[$arProperties["ID"]]);
					}
					else
					{
						$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
					}
				}
				else
				{
					// first load, dont know what to do. default: hide
					$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
				}

			}
			else
			{
				$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}
		}
		else
		{
			//enable location town text
			if ($_REQUEST["is_ajax_post"] == "Y" && $arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0 && isset($_REQUEST["ORDER_PROP_".$arProperties["ID"]]))
			{
				$rsLocationsList = CSaleLocation::GetList(
					array(),
					array("ID" => $curVal),
					false,
					false,
					array("ID", "CITY_ID")
				);
				$arCity = $rsLocationsList->GetNext();

				if (intval($arCity["CITY_ID"]) <= 0)
					unset($arDeleteFieldLocation[$arProperties["ID"]]);
				else
					$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}
			elseif ($arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0)
			{
				$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}

			$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
			$dbVariants = CSaleLocation::GetList(
					array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
					array("LID" => LANGUAGE_ID),
					false,
					false,
					array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG")
				);
			while ($arVariants = $dbVariants->GetNext())
			{
				if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
				{
					$arVariants["SELECTED"] = "Y";
					$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
					$arProperties["VALUE"] = $arVariants["ID"];

					if ($arProperties["IS_LOCATION"]=="Y")
						$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
					if ($arProperties["IS_LOCATION4TAX"]=="Y")
						$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

					if ($isProfileChanged || $isEmptyUserResult)
					{
						$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
					}

				}
				$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
				$arProperties["VARIANTS"][] = $arVariants;
			}
			if(count($arProperties["VARIANTS"]) == 1)
			{
				$arProperties["VALUE"] = $arProperties["VARIANTS"][0]["ID"];
				if($arProperties["IS_LOCATION"]=="Y")
					$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
				if($arProperties["IS_LOCATION4TAX"]=="Y")
					$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];
			}
		}
	}
	elseif ($arProperties["TYPE"] == "RADIO")
	{
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($arVariants["VALUE"] == $curVal || (!isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"]))
			{
				$arVariants["CHECKED"]="Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];

				if ($isProfileChanged || $isEmptyUserResult)
				{
					$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arVariants["VALUE"];
				}
			}

			$arProperties["VARIANTS"][] = $arVariants;
		}
	}
	elseif ($arProperties["TYPE"] == "FILE")
	{
		$arProperties["SIZE1"] = intval($arProperties["SIZE1"]);
		$arProperties["VALUE"] = isset($curVal) ? CSaleHelper::getFileInfo($curVal) : $arProperties["DEFAULT_VALUE"];

		if ($isProfileChanged || $isEmptyUserResult)
		{
			$arUserResult["ORDER_PROP"][$arProperties["ID"]] = $arProperties["VALUE"];
		}
	}

	return $arProperties;
}
示例#6
0
function getOrderPropFormated($arProperties, $arResult, &$arUserResult, &$arDeleteFieldLocation = array())
{
	global $USER;

	$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	$curLocation = false;
	static $propertyGroupID = 0;
	static $propertyUSER_PROPS = "";

	// take data from user profile
	if ($arUserResult["PROFILE_CHANGE"] == "Y"
		&& intval($arUserResult["PROFILE_ID"]) > 0
		&& !($arResult["HAVE_PREPAYMENT"]
		&& $arUserResult["PROFILE_DEFAULT"] == "Y"
		&& !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]])))
	{
		$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(
			array("SORT" => "ASC"),
			array(
				"USER_PROPS_ID" => $arUserResult["PROFILE_ID"],
				"ORDER_PROPS_ID" => $arProperties["ID"],
				"USER_ID" => intval($USER->GetID()),
			),
			false,
			false,
			array("VALUE", "PROP_TYPE", "VARIANT_NAME", "SORT", "ORDER_PROPS_ID")
		);
		if ($arUserPropsValues = $dbUserPropsValues->Fetch())
		{
			$valueTmp = "";
			if ($arUserPropsValues["PROP_TYPE"] == "MULTISELECT")
			{
				$arUserPropsValues["VALUE"] = explode(",", $arUserPropsValues["VALUE"]);
			}
			$curVal = $arUserPropsValues["VALUE"];

			if(CSaleLocation::isLocationProMigrated())
			{
				if($arProperties['TYPE'] == 'LOCATION')
					$curVal = CSaleLocation::getLocationIDbyCODE($curVal);
			}
		}
	}
	elseif($arUserResult["PROFILE_CHANGE"] == "Y" && intval($arUserResult["PROFILE_ID"]) <= 0)
	{
		if (isset($curVal))
			unset($curVal);
	}
	elseif(isset($arUserResult["ORDER_PROP"][$arProperties["ID"]]))
		$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	elseif($arResult["HAVE_PREPAYMENT"] && !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]]))
	{
		$curVal = $arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]];
		if($arProperties["TYPE"] == "LOCATION")
			$curLocation = $curVal;
	}

	if (intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]) > 0)
		$curVal = intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]);

	$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"];

	if(strlen($arProperties["CODE"]) > 0)
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["CODE"];
	else
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["ID"];

	if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID || $propertyUSER_PROPS != $arProperties["USER_PROPS"])
		$arProperties["SHOW_GROUP_NAME"] = "Y";

	$propertyGroupID = $arProperties["PROPS_GROUP_ID"];
	$propertyUSER_PROPS = $arProperties["USER_PROPS"];

	if ($arProperties["REQUIED"]=="Y" || $arProperties["IS_EMAIL"]=="Y" || $arProperties["IS_PROFILE_NAME"]=="Y" || $arProperties["IS_LOCATION"]=="Y" || $arProperties["IS_LOCATION4TAX"]=="Y" || $arProperties["IS_PAYER"]=="Y" || $arProperties["IS_ZIP"]=="Y")
		$arProperties["REQUIED_FORMATED"]="Y";

	if ($arProperties["TYPE"] == "CHECKBOX")
	{
		if ($curVal=="Y" || !isset($curVal) && $arProperties["DEFAULT_VALUE"]=="Y")
		{
			$arProperties["CHECKED"] = "Y";
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_Y");
		}
		else
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_N");

		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 30);
	}
	elseif ($arProperties["TYPE"] == "TEXT")
	{
		if (strlen($curVal) <= 0)
		{
			if(strlen($arProperties["DEFAULT_VALUE"])>0 && !isset($curVal))
				$arProperties["VALUE"] = $arProperties["DEFAULT_VALUE"];
			elseif ($arProperties["IS_EMAIL"] == "Y")
				$arProperties["VALUE"] = $USER->GetEmail();
			elseif ($arProperties["IS_PAYER"] == "Y")
			{
				//$arProperties["VALUE"] = $USER->GetFullName();
				$rsUser = CUser::GetByID($USER->GetID());
				$fio = "";
				if ($arUser = $rsUser->Fetch())
				{
					$fio = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"]), false, false);
				}
				$arProperties["VALUE"] = $fio;
			}

			$arProperties["SOURCE"] = 'DEFAULT';
		}
		else
		{
			$arProperties["VALUE"] = $curVal;
			$arProperties["SOURCE"] = 'FORM';
		}

		//select ZIP for LOCATION
		if ($arProperties["IS_ZIP"] == "Y" && $arUserResult["PROFILE_CHANGE"] == "N")
		{
			$dbPropertiesLoc = CSaleOrderProps::GetList(
					array("ID" => "DESC"),
					array(
						"PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"],
						"ACTIVE" => "Y",
						"UTIL" => "N",
						"IS_LOCATION" => "Y"
						),
					false,
					false,
					array("ID")
				);
			$arPropertiesLoc = $dbPropertiesLoc->Fetch();

			if ($arPropertiesLoc["ID"] > 0)
			{
				$arZipLocation = array();
				if(strlen($curVal) > 0)
					$arZipLocation = CSaleLocation::GetByZIP($curVal);

				$rsZipList = CSaleLocation::GetLocationZIP($arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]);
				if($arZip = $rsZipList->Fetch())
				{
					if (strlen($arZip["ZIP"]) > 0 && (empty($arZipLocation) || $arZipLocation["ID"] != $arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]))
						$arProperties["VALUE"] = $arZip["ZIP"];
				}
			}
		}

		if ($arProperties["IS_ZIP"]=="Y")
			$arUserResult["DELIVERY_LOCATION_ZIP"] = $arProperties["VALUE"];


		$arProperties["VALUE"] = htmlspecialcharsEx($arProperties["VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];

	}
	elseif ($arProperties["TYPE"] == "SELECT")
	{
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC", "NAME" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")

		);
		$flagDefault = "N";
		$nameProperty = "";
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($flagDefault == "N" && $nameProperty == "")
			{
				$nameProperty = $arVariants["NAME"];
			}
			if (($arVariants["VALUE"] == $curVal) || ((!isset($curVal) || $curVal == "") && ($arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])))
			{
				$arVariants["SELECTED"] = "Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
				$flagDefault = "Y";
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}
		if ($flagDefault == "N")
		{
			$arProperties["VARIANTS"][0]["SELECTED"]= "Y";
			$arProperties["VARIANTS"][0]["VALUE_FORMATED"] = $nameProperty;
		}
	}
	elseif ($arProperties["TYPE"] == "MULTISELECT")
	{
		$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"].'[]';
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 5);
		$arDefVal = explode(",", $arProperties["DEFAULT_VALUE"]);
		$countDefVal = count($arDefVal);
		for ($i = 0; $i < $countDefVal; $i++)
			$arDefVal[$i] = Trim($arDefVal[$i]);

		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		$i = 0;
		while ($arVariants = $dbVariants->GetNext())
		{
			if ((is_array($curVal) && in_array($arVariants["VALUE"], $curVal)) || (!isset($curVal) && in_array($arVariants["VALUE"], $arDefVal)))
			{
				$arVariants["SELECTED"] = "Y";
				if ($i > 0)
					$arProperties["VALUE_FORMATED"] .= ", ";
				$arProperties["VALUE_FORMATED"] .= $arVariants["NAME"];
				$i++;
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}
	}
	elseif ($arProperties["TYPE"] == "TEXTAREA")
	{
		$arProperties["SIZE2"] = ((intval($arProperties["SIZE2"]) > 0) ? $arProperties["SIZE2"] : 4);
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 40);
		$arProperties["VALUE"] = htmlspecialcharsEx(isset($curVal) ? $curVal : $arProperties["DEFAULT_VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];
	}
	elseif ($arProperties["TYPE"] == "LOCATION")
	{
		if(CSaleLocation::isLocationProEnabled())
		{
			if(!strlen($curVal) && strlen($arProperties["DEFAULT_VALUE"]))
				$curVal = CSaleLocation::getLocationIDbyCODE($arProperties["DEFAULT_VALUE"]);

			//enable location town text
			if ($_REQUEST["is_ajax_post"] == "Y" && $arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0 && isset($_REQUEST["ORDER_PROP_".$arProperties["ID"]]))
			{
				if(isset($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'][$arProperties["ID"]])) // look at the manual flag
				{
					if($arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'][$arProperties["ID"]]) // if it set to TRUE, show alt location
						unset($arDeleteFieldLocation[$arProperties["ID"]]);
					else
						$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"]; // otherwise, hide
				}
				else
				{
					// now we have no had-coded type-table for locations, so turn this logic on only when there is "CITY" type
					if(!CSaleLocation::checkLocationIsAboveCity($curVal))
					{
						$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"]; // remove by default
					}
					else
					{
						unset($arDeleteFieldLocation[$arProperties["ID"]]);
					}
				}
			}
			elseif ($arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0)
			{
				$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}

			$arProperties["VALUE"] = $curVal;

			#######################
			#######################
			#######################
			# here we sacrifice perfromance for the sake of compatibility

			$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];

			if($arProperties["IS_LOCATION4TAX"]=="Y")
				$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

			// variants
			$locationFound = false;
			$dbVariants = CSaleLocation::GetList(
					array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
					array("LID" => LANGUAGE_ID),
					false,
					false,
					array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG")
				);
			while ($arVariants = $dbVariants->GetNext())
			{
				if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
				{
					$locationFound = true;
					$arVariants["SELECTED"] = "Y";
					$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
				}
				$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
				$arProperties["VARIANTS"][] = $arVariants;
			}

			// this is not a COUNTRY, REGION or CITY, but must appear in $arProperties["VARIANTS"]
			if(!$locationFound && IntVal($curVal))
			{
				$item = CSaleLocation::GetById($curVal);
				if($item)
				{
					$item['NAME'] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
					$item['SELECTED'] = 'Y';
					$arProperties["VARIANTS"][] = $item;
				}
			}
		}
		else
		{
			//enable location town text
			if ($_REQUEST["is_ajax_post"] == "Y" && $arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0 && isset($_REQUEST["ORDER_PROP_".$arProperties["ID"]]))
			{
				$rsLocationsList = CSaleLocation::GetList(
					array(),
					array("ID" => $curVal),
					false,
					false,
					array("ID", "CITY_ID")
				);
				$arCity = $rsLocationsList->GetNext();

				if (intval($arCity["CITY_ID"]) <= 0)
					unset($arDeleteFieldLocation[$arProperties["ID"]]);
				else
					$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}
			elseif ($arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0)
			{
				$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}

			$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
			$dbVariants = CSaleLocation::GetList(
					array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
					array("LID" => LANGUAGE_ID),
					false,
					false,
					array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG")
				);
			while ($arVariants = $dbVariants->GetNext())
			{
				if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
				{
					$arVariants["SELECTED"] = "Y";
					$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
					$arProperties["VALUE"] = $arVariants["ID"];

					if ($arProperties["IS_LOCATION"]=="Y")
						$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
					if ($arProperties["IS_LOCATION4TAX"]=="Y")
						$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

				}
				$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
				$arProperties["VARIANTS"][] = $arVariants;
			}
			if(count($arProperties["VARIANTS"]) == 1)
			{
				$arProperties["VALUE"] = $arProperties["VARIANTS"][0]["ID"];
				if($arProperties["IS_LOCATION"]=="Y")
					$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
				if($arProperties["IS_LOCATION4TAX"]=="Y")
					$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];
			}
		}
	}
	elseif ($arProperties["TYPE"] == "RADIO")
	{
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($arVariants["VALUE"] == $curVal || (!isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"]))
			{
				$arVariants["CHECKED"]="Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
			}

			$arProperties["VARIANTS"][] = $arVariants;
		}
	}
	elseif ($arProperties["TYPE"] == "FILE")
	{
		$arProperties["SIZE1"] = intval($arProperties["SIZE1"]);
		$arProperties["VALUE"] = isset($curVal) ? CSaleHelper::getFileInfo($curVal) : $arProperties["DEFAULT_VALUE"];
	}

	return $arProperties;
}
示例#7
0
    function ExportOrders2Xml($arFilter = array(), $nTopCount = 0, $currency = "", $crmMode = false, $time_limit = 0, $version = false, $arOptions = array())
    {
        global $DB;
        $count = false;
        if (IntVal($nTopCount) > 0) {
            $count = array("nTopCount" => $nTopCount);
        }
        $bNewVersion = strlen($version) > 0;
        $bExportFromCrm = isset($arOptions["EXPORT_FROM_CRM"]) && $arOptions["EXPORT_FROM_CRM"] === "Y";
        if (IntVal($time_limit) > 0) {
            //This is an optimization. We assume than no step can take more than one year.
            if ($time_limit > 0) {
                $end_time = time() + $time_limit;
            } else {
                $end_time = time() + 365 * 24 * 3600;
            }
            // One year
            //$version
            $lastOrderPrefix = "LAST_ORDER_ID";
            if ($crmMode) {
                $lastOrderPrefix = md5(serialize($arFilter));
                if (!empty($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && IntVal($nTopCount) > 0) {
                    $count["nTopCount"] = $count["nTopCount"] + count($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]);
                }
            } else {
                if (IntVal($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) > 0) {
                    $arFilter["<ID"] = $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix];
                }
            }
        }
        $arResultStat = array("ORDERS" => 0, "CONTACTS" => 0, "COMPANIES" => 0);
        $accountNumberPrefix = COption::GetOptionString("sale", "1C_SALE_ACCOUNT_NUMBER_SHOP_PREFIX", "");
        $dbPaySystem = CSalePaySystem::GetList(array("ID" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME", "ACTIVE"));
        while ($arPaySystem = $dbPaySystem->Fetch()) {
            $paySystems[$arPaySystem["ID"]] = $arPaySystem["NAME"];
        }
        $dbDelivery = CSaleDelivery::GetList(array("ID" => "ASC"), array("ACTIVE" => "Y"), false, false, array("ID", "NAME", "ACTIVE"));
        while ($arDelivery = $dbDelivery->Fetch()) {
            $delivery[$arDelivery["ID"]] = $arDelivery["NAME"];
        }
        $rsDeliveryHandlers = CSaleDeliveryHandler::GetAdminList(array("SID" => "ASC"));
        while ($arHandler = $rsDeliveryHandlers->Fetch()) {
            if (is_array($arHandler["PROFILES"])) {
                foreach ($arHandler["PROFILES"] as $k => $v) {
                    $delivery[$arHandler["SID"] . ":" . $k] = $v["TITLE"] . " (" . $arHandler["NAME"] . ")";
                }
            }
        }
        $arStore = array();
        $arMeasures = array();
        if (CModule::IncludeModule("catalog")) {
            $dbList = CCatalogStore::GetList(array("SORT" => "DESC", "ID" => "ASC"), array("ACTIVE" => "Y", "ISSUING_CENTER" => "Y"), false, false, array("ID", "SORT", "TITLE", "ADDRESS", "DESCRIPTION", "PHONE", "EMAIL", "XML_ID"));
            while ($arStoreTmp = $dbList->Fetch()) {
                if (strlen($arStoreTmp["XML_ID"]) <= 0) {
                    $arStoreTmp["XML_ID"] = $arStoreTmp["ID"];
                }
                $arStore[$arStoreTmp["ID"]] = $arStoreTmp;
            }
            $dbList = CCatalogMeasure::getList(array(), array(), false, false, array("CODE", "MEASURE_TITLE"));
            while ($arList = $dbList->Fetch()) {
                $arMeasures[$arList["CODE"]] = $arList["MEASURE_TITLE"];
            }
        }
        if (empty($arMeasures)) {
            $arMeasures[796] = GetMessage("SALE_EXPORT_SHTUKA");
        }
        $dbExport = CSaleExport::GetList();
        while ($arExport = $dbExport->Fetch()) {
            $arAgent[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
        }
        $dateFormat = CSite::GetDateFormat("FULL");
        if ($crmMode) {
            echo "<" . "?xml version=\"1.0\" encoding=\"UTF-8\"?" . ">\n";
            $arCharSets = array();
            $dbSitesList = CSite::GetList($b = "", $o = "");
            while ($arSite = $dbSitesList->Fetch()) {
                $arCharSets[$arSite["ID"]] = $arSite["CHARSET"];
            }
        } else {
            echo "<" . "?xml version=\"1.0\" encoding=\"windows-1251\"?" . ">\n";
        }
        ?>
		<<?php 
        echo GetMessage("SALE_EXPORT_COM_INFORMATION");
        ?>
 <?php 
        echo GetMessage("SALE_EXPORT_SHEM_VERSION");
        ?>
="<?php 
        echo $bNewVersion ? "2.08" : "2.05";
        ?>
" <?php 
        echo GetMessage("SALE_EXPORT_SHEM_DATE_CREATE");
        ?>
="<?php 
        echo date("Y-m-d");
        ?>
T<?php 
        echo date("G:i:s");
        ?>
" <?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT");
        ?>
="<?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
        ?>
=yyyy-MM-dd; <?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
        ?>
=DT" <?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_DATETIME");
        ?>
="<?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
        ?>
=<?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_TIME");
        ?>
; <?php 
        echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
        ?>
=T" <?php 
        echo GetMessage("SALE_EXPORT_DEL_DT");
        ?>
="T" <?php 
        echo GetMessage("SALE_EXPORT_FORM_SUMM");
        ?>
="<?php 
        echo GetMessage("SALE_EXPORT_FORM_CC");
        ?>
=18; <?php 
        echo GetMessage("SALE_EXPORT_FORM_CDC");
        ?>
=2; <?php 
        echo GetMessage("SALE_EXPORT_FORM_CRD");
        ?>
=." <?php 
        echo GetMessage("SALE_EXPORT_FORM_QUANT");
        ?>
="<?php 
        echo GetMessage("SALE_EXPORT_FORM_CC");
        ?>
=18; <?php 
        echo GetMessage("SALE_EXPORT_FORM_CDC");
        ?>
=2; <?php 
        echo GetMessage("SALE_EXPORT_FORM_CRD");
        ?>
=.">
		<?php 
        $arOrder = array("ID" => "DESC");
        if ($crmMode) {
            $arOrder = array("DATE_UPDATE" => "ASC");
        }
        $arSelect = array("ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "EMP_PAYED_ID", "CANCELED", "DATE_CANCELED", "EMP_CANCELED_ID", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "EMP_STATUS_ID", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "SUM_PAID", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION", "ADDITIONAL_INFO", "PS_STATUS", "PS_STATUS_CODE", "PS_STATUS_DESCRIPTION", "PS_STATUS_MESSAGE", "PS_SUM", "PS_CURRENCY", "PS_RESPONSE_DATE", "COMMENTS", "TAX_VALUE", "STAT_GID", "RECURRING_ID", "ACCOUNT_NUMBER", "SUM_PAID", "DELIVERY_DOC_DATE", "DELIVERY_DOC_NUM", "TRACKING_NUMBER", "STORE_ID", "ID_1C", "VERSION");
        $bCrmModuleIncluded = false;
        if ($bExportFromCrm) {
            $arSelect[] = "UF_COMPANY_ID";
            $arSelect[] = "UF_CONTACT_ID";
            if (IsModuleInstalled("crm") && CModule::IncludeModule("crm")) {
                $bCrmModuleIncluded = true;
            }
        }
        $dbOrderList = CSaleOrder::GetList($arOrder, $arFilter, false, $count, $arSelect);
        while ($arOrder = $dbOrderList->Fetch()) {
            if ($crmMode) {
                if ($bNewVersion && is_array($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && in_array($arOrder["ID"], $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && empty($arFilter["ID"])) {
                    continue;
                }
                ob_start();
            }
            $arResultStat["ORDERS"]++;
            $agentParams = $arAgent[$arOrder["PERSON_TYPE_ID"]];
            $arProp = array();
            $arProp["ORDER"] = $arOrder;
            if (IntVal($arOrder["USER_ID"]) > 0) {
                $dbUser = CUser::GetByID($arOrder["USER_ID"]);
                if ($arUser = $dbUser->Fetch()) {
                    $arProp["USER"] = $arUser;
                }
            }
            if ($bExportFromCrm) {
                $arProp["CRM"] = array();
                $companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
                $contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
                if ($companyID > 0) {
                    $arProp["CRM"]["CLIENT_ID"] = "CRMCO" . $companyID;
                } else {
                    $arProp["CRM"]["CLIENT_ID"] = "CRMC" . $contactID;
                }
                $clientInfo = array("LOGIN" => "", "NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "");
                if ($bCrmModuleIncluded) {
                    if ($companyID > 0) {
                        $arCompanyFilter = array('=ID' => $companyID);
                        $dbCompany = CCrmCompany::GetListEx(array(), $arCompanyFilter, false, array("nTopCount" => 1), array("TITLE"));
                        $arCompany = $dbCompany->Fetch();
                        unset($dbCompany, $arCompanyFilter);
                        if (is_array($arCompany)) {
                            if (isset($arCompany["TITLE"])) {
                                $clientInfo["NAME"] = $arCompany["TITLE"];
                            }
                        }
                        unset($arCompany);
                    } else {
                        if ($contactID > 0) {
                            $arContactFilter = array('=ID' => $contactID);
                            $dbContact = CCrmContact::GetListEx(array(), $arContactFilter, false, array("nTopCount" => 1), array("NAME", "LAST_NAME", "SECOND_NAME"));
                            $arContact = $dbContact->Fetch();
                            unset($dbContact, $arContactFilter);
                            if (is_array($arContact)) {
                                if (isset($arContact["NAME"])) {
                                    $clientInfo["NAME"] = $arContact["NAME"];
                                }
                                if (isset($arContact["LAST_NAME"])) {
                                    $clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
                                }
                                if (isset($arContact["SECOND_NAME"])) {
                                    $clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
                                }
                            }
                            unset($arContact);
                        }
                    }
                }
                $arProp["CRM"]["CLIENT"] = $clientInfo;
                unset($clientInfo);
            }
            if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) {
                $arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
            }
            if (strlen($arOrder["DELIVERY_ID"]) > 0) {
                $arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];
            }
            $dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
            $locationStreetPropertyValue = '';
            while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
                if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX") {
                    if ($arOrderPropVals["VALUE"] == "Y") {
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
                    } else {
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
                    }
                } elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA") {
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
                } elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO") {
                    $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
                } elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT") {
                    $curVal = explode(",", $arOrderPropVals["VALUE"]);
                    foreach ($curVal as $vm) {
                        $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
                        $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .= ", " . $arVal["NAME"];
                    }
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
                } elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION") {
                    $arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
                    if (CSaleLocation::isLocationProEnabled()) {
                        if (intval($arVal['ID'])) {
                            try {
                                $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($arVal['ID'], array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
                                $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
                                $path = array();
                                while ($item = $res->fetch()) {
                                    // copy street to STREET property
                                    if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
                                        $locationStreetPropertyValue = $item['LNAME'];
                                    }
                                    $path[] = $item['LNAME'];
                                }
                                $locationString = implode(' - ', $path);
                            } catch (\Bitrix\Main\SystemException $e) {
                                $locationString = '';
                            }
                        } else {
                            $locationString = '';
                        }
                    } else {
                        $locationString = $arVal["COUNTRY_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["REGION_NAME"]) <= 0 ? "" : " - ") . $arVal["REGION_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["CITY_NAME"]) <= 0 ? "" : " - ") . $arVal["CITY_NAME"];
                    }
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $locationString;
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_CITY"] = $arVal["CITY_NAME"];
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_COUNTRY"] = $arVal["COUNTRY_NAME"];
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_REGION"] = $arVal["REGION_NAME"];
                } else {
                    $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
                }
            }
            $resShipment = \Bitrix\Sale\Internals\ShipmentTable::getList(array('select' => array('DELIVERY_ID', 'ALLOW_DELIVERY', 'DEDUCTED', 'DATE_ALLOW_DELIVERY', 'DATE_DEDUCTED'), 'filter' => array('ORDER_ID' => $arOrder['ID'], '=SYSTEM' => 'N'), 'limit' => array(1)));
            $arShipment = $resShipment->fetch();
            $resPayment = \Bitrix\Sale\Internals\PaymentTable::getList(array('select' => array('PAY_VOUCHER_NUM', 'PAY_SYSTEM_ID', 'PAY_VOUCHER_DATE'), 'filter' => array('ORDER_ID' => $arOrder['ID'], '!PAY_SYSTEM_ID' => \Bitrix\Sale\Internals\PaySystemInner::getId()), 'limit' => array(1)));
            $arPayment = $resPayment->fetch();
            foreach ($agentParams as $k => $v) {
                if (strpos($k, "REKV_") !== false) {
                    if (!is_array($v)) {
                        $agent["REKV"][$k] = $v;
                    } else {
                        if (strlen($v["TYPE"]) <= 0) {
                            $agent["REKV"][$k] = $v["VALUE"];
                        } else {
                            $agent["REKV"][$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
                        }
                    }
                } else {
                    if (!is_array($v)) {
                        $agent[$k] = $v;
                    } else {
                        if (strlen($v["TYPE"]) <= 0) {
                            $agent[$k] = $v["VALUE"];
                        } else {
                            $agent[$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
                        }
                        if ($k == 'STREET' && strlen($locationStreetPropertyValue)) {
                            $agent[$k] = $locationStreetPropertyValue . (strlen($agent[$k]) ? ', ' : '') . $agent[$k];
                        }
                    }
                }
            }
            ?>
			<<?php 
            echo GetMessage("SALE_EXPORT_DOCUMENT");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_ID");
            ?>
><?php 
            echo $arOrder["ID"];
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ID");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_NUMBER");
            ?>
><?php 
            echo $accountNumberPrefix . $arOrder["ACCOUNT_NUMBER"];
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_NUMBER");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_DATE");
            ?>
><?php 
            echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "YYYY-MM-DD");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_DATE");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_ITEM_ORDER");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_ROLE");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_SELLER");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ROLE");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_CURRENCY");
            ?>
><?php 
            echo htmlspecialcharsbx(strlen($currency) > 0 ? substr($currency, 0, 3) : substr($arOrder["CURRENCY"], 0, 3));
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_CURRENCY");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
            ?>
>1</<?php 
            echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_AMOUNT");
            ?>
><?php 
            echo $arOrder["PRICE"];
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_AMOUNT");
            ?>
>
				<?php 
            if ($bNewVersion) {
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_VERSION");
                ?>
><?php 
                echo IntVal($arOrder["VERSION"]) > 0 ? $arOrder["VERSION"] : 0;
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VERSION");
                ?>
>
					<?php 
                if (strlen($arOrder["ID_1C"]) > 0) {
                    ?>
<<?php 
                    echo GetMessage("SALE_EXPORT_ID_1C");
                    ?>
><?php 
                    echo htmlspecialcharsbx($arOrder["ID_1C"]);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_ID_1C");
                    ?>
><?php 
                }
            }
            if ($crmMode) {
                ?>
<DateUpdate><?php 
                echo $DB->FormatDate($arOrder["DATE_UPDATE"], $dateFormat, "YYYY-MM-DD HH:MI:SS");
                ?>
</DateUpdate><?php 
            }
            $deliveryAdr = CSaleExport::ExportContragents($arOrder, $arProp, $agent, $arResultStat, $bNewVersion, $bExportFromCrm ? array("EXPORT_FROM_CRM" => "Y") : array());
            ?>
				<<?php 
            echo GetMessage("SALE_EXPORT_TIME");
            ?>
><?php 
            echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "HH:MI:SS");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_TIME");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_COMMENTS");
            ?>
><?php 
            echo htmlspecialcharsbx($arOrder["COMMENTS"]);
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_COMMENTS");
            ?>
>
				<?php 
            $dbOrderTax = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE"));
            $i = -1;
            $orderTax = 0;
            while ($arOrderTax = $dbOrderTax->Fetch()) {
                $arOrderTax["VALUE_MONEY"] = roundEx($arOrderTax["VALUE_MONEY"], 2);
                $orderTax += $arOrderTax["VALUE_MONEY"];
                $i++;
                if ($i == 0) {
                    echo "<" . GetMessage("SALE_EXPORT_TAXES") . ">";
                }
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_TAX");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo htmlspecialcharsbx($arOrderTax["TAX_NAME"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_IN_PRICE");
                ?>
><?php 
                echo $arOrderTax["IS_IN_PRICE"] == "Y" ? "true" : "false";
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_IN_PRICE");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
><?php 
                echo $arOrderTax["VALUE_MONEY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
>
					</<?php 
                echo GetMessage("SALE_EXPORT_TAX");
                ?>
>
					<?php 
            }
            if ($i != -1) {
                echo "</" . GetMessage("SALE_EXPORT_TAXES") . ">";
            }
            ?>
				<?php 
            if (DoubleVal($arOrder["DISCOUNT_VALUE"]) > 0) {
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_DISCOUNTS");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_DISCOUNT");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_ORDER_DISCOUNT");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
><?php 
                echo $arOrder["DISCOUNT_VALUE"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_IN_PRICE");
                ?>
>false</<?php 
                echo GetMessage("SALE_EXPORT_IN_PRICE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_DISCOUNT");
                ?>
>
					</<?php 
                echo GetMessage("SALE_EXPORT_DISCOUNTS");
                ?>
>
					<?php 
            }
            $storeBasket = "";
            if (IntVal($arOrder["STORE_ID"]) > 0 && !empty($arStore[$arOrder["STORE_ID"]])) {
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_STORIES");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_STORY");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
><?php 
                echo $arStore[$arOrder["STORE_ID"]]["XML_ID"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ADDRESS");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_PRESENTATION");
                ?>
><?php 
                echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_PRESENTATION");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
                ?>
>
									<<?php 
                echo GetMessage("SALE_EXPORT_TYPE");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_STREET");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_TYPE");
                ?>
>
									<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
								</<?php 
                echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_ADDRESS");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_CONTACTS");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_CONTACT");
                ?>
>
									<<?php 
                echo GetMessage("SALE_EXPORT_TYPE");
                ?>
><?php 
                echo $bNewVersion ? GetMessage("SALE_EXPORT_WORK_PHONE_NEW") : GetMessage("SALE_EXPORT_WORK_PHONE");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_TYPE");
                ?>
>
									<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["PHONE"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
								</<?php 
                echo GetMessage("SALE_EXPORT_CONTACT");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_CONTACTS");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_STORY");
                ?>
>
					</<?php 
                echo GetMessage("SALE_EXPORT_STORIES");
                ?>
>
					<?php 
                /*
                $storeBasket = "				
                	<".GetMessage("SALE_EXPORT_STORIES").">
                		<".GetMessage("SALE_EXPORT_STORY").">
                			<".GetMessage("SALE_EXPORT_ID").">".$arStore[$arOrder["STORE_ID"]]["XML_ID"]."</".GetMessage("SALE_EXPORT_ID").">
                			<".GetMessage("SALE_EXPORT_ITEM_NAME").">".htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"])."</".GetMessage("SALE_EXPORT_ITEM_NAME").">
                		</".GetMessage("SALE_EXPORT_STORY").">
                	</".GetMessage("SALE_EXPORT_STORIES").">
                	";
                */
            }
            ?>
				<<?php 
            echo GetMessage("SALE_EXPORT_ITEMS");
            ?>
>
				<?php 
            $dbBasket = \Bitrix\Sale\Internals\BasketTable::getList(array('select' => array("ID", "NOTES", "PRODUCT_XML_ID", "CATALOG_XML_ID", "NAME", "PRICE", "QUANTITY", "DISCOUNT_PRICE", "VAT_RATE", "MEASURE_CODE"), 'filter' => array("ORDER_ID" => $arOrder["ID"]), 'order' => array("NAME" => "ASC")));
            $basketSum = 0;
            $priceType = "";
            $bVat = false;
            $vatRate = 0;
            $vatSum = 0;
            while ($arBasket = $dbBasket->fetch()) {
                if (strlen($priceType) <= 0) {
                    $priceType = $arBasket["NOTES"];
                }
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
><?php 
                echo htmlspecialcharsbx($arBasket["PRODUCT_XML_ID"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_CATALOG_ID");
                ?>
><?php 
                echo htmlspecialcharsbx($arBasket["CATALOG_XML_ID"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_CATALOG_ID");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo htmlspecialcharsbx($arBasket["NAME"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
						<?php 
                if ($bNewVersion) {
                    if (IntVal($arBasket["MEASURE_CODE"]) <= 0) {
                        $arBasket["MEASURE_CODE"] = 796;
                    }
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_UNIT");
                    ?>
>
								<<?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
><?php 
                    echo $arBasket["MEASURE_CODE"];
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
>
								<<?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
><?php 
                    echo htmlspecialcharsbx($arMeasures[$arBasket["MEASURE_CODE"]]);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
>
							</<?php 
                    echo GetMessage("SALE_EXPORT_UNIT");
                    ?>
>
							<<?php 
                    echo GetMessage("SALE_EXPORT_KOEF");
                    ?>
>1</<?php 
                    echo GetMessage("SALE_EXPORT_KOEF");
                    ?>
>
							<?php 
                } else {
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_BASE_UNIT");
                    ?>
 <?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
="796" <?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
="<?php 
                    echo GetMessage("SALE_EXPORT_SHTUKA");
                    ?>
" <?php 
                    echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
                    ?>
="<?php 
                    echo GetMessage("SALE_EXPORT_RCE");
                    ?>
"><?php 
                    echo GetMessage("SALE_EXPORT_SHT");
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_BASE_UNIT");
                    ?>
>
							<?php 
                }
                if (DoubleVal($arBasket["DISCOUNT_PRICE"]) > 0) {
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_DISCOUNTS");
                    ?>
>
								<<?php 
                    echo GetMessage("SALE_EXPORT_DISCOUNT");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
><?php 
                    echo GetMessage("SALE_EXPORT_ITEM_DISCOUNT");
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_AMOUNT");
                    ?>
><?php 
                    echo $arBasket["DISCOUNT_PRICE"];
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_AMOUNT");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_IN_PRICE");
                    ?>
>true</<?php 
                    echo GetMessage("SALE_EXPORT_IN_PRICE");
                    ?>
>
								</<?php 
                    echo GetMessage("SALE_EXPORT_DISCOUNT");
                    ?>
>
							</<?php 
                    echo GetMessage("SALE_EXPORT_DISCOUNTS");
                    ?>
>
							<?php 
                }
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
                ?>
><?php 
                echo $arBasket["PRICE"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_QUANTITY");
                ?>
><?php 
                echo $arBasket["QUANTITY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_QUANTITY");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
><?php 
                echo $arBasket["PRICE"] * $arBasket["QUANTITY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<?php 
                $dbProp = CSaleBasket::GetPropsList(array("SORT" => "ASC", "ID" => "ASC"), array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")), false, false, array("NAME", "VALUE", "CODE"));
                while ($arProp = $dbProp->Fetch()) {
                    ?>
								<<?php 
                    echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
><?php 
                    echo htmlspecialcharsbx($arProp["NAME"]);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_VALUE");
                    ?>
><?php 
                    echo htmlspecialcharsbx($arProp["VALUE"]);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_VALUE");
                    ?>
>
								</<?php 
                    echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                    ?>
>
								<?php 
                }
                ?>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
                ?>
>
						<?php 
                if (DoubleVal($arBasket["VAT_RATE"]) > 0) {
                    $bVat = true;
                    $vatRate = DoubleVal($arBasket["VAT_RATE"]);
                    $basketVatSum = $arBasket["PRICE"] / ($arBasket["VAT_RATE"] + 1) * $arBasket["VAT_RATE"];
                    $vatSum += roundEx($basketVatSum * $arBasket["QUANTITY"], 2);
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_TAX_RATES");
                    ?>
>
								<<?php 
                    echo GetMessage("SALE_EXPORT_TAX_RATE");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
><?php 
                    echo GetMessage("SALE_EXPORT_VAT");
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_RATE");
                    ?>
><?php 
                    echo $arBasket["VAT_RATE"] * 100;
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_RATE");
                    ?>
>
								</<?php 
                    echo GetMessage("SALE_EXPORT_TAX_RATE");
                    ?>
>
							</<?php 
                    echo GetMessage("SALE_EXPORT_TAX_RATES");
                    ?>
>
							<<?php 
                    echo GetMessage("SALE_EXPORT_TAXES");
                    ?>
>
								<<?php 
                    echo GetMessage("SALE_EXPORT_TAX");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
><?php 
                    echo GetMessage("SALE_EXPORT_VAT");
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_ITEM_NAME");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_IN_PRICE");
                    ?>
>true</<?php 
                    echo GetMessage("SALE_EXPORT_IN_PRICE");
                    ?>
>
									<<?php 
                    echo GetMessage("SALE_EXPORT_AMOUNT");
                    ?>
><?php 
                    echo roundEx($basketVatSum, 2);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_AMOUNT");
                    ?>
>
								</<?php 
                    echo GetMessage("SALE_EXPORT_TAX");
                    ?>
>
							</<?php 
                    echo GetMessage("SALE_EXPORT_TAXES");
                    ?>
>
							<?php 
                }
                ?>
						<?php 
                echo $storeBasket;
                ?>
					</<?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
>
					<?php 
                $basketSum += $arBasket["PRICE"] * $arBasket["QUANTITY"];
            }
            if (IntVal($arOrder["PRICE_DELIVERY"]) > 0) {
                ?>
					<<?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
>ORDER_DELIVERY</<?php 
                echo GetMessage("SALE_EXPORT_ID");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_ORDER_DELIVERY");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
						<?php 
                if ($bNewVersion) {
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_UNIT");
                    ?>
>
							<<?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
>796</<?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
>
							<<?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
><?php 
                    echo htmlspecialcharsbx($arMeasures[796]);
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
>
							</<?php 
                    echo GetMessage("SALE_EXPORT_UNIT");
                    ?>
>
							<<?php 
                    echo GetMessage("SALE_EXPORT_KOEF");
                    ?>
>1</<?php 
                    echo GetMessage("SALE_EXPORT_KOEF");
                    ?>
>
						<?php 
                } else {
                    ?>
							<<?php 
                    echo GetMessage("SALE_EXPORT_BASE_UNIT");
                    ?>
 <?php 
                    echo GetMessage("SALE_EXPORT_CODE");
                    ?>
="796" <?php 
                    echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
                    ?>
="<?php 
                    echo GetMessage("SALE_EXPORT_SHTUKA");
                    ?>
" <?php 
                    echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
                    ?>
="<?php 
                    echo GetMessage("SALE_EXPORT_RCE");
                    ?>
"><?php 
                    echo GetMessage("SALE_EXPORT_SHT");
                    ?>
</<?php 
                    echo GetMessage("SALE_EXPORT_BASE_UNIT");
                    ?>
>
						<?php 
                }
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
                ?>
><?php 
                echo $arOrder["PRICE_DELIVERY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_QUANTITY");
                ?>
>1</<?php 
                echo GetMessage("SALE_EXPORT_QUANTITY");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
><?php 
                echo $arOrder["PRICE_DELIVERY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_AMOUNT");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_SERVICE");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
								<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_SERVICE");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
							</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
                ?>
>
						<?php 
                if ($bVat) {
                    $deliveryTax = roundEx($arOrder["PRICE_DELIVERY"] / ($vatRate + 1) * $vatRate, 2);
                    if ($orderTax > $vatSum && $orderTax == roundEx($vatSum + $deliveryTax, 2)) {
                        ?>
								<<?php 
                        echo GetMessage("SALE_EXPORT_TAX_RATES");
                        ?>
>
									<<?php 
                        echo GetMessage("SALE_EXPORT_TAX_RATE");
                        ?>
>
										<<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
><?php 
                        echo GetMessage("SALE_EXPORT_VAT");
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
>
										<<?php 
                        echo GetMessage("SALE_EXPORT_RATE");
                        ?>
><?php 
                        echo $vatRate * 100;
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_RATE");
                        ?>
>
									</<?php 
                        echo GetMessage("SALE_EXPORT_TAX_RATE");
                        ?>
>
								</<?php 
                        echo GetMessage("SALE_EXPORT_TAX_RATES");
                        ?>
>
								<<?php 
                        echo GetMessage("SALE_EXPORT_TAXES");
                        ?>
>
									<<?php 
                        echo GetMessage("SALE_EXPORT_TAX");
                        ?>
>
										<<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
><?php 
                        echo GetMessage("SALE_EXPORT_VAT");
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
>
										<<?php 
                        echo GetMessage("SALE_EXPORT_IN_PRICE");
                        ?>
>true</<?php 
                        echo GetMessage("SALE_EXPORT_IN_PRICE");
                        ?>
>
										<<?php 
                        echo GetMessage("SALE_EXPORT_AMOUNT");
                        ?>
><?php 
                        echo $deliveryTax;
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_AMOUNT");
                        ?>
>
									</<?php 
                        echo GetMessage("SALE_EXPORT_TAX");
                        ?>
>
								</<?php 
                        echo GetMessage("SALE_EXPORT_TAXES");
                        ?>
>
								<?php 
                    }
                }
                ?>
					</<?php 
                echo GetMessage("SALE_EXPORT_ITEM");
                ?>
>
					<?php 
            }
            ?>
				</<?php 
            echo GetMessage("SALE_EXPORT_ITEMS");
            ?>
>
				<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
            ?>
>
					<?php 
            if (strlen($arOrder["DATE_PAYED"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DATE_PAID");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo $arOrder["DATE_PAYED"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (strlen($arPayment["PAY_VOUCHER_NUM"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_PAY_NUMBER");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arPayment["PAY_VOUCHER_NUM"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (IntVal($arPayment["PAY_SYSTEM_ID"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_PAY_SYSTEM");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($paySystems[$arPayment["PAY_SYSTEM_ID"]]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_PAY_SYSTEM_ID");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arPayment["PAY_SYSTEM_ID"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (strlen($arShipment["DATE_ALLOW_DELIVERY"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DATE_ALLOW_DELIVERY");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo $arShipment["DATE_ALLOW_DELIVERY"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (strlen($arShipment["DELIVERY_ID"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DELIVERY_SERVICE");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($delivery[$arShipment["DELIVERY_ID"]]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            ?>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_ORDER_PAID");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            echo $arOrder["PAYED"] == "Y" ? "true" : "false";
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_ALLOW_DELIVERY");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            echo $arShipment["ALLOW_DELIVERY"] == "Y" ? "true" : "false";
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_CANCELED");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            echo $arOrder["CANCELED"] == "Y" ? "true" : "false";
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_FINAL_STATUS");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            echo $arOrder["STATUS_ID"] == "F" ? "true" : "false";
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_ORDER_STATUS");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            $arStatus = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]);
            echo htmlspecialcharsbx("[" . $arOrder["STATUS_ID"] . "] " . $arStatus["NAME"]);
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_ORDER_STATUS_ID");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
					<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
><?php 
            echo htmlspecialcharsbx($arOrder["STATUS_ID"]);
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<?php 
            if (strlen($arOrder["DATE_CANCELED"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DATE_CANCEL");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo $arOrder["DATE_CANCELED"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_CANCEL_REASON");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arOrder["REASON_CANCELED"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (strlen($arOrder["DATE_STATUS"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DATE_STATUS");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo $arOrder["DATE_STATUS"];
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            if (strlen($arOrder["USER_DESCRIPTION"]) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_USER_DESCRIPTION");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
							<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($arOrder["USER_DESCRIPTION"]);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<?php 
            }
            $dbSite = CSite::GetByID($arOrder["LID"]);
            $arSite = $dbSite->Fetch();
            ?>
					<<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
><?php 
            echo GetMessage("SALE_EXPORT_SITE_NAME");
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_ITEM_NAME");
            ?>
>
						<<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>[<?php 
            echo $arOrder["LID"];
            ?>
] <?php 
            echo htmlspecialcharsbx($arSite["NAME"]);
            ?>
</<?php 
            echo GetMessage("SALE_EXPORT_VALUE");
            ?>
>
					</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
            ?>
>
					<?php 
            if (!empty($agent["REKV"])) {
                foreach ($agent["REKV"] as $k => $v) {
                    if (strlen($agentParams[$k]["NAME"]) > 0 && strlen($v) > 0) {
                        ?>
								<<?php 
                        echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                        ?>
>
									<<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
><?php 
                        echo htmlspecialcharsbx($agentParams[$k]["NAME"]);
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_ITEM_NAME");
                        ?>
>
									<<?php 
                        echo GetMessage("SALE_EXPORT_VALUE");
                        ?>
><?php 
                        echo htmlspecialcharsbx($v);
                        ?>
</<?php 
                        echo GetMessage("SALE_EXPORT_VALUE");
                        ?>
>
								</<?php 
                        echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                        ?>
>
								<?php 
                    }
                }
            }
            if (strlen($deliveryAdr) > 0) {
                ?>
						<<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
><?php 
                echo GetMessage("SALE_EXPORT_DELIVERY_ADDRESS");
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_ITEM_NAME");
                ?>
>
						<<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
><?php 
                echo htmlspecialcharsbx($deliveryAdr);
                ?>
</<?php 
                echo GetMessage("SALE_EXPORT_VALUE");
                ?>
>
						</<?php 
                echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
                ?>
>

						<?php 
            }
            ?>
				</<?php 
            echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
            ?>
>
			</<?php 
            echo GetMessage("SALE_EXPORT_DOCUMENT");
            ?>
>
			<?php 
            if ($crmMode) {
                $c = ob_get_clean();
                $c = CharsetConverter::ConvertCharset($c, $arCharSets[$arOrder["LID"]], "utf-8");
                echo $c;
                $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix][] = $arOrder["ID"];
            } else {
                $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix] = $arOrder["ID"];
            }
            if (IntVal($time_limit) > 0 && time() > $end_time) {
                break;
            }
        }
        ?>
		</<?php 
        echo GetMessage("SALE_EXPORT_COM_INFORMATION");
        ?>
>
		<?php 
        return $arResultStat;
    }
示例#8
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
global $APPLICATION;
$APPLICATION->IncludeComponent('bitrix:crm.control_panel', '', array('ID' => 'LOC_EDIT', 'ACTIVE_ITEM_ID' => '', 'PATH_TO_COMPANY_LIST' => isset($arResult['PATH_TO_COMPANY_LIST']) ? $arResult['PATH_TO_COMPANY_LIST'] : '', 'PATH_TO_COMPANY_EDIT' => isset($arResult['PATH_TO_COMPANY_EDIT']) ? $arResult['PATH_TO_COMPANY_EDIT'] : '', 'PATH_TO_CONTACT_LIST' => isset($arResult['PATH_TO_CONTACT_LIST']) ? $arResult['PATH_TO_CONTACT_LIST'] : '', 'PATH_TO_CONTACT_EDIT' => isset($arResult['PATH_TO_CONTACT_EDIT']) ? $arResult['PATH_TO_CONTACT_EDIT'] : '', 'PATH_TO_DEAL_LIST' => isset($arResult['PATH_TO_DEAL_LIST']) ? $arResult['PATH_TO_DEAL_LIST'] : '', 'PATH_TO_DEAL_EDIT' => isset($arResult['PATH_TO_DEAL_EDIT']) ? $arResult['PATH_TO_DEAL_EDIT'] : '', 'PATH_TO_LEAD_LIST' => isset($arResult['PATH_TO_LEAD_LIST']) ? $arResult['PATH_TO_LEAD_LIST'] : '', 'PATH_TO_LEAD_EDIT' => isset($arResult['PATH_TO_LEAD_EDIT']) ? $arResult['PATH_TO_LEAD_EDIT'] : '', 'PATH_TO_QUOTE_LIST' => isset($arResult['PATH_TO_QUOTE_LIST']) ? $arResult['PATH_TO_QUOTE_LIST'] : '', 'PATH_TO_QUOTE_EDIT' => isset($arResult['PATH_TO_QUOTE_EDIT']) ? $arResult['PATH_TO_QUOTE_EDIT'] : '', 'PATH_TO_INVOICE_LIST' => isset($arResult['PATH_TO_INVOICE_LIST']) ? $arResult['PATH_TO_INVOICE_LIST'] : '', 'PATH_TO_INVOICE_EDIT' => isset($arResult['PATH_TO_INVOICE_EDIT']) ? $arResult['PATH_TO_INVOICE_EDIT'] : '', 'PATH_TO_REPORT_LIST' => isset($arResult['PATH_TO_REPORT_LIST']) ? $arResult['PATH_TO_REPORT_LIST'] : '', 'PATH_TO_DEAL_FUNNEL' => isset($arResult['PATH_TO_DEAL_FUNNEL']) ? $arResult['PATH_TO_DEAL_FUNNEL'] : '', 'PATH_TO_EVENT_LIST' => isset($arResult['PATH_TO_EVENT_LIST']) ? $arResult['PATH_TO_EVENT_LIST'] : '', 'PATH_TO_PRODUCT_LIST' => isset($arResult['PATH_TO_PRODUCT_LIST']) ? $arResult['PATH_TO_PRODUCT_LIST'] : ''), $component);
$APPLICATION->IncludeComponent('bitrix:crm.config.locations.menu', '', array('PATH_TO_LOCATIONS_LIST' => $arResult['PATH_TO_LOCATIONS_LIST'], 'PATH_TO_LOCATIONS_EDIT' => $arResult['PATH_TO_LOCATIONS_EDIT'], 'PATH_TO_LOCATIONS_ADD' => $arResult['PATH_TO_LOCATIONS_ADD'], 'PATH_TO_LOCATIONS_IMPORT' => $arResult['PATH_TO_LOCATIONS_IMPORT'], 'LOC_ID' => $arResult['VARIABLES']['loc_id'], 'TYPE' => 'edit'), $component);
$APPLICATION->IncludeComponent('bitrix:crm.config.locations.edit' . (CSaleLocation::isLocationProEnabled() ? '.v2' : ''), '', array('PATH_TO_LOCATIONS_LIST' => $arResult['PATH_TO_LOCATIONS_LIST'], 'PATH_TO_LOCATIONS_EDIT' => $arResult['PATH_TO_LOCATIONS_EDIT'], 'PATH_TO_LOCATIONS_ADD' => $arResult['PATH_TO_LOCATIONS_ADD'], 'LOC_ID' => $arResult['VARIABLES']['loc_id']), $component);
示例#9
0
	public static function getLocationCODEbyID($id)
	{
		if(CSaleLocation::isLocationProEnabled() && intval($id))
		{
			// we must convert ID to CODE
			$item = Location\LocationTable::getById($id)->fetch();

			if(empty($item))
				return '';

			return $item['CODE'];
		}

		return $id;
	}
示例#10
0
 /**
  * Function gets order properties from database
  * @param mixed[] $cached Cached data taken from obtainDataCachedStructure()
  * @return void
  */
 protected function obtainProps(&$cached)
 {
     if (empty($this->dbResult["ID"])) {
         return;
     }
     $props = array();
     $dbOrderProps = CSaleOrderPropsValue::GetOrderProps($this->dbResult["ID"]);
     $iGroup = -1;
     while ($arOrderProps = $dbOrderProps->Fetch()) {
         if (empty($this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]]) || !in_array($arOrderProps["ORDER_PROPS_ID"], $this->arParams["PROP_" . $this->dbResult["PERSON_TYPE_ID"]])) {
             if ($arOrderProps["ACTIVE"] == "Y" && $arOrderProps["UTIL"] == "N") {
                 $arOrderPropsTmp = $arOrderProps;
                 if ($iGroup != intval($arOrderProps["PROPS_GROUP_ID"])) {
                     $arOrderPropsTmp["SHOW_GROUP_NAME"] = "Y";
                     $iGroup = intval($arOrderProps["PROPS_GROUP_ID"]);
                 }
                 if ($arOrderProps["TYPE"] == "SELECT" || $arOrderProps["TYPE"] == "RADIO") {
                     $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
                     $arOrderPropsTmp["VALUE"] = htmlspecialcharsEx($arVal["NAME"]);
                 } elseif ($arOrderProps["TYPE"] == "MULTISELECT") {
                     $arOrderPropsTmp["VALUE"] = "";
                     $curVal = explode(",", $arOrderProps["VALUE"]);
                     for ($i = 0, $intCount = count($curVal); $i < $intCount; $i++) {
                         $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
                         if ($i > 0) {
                             $arOrderPropsTmp["VALUE"] .= ", ";
                         }
                         $arOrderPropsTmp["VALUE"] .= htmlspecialcharsEx($arVal["NAME"]);
                     }
                 } elseif ($arOrderProps["TYPE"] == "LOCATION") {
                     $locationName = "";
                     if (CSaleLocation::isLocationProEnabled()) {
                         $locationName = Location\Admin\LocationHelper::getLocationPathDisplay($arOrderProps["VALUE"]);
                     } else {
                         if (CSaleLocation::isLocationProMigrated()) {
                             $arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);
                         }
                         $arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANGUAGE_ID);
                         $locationName .= !strlen($arVal["COUNTRY_NAME"]) ? "" : $arVal["COUNTRY_NAME"];
                         if (strlen($arVal["COUNTRY_NAME"]) && strlen($arVal["REGION_NAME"])) {
                             $locationName .= " - " . $arVal["REGION_NAME"];
                         } elseif (strlen($arVal["REGION_NAME"])) {
                             $locationName .= $arVal["REGION_NAME"];
                         }
                         if (strlen($arVal["COUNTRY_NAME"]) || strlen($arVal["REGION_NAME"])) {
                             $locationName .= " - " . $arVal["CITY_NAME"];
                         } elseif (strlen($arVal["CITY_NAME"])) {
                             $locationName .= $arVal["CITY_NAME"];
                         }
                     }
                     $arOrderPropsTmp["VALUE"] = $locationName;
                 } elseif ($arOrderProps["TYPE"] == "FILE") {
                     if (strpos($arOrderProps["VALUE"], ",") !== false) {
                         $fileValue = "";
                         $values = explode(",", $arOrderProps["VALUE"]);
                         if (self::isNonemptyArray($values)) {
                             foreach ($values as $fileId) {
                                 $fileValue .= CFile::ShowFile(trim($fileId), 0, 90, 90, true) . "<br/>";
                             }
                         }
                         $arOrderPropsTmp["VALUE"] = $fileValue;
                     } else {
                         $arOrderPropsTmp["VALUE"] = CFile::ShowFile($arOrderProps["VALUE"], 0, 90, 90, true);
                     }
                 }
                 $props[] = $arOrderPropsTmp;
             }
         }
     }
     $cached["ORDER_PROPS"] = $props;
 }
示例#11
0
 /**
  * @param \Bitrix\Sale\Order $order
  * @param $arOrder
  * @param $agentParams
  * @param $bExportFromCrm
  * @param $bCrmModuleIncluded
  * @param $paySystems
  * @param $delivery
  * @param array $options
  *
  * @return array|void
  */
 function getSaleProperties(Bitrix\Sale\Order $order, $arOrder, $agentParams, $bExportFromCrm, $bCrmModuleIncluded, $paySystems, $delivery, array $options = array())
 {
     $providersInstance = self::getProvidersInstanceByOrder($order);
     $personTypeId = $order->getPersonTypeId();
     $personTypes = BusinessValue::getPersonTypes();
     if (!($personType = $personTypes[$personTypeId])) {
         self::logError($order->getId(), 'Undefined DOMAIN for person type id "' . $personTypeId . '"');
         return;
     }
     $systemCodes1C = array_flip(self::$systemCodes[$personType['DOMAIN']]);
     $arProp = array();
     $arProp["ORDER"] = $arOrder;
     if (IntVal($arOrder["USER_ID"]) > 0) {
         $dbUser = CUser::GetByID($arOrder["USER_ID"]);
         if ($arUser = $dbUser->Fetch()) {
             $arProp["USER"] = $arUser;
         }
     }
     if ($bExportFromCrm) {
         $arProp["CRM"] = array();
         $companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
         $contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
         if ($companyID > 0) {
             $arProp["CRM"]["CLIENT_ID"] = "CRMCO" . $companyID;
         } else {
             $arProp["CRM"]["CLIENT_ID"] = "CRMC" . $contactID;
         }
         $clientInfo = array("LOGIN" => "", "NAME" => "", "LAST_NAME" => "", "SECOND_NAME" => "");
         if ($bCrmModuleIncluded) {
             if ($companyID > 0) {
                 $arCompanyFilter = array('=ID' => $companyID);
                 $dbCompany = CCrmCompany::GetListEx(array(), $arCompanyFilter, false, array("nTopCount" => 1), array("TITLE"));
                 $arCompany = $dbCompany->Fetch();
                 unset($dbCompany, $arCompanyFilter);
                 if (is_array($arCompany)) {
                     if (isset($arCompany["TITLE"])) {
                         $clientInfo["NAME"] = $arCompany["TITLE"];
                     }
                 }
                 unset($arCompany);
             } else {
                 if ($contactID > 0) {
                     $arContactFilter = array('=ID' => $contactID);
                     $dbContact = CCrmContact::GetListEx(array(), $arContactFilter, false, array("nTopCount" => 1), array("NAME", "LAST_NAME", "SECOND_NAME"));
                     $arContact = $dbContact->Fetch();
                     unset($dbContact, $arContactFilter);
                     if (is_array($arContact)) {
                         if (isset($arContact["NAME"])) {
                             $clientInfo["NAME"] = $arContact["NAME"];
                         }
                         if (isset($arContact["LAST_NAME"])) {
                             $clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
                         }
                         if (isset($arContact["SECOND_NAME"])) {
                             $clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
                         }
                     }
                     unset($arContact);
                 }
             }
         }
         $arProp["CRM"]["CLIENT"] = $clientInfo;
         unset($clientInfo);
     }
     if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0) {
         $arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
     }
     if (strlen($arOrder["DELIVERY_ID"]) > 0) {
         $arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];
     }
     $dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
     $locationStreetPropertyValue = '';
     while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
         if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX") {
             if ($arOrderPropVals["VALUE"] == "Y") {
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
             } else {
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
             }
         } elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA") {
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
         } elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO") {
             $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
         } elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT") {
             $curVal = explode(",", $arOrderPropVals["VALUE"]);
             foreach ($curVal as $vm) {
                 $arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
                 $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .= ", " . $arVal["NAME"];
             }
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
         } elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION") {
             $arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
             if (CSaleLocation::isLocationProEnabled()) {
                 if (intval($arVal['ID'])) {
                     try {
                         $res = \Bitrix\Sale\Location\LocationTable::getPathToNode($arVal['ID'], array('select' => array('LNAME' => 'NAME.NAME', 'TYPE_ID'), 'filter' => array('=NAME.LANGUAGE_ID' => LANGUAGE_ID)));
                         $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypeCodeIdMapCached();
                         $path = array();
                         while ($item = $res->fetch()) {
                             // copy street to STREET property
                             if ($types['ID2CODE'][$item['TYPE_ID']] == 'STREET') {
                                 $locationStreetPropertyValue = $item['LNAME'];
                             }
                             $path[] = $item['LNAME'];
                         }
                         $locationString = implode(' - ', $path);
                     } catch (\Bitrix\Main\SystemException $e) {
                         $locationString = '';
                     }
                 } else {
                     $locationString = '';
                 }
             } else {
                 $locationString = $arVal["COUNTRY_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["REGION_NAME"]) <= 0 ? "" : " - ") . $arVal["REGION_NAME"] . (strlen($arVal["COUNTRY_NAME"]) <= 0 || strlen($arVal["CITY_NAME"]) <= 0 ? "" : " - ") . $arVal["CITY_NAME"];
             }
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $locationString;
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_CITY"] = $arVal["CITY_NAME"];
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_COUNTRY"] = $arVal["COUNTRY_NAME"];
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"] . "_REGION"] = $arVal["REGION_NAME"];
         } else {
             $arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
         }
     }
     foreach ($agentParams as $k => $v) {
         if (strpos($k, "REKV_") !== false) {
             //params
             if (!is_array($v)) {
                 $agent["REKV"][$k] = $v;
             } else {
                 if (strlen($v["TYPE"]) <= 0) {
                     $agent["REKV"][$k] = $v["VALUE"];
                 } else {
                     switch ($v["TYPE"]) {
                         case 'CRM':
                             $agent["REKV"][$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
                             //value
                             break;
                         default:
                             if (!($codeKey = $systemCodes1C[$k]) && substr($k, 0, 5) === 'REKV_' && ($codeIndex = substr($k, 5)) !== '' && ($codeKey = BusinessValueConsumer1C::getRekvCodeKey($order->getPersonTypeId(), $codeIndex)) && ($providerInstance = $providersInstance[$order->getId()][$v["TYPE"]]) && is_set($providerInstance)) {
                                 $agent["REKV"][$k] = Bitrix\Sale\BusinessValue::getValueFromProvider($providerInstance, $codeKey, BusinessValueConsumer1C::CONSUMER_KEY);
                             }
                     }
                 }
             }
         } else {
             if (!is_array($v)) {
                 $agent[$k] = $v;
             } else {
                 if (strlen($v["TYPE"]) <= 0) {
                     $agent[$k] = $v["VALUE"];
                 } else {
                     switch ($v["TYPE"]) {
                         case 'CRM':
                             $agent[$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
                             break;
                         default:
                             if (($codeKey = $systemCodes1C[$k]) && ($providerInstance = $providersInstance[$order->getId()][$v["TYPE"]]) && is_set($providerInstance)) {
                                 $agent[$k] = Bitrix\Sale\BusinessValue::getValueFromProvider($providerInstance, $codeKey, BusinessValueConsumer1C::CONSUMER_KEY);
                             }
                     }
                 }
                 if ($k == 'STREET' && strlen($locationStreetPropertyValue)) {
                     $agent[$k] = $locationStreetPropertyValue . (strlen($agent[$k]) ? ', ' : '') . $agent[$k];
                 }
             }
         }
     }
     return array('agent' => $agent, 'arProp' => $arProp);
 }
示例#12
0
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
use Bitrix\Main\Loader;
global $APPLICATION;
$APPLICATION->SetAdditionalCSS('/bitrix/js/crm/css/crm.css');
$APPLICATION->SetAdditionalCSS("/bitrix/themes/.default/crm-entity-show.css");
$arResult['GRID_DATA'] = $arColumns = array();
foreach ($arResult['HEADERS'] as $arHead) {
    $arColumns[$arHead['id']] = false;
}
foreach ($arResult['TAX_RATES'] as $key => &$arTaxRate) {
    $arActions = array();
    if ($arResult['CAN_EDIT']) {
        if (Loader::includeModule('sale') && CSaleLocation::isLocationProEnabled()) {
            $width = 1024;
            $height = 768;
            $resizable = 'true';
        } else {
            $width = 498;
            $height = 275;
            $resizable = 'false';
        }
        $taxRateEditDialog = "javascript:(new BX.CDialog({'content_url':'/bitrix/components/bitrix/crm.config.tax.rate.edit/box.php?FORM_ID=" . $arParams['TAX_FORM_ID'] . "&TAX_ID=" . $arResult['TAX_ID'] . "&ID=" . $key . "', 'width':'" . $width . "', 'height':'" . $height . "', 'resizable':" . $resizable . " })).Show(); return false;";
        $arActions[] = array('ICONCLASS' => 'edit', 'TITLE' => GetMessage('CRM_TAXRATE_EDIT_TITLE'), 'TEXT' => GetMessage('CRM_TAXRATE_EDIT'), 'ONCLICK' => $taxRateEditDialog, 'DEFAULT' => true);
    }
    if ($arResult['CAN_DELETE']) {
        $arActions[] = array('SEPARATOR' => true);
        $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_TAXRATE_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_TAXRATE_DELETE'), 'ONCLICK' => 'crm_taxrate_delete_grid(\'' . CUtil::JSEscape(GetMessage('CRM_TAXRATE_DELETE_TITLE')) . '\', \'' . CUtil::JSEscape(sprintf(GetMessage('CRM_TAXRATE_DELETE_CONFIRM'), htmlspecialcharsbx($arTaxRate['NAME']))) . '\', \'' . CUtil::JSEscape(GetMessage('CRM_TAXRATE_DELETE')) . '\', \'' . CUtil::JSEscape($arTaxRate['PATH_TO_TAXRATE_DELETE']) . '\')');
    }
示例#13
0
    public static function setJS($arErrors = array())
    {
        ?>
        <link href="<?= COption::GetOptionString(self::$module_id, 'url_static_css', 'test', SITE_ID) ?>" type="text/css" rel="stylesheet"/>
        <script type="text/javascript" src="<?= COption::GetOptionString(self::$module_id, 'url_static_js', 'testjs', SITE_ID) ?>"></script>
        <script type="text/javascript">
            <? $arFieldValues = unserialize(COption::GetOptionString(self::$module_id, 'mapping', "", SITE_ID));
            ?>
            var dadataReady = true;
            dadataSearchLocation = function (city, region, country, objectid) {
                <?if(!CSaleLocation::isLocationProEnabled()):?>
                function getLocationDaData(country_id, region_id, city_id, objectid) {
                    BX.showWait();

                    property_id = objectid;
                    innercity_id = city_id;

                    function getLocationResultDaData(res) {
                        BX.closeWait();

                        var obContainer = document.getElementById('LOCATION_' + property_id);
                        if (obContainer) {
                            obContainer.innerHTML = res;
                            var idObject = BX(objectid);
                            if (idObject != null)
                                idObject.value = innercity_id;
                        }
                    }

                    var arParams = {
                        'COUNTRY_INPUT_NAME': 'COUNTRY',
                        'REGION_INPUT_NAME': 'REGION',
                        'CITY_INPUT_NAME': 'ORDER_PROP_6',
                        'CITY_OUT_LOCATION': 'Y',
                        'ALLOW_EMPTY_CITY': 'Y',
                        'COUNTRY': parseInt(country_id),
                        'REGION': parseInt(region_id),
                        'SITE_ID': "<?=SITE_ID?>"
                    };

                    var url = '/bitrix/components/bitrix/sale.ajax.locations/templates/.default/ajax.php';
                    BX.ajax.post(url, arParams, getLocationResultDaData)
                };
                <?endif?>

                PShowWaitMessage('wait_container', true);
                var TID = CPHttpRequest.InitThread();
                dadataReady = false;
                CPHttpRequest.SetAction(
                    TID,
                    function (data) {
                        var result = {};

                        eval('result = ' + data);
                        if (result.length > 0) {
                            <?if(CSaleLocation::isLocationProEnabled()):?>
                            var idObject = $('[name=' + objectid + ']');
                            if (idObject != null && idObject.length > 0)
                                idObject.val(result[0]['ID']);
                            <?else:?>
                            var idObject = BX("COUNTRY" + objectid);
                            if (idObject != null)
                                idObject.value = result[0]['COUNTRY_ID'];
                            idObject = BX.findNextSibling(idObject, {"name": "REGION" + objectid});
                            if (idObject != null) {
                                idObject.value = result[0]['REGION_ID'];
                                getLocationDaData(result[0]['COUNTRY_ID'], result[0]['REGION_ID'], result[0]['ID'], objectid)
                            }
                            idObject = BX(objectid);
                            if (idObject != null)
                                idObject.value = result[0]['ID'];
                            <?endif?>

                            var locationArray = [];
                            if (result[0]['NAME']) locationArray.push(result[0]['NAME']);
                            if (result[0]['REGION_NAME']) locationArray.push(result[0]['REGION_NAME']);
                            if (result[0]['COUNTRY_NAME']) locationArray.push(result[0]['COUNTRY_NAME']);

                            <?if(CSaleLocation::isLocationProEnabled()):?>
                            var textObject = $('[name=' + objectid + ']');
                            if (textObject != null && textObject.length > 0) {
                                textObject = textObject.parent().find('.bx-ui-sls-fake');
                                if (textObject != null && textObject.length > 0) {
                                    textObject.attr('title', locationArray.join(', '));
                                }
                            }
                            <?else:?>
                            var textObject = BX(objectid + '_val');
                            if (textObject != null)
                                textObject.value = locationArray.join(', ');
                            <?endif?>


                        }
                        PCloseWaitMessage('wait_container', true);
                        <?if(CSaleLocation::isLocationProEnabled()):?>
                        submitForm();
                        <?endif?>
                        dadataReady = true;
                    }
                );
                url = '/bitrix/components/dadata.suggestions/dadata.locations/search.php';
                CPHttpRequest.Send(TID, url, {"city": city, "region": region, "country": country, "params": "siteId:<?=SITE_ID?>"});

            }
            ;
            initSuggestionFields = function () {
                <? foreach($arFieldValues as $fieldNo => $fieldVal)
                if ($fieldVal) {

                $suggestionType = strstr($fieldVal,'_',true);
                $suggestionVar = substr($fieldVal,strpos($fieldVal,'_')+1);
                $suggestionParameter =CDadataSuggestionsSettings::GetPartParameterString($suggestionType,$suggestionVar);
                if ($suggestionVar=='value') { ?>

                if ($(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).length > 0) $(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).suggestions({
                    serviceUrl: '  <?=COption::GetOptionString(self::$module_id,'url','',SITE_ID)?>',
                    token: '<?=COption::GetOptionString(self::$module_id,'apikey','',SITE_ID)?>',
                    type: '<?=$suggestionType?>',
                    onSelect: function (suggestion) {
                        <? foreach ($arFieldValues as $innerFieldNo => $innerFieldVal) {
                            $innerSuggestionType = strstr($innerFieldVal,'_',true);
                            $innerSuggestionVar = substr($innerFieldVal,strpos($innerFieldVal,'_')+1);
                            if ($innerSuggestionType==$suggestionType&&$innerSuggestionVar=='LOCATION') {?>

                        if ($(<?=CDadataSuggestions::fieldSelector($innerFieldNo)?>).length > 0) dadataSearchLocation((suggestion.data.city ? suggestion.data.city : suggestion.data.settlement), suggestion.data.region, suggestion.data.country, 'ORDER_PROP_<?=$innerFieldNo?>');

                        <?}}?>

                        <? foreach ($arFieldValues as $innerFieldNo => $innerFieldVal) {
                            $innerSuggestionType = strstr($innerFieldVal,'_',true);
                            $innerSuggestionVar = substr($innerFieldVal,strpos($innerFieldVal,'_')+1);
                            if ($innerSuggestionType==$suggestionType&&!in_array($innerSuggestionVar,array('value','LOCATION'))){?>

                        if ($(<?=CDadataSuggestions::fieldSelector($innerFieldNo)?>).length > 0)  $(<?=CDadataSuggestions::fieldSelector($innerFieldNo)?>).val(suggestion.<?=$innerSuggestionVar?>);

                        <?}}?>

                    }
                });

                <?} elseif($suggestionVar=='LOCATION') {?>

                <?} elseif($suggestionParameter!=null) {?>

                if ($(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).length > 0) $(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).suggestions({
                    serviceUrl: '<?=COption::GetOptionString(self::$module_id,'url','',SITE_ID)?>',
                    token: '<?=COption::GetOptionString(self::$module_id,'apikey','',SITE_ID)?>',
                    type: '<?=$suggestionType?>',
                    <?=$suggestionParameter?>

                    onSelect: function (suggestion) {
                        $(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).val(suggestion.<?=$suggestionVar?>);
                    }
                });
                <?}}?>
            };

            var personType = $('input[name=PERSON_TYPE_OLD]').val();
            var locationType;

            <? foreach($arFieldValues as $fieldNo => $fieldVal)
            if ($fieldVal=="ADDRESS_LOCATION"):?>
            if ($(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).length > 0) locationType = $(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).val();
            <? endif; ?>

            BX.ready(function () {
                $('#order_form_content').bind("DOMSubtreeModified", function () {
                    var personTypeEl = $('input[name=PERSON_TYPE_OLD]');
                    var locationTypeNew;
                    <? foreach($arFieldValues as $fieldNo => $fieldVal) if ($fieldVal=="ADDRESS_LOCATION"):?>
                    if ($(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).length > 0) locationTypeNew = $(<?=CDadataSuggestions::fieldSelector($fieldNo)?>).val();
                    <? endif; ?>

                    if ((personTypeEl.length > 0 && personTypeEl.val() != personType) || locationTypeNew != locationType) {
                        locationType = locationTypeNew;
                        personType = personTypeEl.val();
                        initSuggestionFields();
                    }
                });

                initSuggestionFields();

            });
        </script>
    <?
    }
示例#14
0
	function PrintPropsForm($arSource = array(), $locationTemplate = ".default", $arContactGroup)
	{
		if (!empty($arSource))
		{
			foreach ($arSource as $arProperties)
			{
				/*echo '<pre>';
				print_r($arContactGroup);
				echo '</pre>';
				echo $arProperties["PROPS_GROUP_ID"];
				if (count($arContactGroup) > 0 && !in_array($arProperties["PROPS_GROUP_ID"], $arContactGroup))
					continue;*/
				?>
				<div class="table-field" data-property-id-row="<?php 
echo intval(intval($arProperties["ID"]));
?>
">

				<?
				if ($arProperties["TYPE"] == "CHECKBOX")
				{
					?>
					<input type="hidden" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" value="">

					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r1x3 pt8">
						<input type="checkbox" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" value="Y"<?if ($arProperties["CHECKED"]=="Y") echo " checked";?>>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>

					<div style="clear: both;"></div>
					<?
				}
				elseif ($arProperties["TYPE"] == "TEXT")
				{
					$type = 'text';
					$checkEmail = false;
					if ($arProperties["CODE"] == "PHONE")
						$type = 'tel';
					elseif ($arProperties["CODE"] == "EMAIL"){
						$type = 'email';
						global $USER;
						if(!$USER->IsAuthorized())
							$checkEmail = true;
					}

					?>
					<?/*<pre><?print_r($arProperties)?></pre>*/?>
					<label class="label"><?php 
echo $arProperties["NAME"];
?>
</label>
					<div class="field">
						<input type="<?php 
echo $type;
?>
" 
							maxlength="250" 
							size="<?php 
echo $arProperties["SIZE1"];
?>
" 
							<?if ($checkEmail):?>onchange="checkUserEmail(this);"<?endif;?> 
							value="<?php 
echo $arProperties["VALUE"];
?>
" 
							name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" 
							class="PROP_INPUT_<?php 
echo $arProperties["CODE"];
?>
 <?if($type == 'tel'):?>numbers<?endif;?> <?if ($arProperties["REQUIED"] == "Y"):?>required<?endif;?>" 
							id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" <?/*if ($arProperties["REQUIED"] == "Y"):?>required<?endif;*/?> 
						/>
                    <?if ($checkEmail):?>
                        <span class="input-loader" style="display:none;">
                            <div>
                                <img src="/local/templates/zakrepi/images/svg/loader.svg" width="25"/>
                            </div>
                        </span>
                    <?endif;?>
                        <span class="error-text error-required error-pattern"><?php 
echo $arProperties['DESCRIPTION'];
?>
</span>
                    </div>
					<?
				}
				elseif ($arProperties["TYPE"] == "SELECT")
				{
					?>
					<br/>
					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">
						<select name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" size="<?php 
echo $arProperties["SIZE1"];
?>
">
							<?
							foreach($arProperties["VARIANTS"] as $arVariants):
							?>
								<option value="<?php 
echo $arVariants["VALUE"];
?>
"<?if ($arVariants["SELECTED"] == "Y") echo " selected";?>><?php 
echo $arVariants["NAME"];
?>
</option>
							<?
							endforeach;
							?>
						</select>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>
					<div style="clear: both;"></div>
					<?
				}
				elseif ($arProperties["TYPE"] == "MULTISELECT")
				{
					?>
					<br/>
					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">
						<select multiple name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
" size="<?php 
echo $arProperties["SIZE1"];
?>
">
							<?
							foreach($arProperties["VARIANTS"] as $arVariants):
							?>
								<option value="<?php 
echo $arVariants["VALUE"];
?>
"<?if ($arVariants["SELECTED"] == "Y") echo " selected";?>><?php 
echo $arVariants["NAME"];
?>
</option>
							<?
							endforeach;
							?>
						</select>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>
					<div style="clear: both;"></div>
					<?
				}
				elseif ($arProperties["TYPE"] == "TEXTAREA")
				{
					$rows = ($arProperties["SIZE2"] > 10) ? 4 : $arProperties["SIZE2"];
					?>
					<br/>
					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">
						<textarea rows="<?php 
echo $rows;
?>
" cols="<?php 
echo $arProperties["SIZE1"];
?>
" name="<?php 
echo $arProperties["FIELD_NAME"];
?>
" id="<?php 
echo $arProperties["FIELD_NAME"];
?>
"><?php 
echo $arProperties["VALUE"];
?>
</textarea>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>
					<div style="clear: both;"></div>
					<?
				}
				elseif ($arProperties["TYPE"] == "LOCATION")
				{
					?>
					<div style="display:none">
					<input type="hidden" name="location_prop_id" value="<?php 
echo $arProperties["ID"];
?>
" />

					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">

						<?
						$value = 0;
						if (is_array($arProperties["VARIANTS"]) && count($arProperties["VARIANTS"]) > 0)
						{
							foreach ($arProperties["VARIANTS"] as $arVariant)
							{
								if ($arVariant["SELECTED"] == "Y")
								{
									$value = $arVariant["ID"];
									break;
								}
							}
						}

						// here we can get '' or 'popup'
						// map them, if needed
						if(CSaleLocation::isLocationProMigrated())
						{
							$locationTemplateP = $locationTemplate == 'popup' ? 'search' : 'steps';
							$locationTemplateP = $_REQUEST['PERMANENT_MODE_STEPS'] == 1 ? 'steps' : $locationTemplateP; // force to "steps"
						}
						?>

						<?if($locationTemplateP == 'steps'):?>
							<input type="hidden" id="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
echo intval($arProperties["ID"]);
?>
]" name="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
echo intval($arProperties["ID"]);
?>
]" value="<?php 
echo $_REQUEST['LOCATION_ALT_PROP_DISPLAY_MANUAL'][intval($arProperties["ID"])] ? '1' : '0';
?>
" />
						<?endif?>

						<?CSaleLocation::proxySaleAjaxLocationsComponent(array(
							"AJAX_CALL" => "N",
							"COUNTRY_INPUT_NAME" => "COUNTRY",
							"REGION_INPUT_NAME" => "REGION",
							"CITY_INPUT_NAME" => $arProperties["FIELD_NAME"],
							"CITY_OUT_LOCATION" => "Y",
							"LOCATION_VALUE" => $value,
							"ORDER_PROPS_ID" => $arProperties["ID"],
							"ONCITYCHANGE" => ($arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y") ? "submitForm()" : "",
							"SIZE1" => $arProperties["SIZE1"],
						),
						array(
							"ID" => $value,
							"CODE" => "",
							"SHOW_DEFAULT_LOCATIONS" => "Y",

							// function called on each location change caused by user or by program
							// it may be replaced with global component dispatch mechanism coming soon
							"JS_CALLBACK" => "submitFormProxy",

							// function window.BX.locationsDeferred['X'] will be created and lately called on each form re-draw.
							// it may be removed when sale.order.ajax will use real ajax form posting with BX.ProcessHTML() and other stuff instead of just simple iframe transfer
							"JS_CONTROL_DEFERRED_INIT" => intval($arProperties["ID"]),

							// an instance of this control will be placed to window.BX.locationSelectors['X'] and lately will be available from everywhere
							// it may be replaced with global component dispatch mechanism coming soon
							"JS_CONTROL_GLOBAL_ID" => intval($arProperties["ID"]),

							"DISABLE_KEYBOARD_INPUT" => "Y",
							"PRECACHE_LAST_LEVEL" => "Y",
							"PRESELECT_TREE_TRUNK" => "Y",
							"SUPPRESS_ERRORS" => "Y"
						),
						$locationTemplateP,
						true,
						'location-block-wrapper'
						)?>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>

					</div>
					<div style="clear: both;"></div>
					</div>
					<?
				}
				elseif ($arProperties["TYPE"] == "RADIO")
				{
					?>
					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">
						<?
						if (is_array($arProperties["VARIANTS"]))
						{
							foreach($arProperties["VARIANTS"] as $arVariants):
							?>
								<input
									type="radio"
									name="<?php 
echo $arProperties["FIELD_NAME"];
?>
"
									id="<?php 
echo $arProperties["FIELD_NAME"];
?>
_<?php 
echo $arVariants["VALUE"];
?>
"
									value="<?php 
echo $arVariants["VALUE"];
?>
" <?if($arVariants["CHECKED"] == "Y") echo " checked";?> />

								<label for="<?php 
echo $arProperties["FIELD_NAME"];
?>
_<?php 
echo $arVariants["VALUE"];
?>
"><?php 
echo $arVariants["NAME"];
?>
</label></br>
							<?
							endforeach;
						}
						?>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>
					<div style="clear: both;"></div>
					<?
				}
				elseif ($arProperties["TYPE"] == "FILE")
				{
					?>
					<br/>
					<div class="bx_block r1x3 pt8">
						<?php 
echo $arProperties["NAME"];
?>
						<?if ($arProperties["REQUIED_FORMATED"]=="Y"):?>
							<span class="bx_sof_req">*</span>
						<?endif;?>
					</div>

					<div class="bx_block r3x1">
						<?php 
echo showFilePropertyField("ORDER_PROP_" . $arProperties["ID"], $arProperties, $arProperties["VALUE"], $arProperties["SIZE1"]);
?>

						<?
						if (strlen(trim($arProperties["DESCRIPTION"])) > 0):
						?>
						<div class="bx_description">
							<?php 
echo $arProperties["DESCRIPTION"];
?>
						</div>
						<?
						endif;
						?>
					</div>

					<div style="clear: both;"></div><br/>
					<?
				}
				?>
				</div>

				<?if(CSaleLocation::isLocationProEnabled()):?>

					<?
					$propertyAttributes = array(
						'type' => $arProperties["TYPE"],
						'valueSource' => $arProperties['SOURCE'] == 'DEFAULT' ? 'default' : 'form' // value taken from property DEFAULT_VALUE or it`s a user-typed value?
					);

					if(intval($arProperties['IS_ALTERNATE_LOCATION_FOR']))
						$propertyAttributes['isAltLocationFor'] = intval($arProperties['IS_ALTERNATE_LOCATION_FOR']);

					if(intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION']))
						$propertyAttributes['altLocationPropId'] = intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION']);

					if($arProperties['IS_ZIP'] == 'Y')
						$propertyAttributes['isZip'] = true;
					?>

					<script>

						<?// add property info to have client-side control on it?>
						(window.top.BX || BX).saleOrderAjax.addPropertyDesc(<?php 
echo CUtil::PhpToJSObject(array('id' => intval($arProperties["ID"]), 'attributes' => $propertyAttributes));
?>
);

					</script>
				<?endif?>

				<?
			}
		}
	}
示例#15
0
    function PrintPropsForm($arSource = array(), $locationTemplate = ".default")
    {
        if (!empty($arSource)) {
            ?>
				<div>
					<?php 
            foreach ($arSource as $arProperties) {
                ?>
						<div data-property-id-row="<?php 
                echo intval(intval($arProperties["ID"]));
                ?>
">

						<?php 
                if ($arProperties["TYPE"] == "CHECKBOX") {
                    ?>
							<input type="hidden" name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" value="">

							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r1x3 pt8">
								<input type="checkbox" name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" id="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" value="Y"<?php 
                    if ($arProperties["CHECKED"] == "Y") {
                        echo " checked";
                    }
                    ?>
>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>

							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "TEXT") {
                    ?>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<input type="text" maxlength="250" size="<?php 
                    echo $arProperties["SIZE1"];
                    ?>
" value="<?php 
                    echo $arProperties["VALUE"];
                    ?>
" name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" id="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" />

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>
							<div style="clear: both;"></div><br/>
							<?php 
                } elseif ($arProperties["TYPE"] == "SELECT") {
                    ?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<select name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" id="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" size="<?php 
                    echo $arProperties["SIZE1"];
                    ?>
">
									<?php 
                    foreach ($arProperties["VARIANTS"] as $arVariants) {
                        ?>
										<option value="<?php 
                        echo $arVariants["VALUE"];
                        ?>
"<?php 
                        if ($arVariants["SELECTED"] == "Y") {
                            echo " selected";
                        }
                        ?>
><?php 
                        echo $arVariants["NAME"];
                        ?>
</option>
									<?php 
                    }
                    ?>
								</select>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>
							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "MULTISELECT") {
                    ?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<select multiple name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" id="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" size="<?php 
                    echo $arProperties["SIZE1"];
                    ?>
">
									<?php 
                    foreach ($arProperties["VARIANTS"] as $arVariants) {
                        ?>
										<option value="<?php 
                        echo $arVariants["VALUE"];
                        ?>
"<?php 
                        if ($arVariants["SELECTED"] == "Y") {
                            echo " selected";
                        }
                        ?>
><?php 
                        echo $arVariants["NAME"];
                        ?>
</option>
									<?php 
                    }
                    ?>
								</select>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>
							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "TEXTAREA") {
                    $rows = $arProperties["SIZE2"] > 10 ? 4 : $arProperties["SIZE2"];
                    ?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<textarea rows="<?php 
                    echo $rows;
                    ?>
" cols="<?php 
                    echo $arProperties["SIZE1"];
                    ?>
" name="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
" id="<?php 
                    echo $arProperties["FIELD_NAME"];
                    ?>
"><?php 
                    echo $arProperties["VALUE"];
                    ?>
</textarea>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>
							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "LOCATION") {
                    ?>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">

								<?php 
                    $value = 0;
                    if (is_array($arProperties["VARIANTS"]) && count($arProperties["VARIANTS"]) > 0) {
                        foreach ($arProperties["VARIANTS"] as $arVariant) {
                            if ($arVariant["SELECTED"] == "Y") {
                                $value = $arVariant["ID"];
                                break;
                            }
                        }
                    }
                    // here we can get '' or 'popup'
                    // map them, if needed
                    if (CSaleLocation::isLocationProMigrated()) {
                        $locationTemplateP = $locationTemplate == 'popup' ? 'search' : 'steps';
                        $locationTemplateP = $_REQUEST['PERMANENT_MODE_STEPS'] == 1 ? 'steps' : $locationTemplateP;
                        // force to "steps"
                    }
                    ?>

								<?php 
                    if ($locationTemplateP == 'steps') {
                        ?>
									<input type="hidden" id="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
                        echo intval($arProperties["ID"]);
                        ?>
]" name="LOCATION_ALT_PROP_DISPLAY_MANUAL[<?php 
                        echo intval($arProperties["ID"]);
                        ?>
]" value="<?php 
                        echo $_REQUEST['LOCATION_ALT_PROP_DISPLAY_MANUAL'][intval($arProperties["ID"])] ? '1' : '0';
                        ?>
" />
								<?php 
                    }
                    ?>

								<?php 
                    CSaleLocation::proxySaleAjaxLocationsComponent(array("AJAX_CALL" => "N", "COUNTRY_INPUT_NAME" => "COUNTRY", "REGION_INPUT_NAME" => "REGION", "CITY_INPUT_NAME" => $arProperties["FIELD_NAME"], "CITY_OUT_LOCATION" => "Y", "LOCATION_VALUE" => $value, "ORDER_PROPS_ID" => $arProperties["ID"], "ONCITYCHANGE" => $arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y" ? "submitForm()" : "", "SIZE1" => $arProperties["SIZE1"]), array("ID" => $value, "CODE" => "", "SHOW_DEFAULT_LOCATIONS" => "Y", "JS_CALLBACK" => "submitFormProxy", "JS_CONTROL_DEFERRED_INIT" => intval($arProperties["ID"]), "JS_CONTROL_GLOBAL_ID" => intval($arProperties["ID"]), "DISABLE_KEYBOARD_INPUT" => "Y", "PRECACHE_LAST_LEVEL" => "Y", "PRESELECT_TREE_TRUNK" => "Y", "SUPPRESS_ERRORS" => "Y"), $locationTemplateP, true, 'location-block-wrapper');
                    ?>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>

							</div>
							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "RADIO") {
                    ?>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<?php 
                    if (is_array($arProperties["VARIANTS"])) {
                        foreach ($arProperties["VARIANTS"] as $arVariants) {
                            ?>
										<input
											type="radio"
											name="<?php 
                            echo $arProperties["FIELD_NAME"];
                            ?>
"
											id="<?php 
                            echo $arProperties["FIELD_NAME"];
                            ?>
_<?php 
                            echo $arVariants["VALUE"];
                            ?>
"
											value="<?php 
                            echo $arVariants["VALUE"];
                            ?>
" <?php 
                            if ($arVariants["CHECKED"] == "Y") {
                                echo " checked";
                            }
                            ?>
 />

										<label for="<?php 
                            echo $arProperties["FIELD_NAME"];
                            ?>
_<?php 
                            echo $arVariants["VALUE"];
                            ?>
"><?php 
                            echo $arVariants["NAME"];
                            ?>
</label></br>
									<?php 
                        }
                    }
                    ?>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>
							<div style="clear: both;"></div>
							<?php 
                } elseif ($arProperties["TYPE"] == "FILE") {
                    ?>
							<br/>
							<div class="bx_block r1x3 pt8">
								<?php 
                    echo $arProperties["NAME"];
                    ?>
								<?php 
                    if ($arProperties["REQUIED_FORMATED"] == "Y") {
                        ?>
									<span class="bx_sof_req">*</span>
								<?php 
                    }
                    ?>
							</div>

							<div class="bx_block r3x1">
								<?php 
                    echo showFilePropertyField("ORDER_PROP_" . $arProperties["ID"], $arProperties, $arProperties["VALUE"], $arProperties["SIZE1"]);
                    ?>

								<?php 
                    if (strlen(trim($arProperties["DESCRIPTION"])) > 0) {
                        ?>
								<div class="bx_description">
									<?php 
                        echo $arProperties["DESCRIPTION"];
                        ?>
								</div>
								<?php 
                    }
                    ?>
							</div>

							<div style="clear: both;"></div><br/>
							<?php 
                }
                ?>
						</div>

						<?php 
                if (CSaleLocation::isLocationProEnabled()) {
                    ?>

							<?php 
                    $propertyAttributes = array('type' => $arProperties["TYPE"], 'valueSource' => $arProperties['SOURCE'] == 'DEFAULT' ? 'default' : 'form');
                    if (intval($arProperties['IS_ALTERNATE_LOCATION_FOR'])) {
                        $propertyAttributes['isAltLocationFor'] = intval($arProperties['IS_ALTERNATE_LOCATION_FOR']);
                    }
                    if (intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION'])) {
                        $propertyAttributes['altLocationPropId'] = intval($arProperties['CAN_HAVE_ALTERNATE_LOCATION']);
                    }
                    if ($arProperties['IS_ZIP'] == 'Y') {
                        $propertyAttributes['isZip'] = true;
                    }
                    ?>

							<script>

								<?php 
                    // add property info to have client-side control on it
                    ?>
								(window.top.BX || BX).saleOrderAjax.addPropertyDesc(<?php 
                    echo CUtil::PhpToJSObject(array('id' => intval($arProperties["ID"]), 'attributes' => $propertyAttributes));
                    ?>
);

							</script>
						<?php 
                }
                ?>

						<?php 
            }
            ?>
				</div>
			<?php 
        }
    }
示例#16
0
 private static function isNewLocationModule()
 {
     if (!method_exists(CSaleLocation,"isLocationProEnabled"))
         return false;
     return CSaleLocation::isLocationProEnabled();
 }
示例#17
0
			),
		);

		/* LOCATIONS BEGIN */
		// this file can be loaded directly, without module include, so ...
		require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/include.php");

		if(class_exists('CSaleLocation'))
		{
			$locationMenu = array(
				"text" => GetMessage("SALE_LOCATION"),
				"title" => GetMessage("SALE_LOCATION_DESCR"),
				"items_id" => "menu_sale_locations",
			);

			if(CSaleLocation::isLocationProEnabled())
			{
				$locationMenu["items"] = array(
					array(
						"text" => GetMessage("sale_menu_locations"),
						"title" => GetMessage("sale_menu_locations_title"),
						"url" => Location\Admin\LocationHelper::getListUrl(0),
						"more_url" => array(Location\Admin\LocationHelper::getEditUrl()),

						"module_id" => "sale",
						"items_id" => Location\Admin\LocationHelper::packItemsQueryString(),
						"dynamic" => true,
						"items" => Location\Admin\LocationHelper::getLocationSubMenu()
					),
					array(
						"text" => GetMessage("SALE_LOCATION_GROUPS"),
示例#18
0
function getOrderPropFormated($arProperties, $arResult, &$arUserResult, &$arDeleteFieldLocation = array())
{
	global $USER;

	$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	$curLocation = false;
	static $propertyGroupID = 0;
	static $propertyUSER_PROPS = "";

	// take data from user profile
	if ($arUserResult["PROFILE_CHANGE"] == "Y"
		&& intval($arUserResult["PROFILE_ID"]) > 0
		&& !($arResult["HAVE_PREPAYMENT"]
		&& $arUserResult["PROFILE_DEFAULT"] == "Y"
		&& !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]])))
	{
		$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(
			array("SORT" => "ASC"),
			array(
				"USER_PROPS_ID" => $arUserResult["PROFILE_ID"],
				"ORDER_PROPS_ID" => $arProperties["ID"],
				"USER_ID" => intval($USER->GetID()),
			),
			false,
			false,
			array("VALUE", "PROP_TYPE", "VARIANT_NAME", "SORT", "ORDER_PROPS_ID")
		);
		if ($arUserPropsValues = $dbUserPropsValues->Fetch())
		{
			$valueTmp = "";
			if ($arUserPropsValues["PROP_TYPE"] == "MULTISELECT")
			{
				$arUserPropsValues["VALUE"] = explode(",", $arUserPropsValues["VALUE"]);
			}
			$curVal = $arUserPropsValues["VALUE"];

			if(CSaleLocation::isLocationProMigrated())
			{
				// SPIKE: map here LOCATION CODE to ID, kz now we keep CODE, not ID in the DB
				if($arProperties['TYPE'] == 'LOCATION')
				{
					$curVal = CSaleLocation::getLocationIDbyCODE($curVal);
				}
			}
		}
	}
	elseif($arUserResult["PROFILE_CHANGE"] == "Y" && intval($arUserResult["PROFILE_ID"]) <= 0)
	{
		if (isset($curVal))
			unset($curVal);
	}
	elseif(isset($arUserResult["ORDER_PROP"][$arProperties["ID"]]))
		$curVal = $arUserResult["ORDER_PROP"][$arProperties["ID"]];
	elseif($arResult["HAVE_PREPAYMENT"] && !empty($arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]]))
	{
		$curVal = $arResult["PREPAY_ORDER_PROPS"][$arProperties["CODE"]];
		if($arProperties["TYPE"] == "LOCATION")
			$curLocation = $curVal;
	}

	if (intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]) > 0)
		$curVal = intval($_REQUEST["NEW_LOCATION_".$arProperties["ID"]]);

	$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"];

	if(strlen($arProperties["CODE"]) > 0)
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["CODE"];
	else
		$arProperties["FIELD_ID"] = "ORDER_PROP_".$arProperties["ID"];

	if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID || $propertyUSER_PROPS != $arProperties["USER_PROPS"])
		$arProperties["SHOW_GROUP_NAME"] = "Y";

	$propertyGroupID = $arProperties["PROPS_GROUP_ID"];
	$propertyUSER_PROPS = $arProperties["USER_PROPS"];

	if ($arProperties["REQUIED"]=="Y" || $arProperties["IS_EMAIL"]=="Y" || $arProperties["IS_PROFILE_NAME"]=="Y" || $arProperties["IS_LOCATION"]=="Y" || $arProperties["IS_LOCATION4TAX"]=="Y" || $arProperties["IS_PAYER"]=="Y" || $arProperties["IS_ZIP"]=="Y")
		$arProperties["REQUIED_FORMATED"]="Y";

	if ($arProperties["TYPE"] == "CHECKBOX")
	{
		if ($curVal=="Y" || !isset($curVal) && $arProperties["DEFAULT_VALUE"]=="Y")
		{
			$arProperties["CHECKED"] = "Y";
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_Y");
		}
		else
			$arProperties["VALUE_FORMATED"] = GetMessage("SOA_N");

		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 30);
	}
	elseif ($arProperties["TYPE"] == "TEXT")
	{
		if (strlen($curVal) <= 0)
		{
			if(strlen($arProperties["DEFAULT_VALUE"])>0 && !isset($curVal))
				$arProperties["VALUE"] = $arProperties["DEFAULT_VALUE"];
			elseif ($arProperties["IS_EMAIL"] == "Y")
				$arProperties["VALUE"] = $USER->GetEmail();
			elseif ($arProperties["IS_PAYER"] == "Y")
			{
				//$arProperties["VALUE"] = $USER->GetFullName();
				$rsUser = CUser::GetByID($USER->GetID());
				$fio = "";
				if ($arUser = $rsUser->Fetch())
				{
					$fio = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arUser["NAME"], "LAST_NAME" => $arUser["LAST_NAME"], "SECOND_NAME" => $arUser["SECOND_NAME"]), false, false);
				}
				$arProperties["VALUE"] = $fio;
			}

			$arProperties["SOURCE"] = 'DEFAULT';
		}
		else
		{
			$arProperties["VALUE"] = $curVal;
			$arProperties["SOURCE"] = 'FORM';
		}

		//select ZIP for LOCATION
		if ($arProperties["IS_ZIP"] == "Y" && $arUserResult["PROFILE_CHANGE"] == "N")
		{
			$dbPropertiesLoc = CSaleOrderProps::GetList(
					array("ID" => "DESC"),
					array(
						"PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"],
						"ACTIVE" => "Y",
						"UTIL" => "N",
						"IS_LOCATION" => "Y"
						),
					false,
					false,
					array("ID")
				);
			$arPropertiesLoc = $dbPropertiesLoc->Fetch();

			if ($arPropertiesLoc["ID"] > 0)
			{
				// proxy location here?

				$arZipLocation = array();
				if(strlen($curVal) > 0)
					$arZipLocation = CSaleLocation::GetByZIP($curVal);

				$rsZipList = CSaleLocation::GetLocationZIP($arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]);
				if($arZip = $rsZipList->Fetch())
				{
					if (strlen($arZip["ZIP"]) > 0 && (empty($arZipLocation) || $arZipLocation["ID"] != $arUserResult["ORDER_PROP"][$arPropertiesLoc["ID"]]))
						$arProperties["VALUE"] = $arZip["ZIP"];
				}
			}
		}

		if ($arProperties["IS_ZIP"]=="Y")
			$arUserResult["DELIVERY_LOCATION_ZIP"] = $arProperties["VALUE"];


		$arProperties["VALUE"] = htmlspecialcharsEx($arProperties["VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];

	}
	elseif ($arProperties["TYPE"] == "SELECT")
	{
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC", "NAME" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")

		);
		$flagDefault = "N";
		$nameProperty = "";
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($flagDefault == "N" && $nameProperty == "")
			{
				$nameProperty = $arVariants["NAME"];
			}
			if (($arVariants["VALUE"] == $curVal) || ((!isset($curVal) || $curVal == "") && ($arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])))
			{
				$arVariants["SELECTED"] = "Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
				$flagDefault = "Y";
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}
		if ($flagDefault == "N")
		{
			$arProperties["VARIANTS"][0]["SELECTED"]= "Y";
			$arProperties["VARIANTS"][0]["VALUE_FORMATED"] = $nameProperty;
		}
	}
	elseif ($arProperties["TYPE"] == "MULTISELECT")
	{
		$arProperties["FIELD_NAME"] = "ORDER_PROP_".$arProperties["ID"].'[]';
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 5);
		$arDefVal = explode(",", $arProperties["DEFAULT_VALUE"]);
		$countDefVal = count($arDefVal);
		for ($i = 0; $i < $countDefVal; $i++)
			$arDefVal[$i] = Trim($arDefVal[$i]);

		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		$i = 0;
		while ($arVariants = $dbVariants->GetNext())
		{
			if ((is_array($curVal) && in_array($arVariants["VALUE"], $curVal)) || (!isset($curVal) && in_array($arVariants["VALUE"], $arDefVal)))
			{
				$arVariants["SELECTED"] = "Y";
				if ($i > 0)
					$arProperties["VALUE_FORMATED"] .= ", ";
				$arProperties["VALUE_FORMATED"] .= $arVariants["NAME"];
				$i++;
			}
			$arProperties["VARIANTS"][] = $arVariants;
		}
	}
	elseif ($arProperties["TYPE"] == "TEXTAREA")
	{
		$arProperties["SIZE2"] = ((intval($arProperties["SIZE2"]) > 0) ? $arProperties["SIZE2"] : 4);
		$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 40);
		$arProperties["VALUE"] = htmlspecialcharsEx(isset($curVal) ? $curVal : $arProperties["DEFAULT_VALUE"]);
		$arProperties["VALUE_FORMATED"] = $arProperties["VALUE"];
	}
	elseif ($arProperties["TYPE"] == "LOCATION")
	{
		if(CSaleLocation::isLocationProEnabled())
		{
			// default value for location is always kept in CODE
			if(!strlen($curVal) && strlen($arProperties["DEFAULT_VALUE"]))
				$curVal = CSaleLocation::getLocationIDbyCODE($arProperties["DEFAULT_VALUE"]);

			$arProperties["VALUE"] = $curVal;

			$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];

			if($arProperties["IS_LOCATION4TAX"]=="Y")
				$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

			$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];

			$arProperties["VARIANTS"][] = array('ID' => $curVal, 'SELECTED' => 'Y'); // dumb
		}
		else
		{
			//enable location town text
			if ($_REQUEST["is_ajax_post"] == "Y" && $arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0 && isset($_REQUEST["ORDER_PROP_".$arProperties["ID"]]))
			{
				$rsLocationsList = CSaleLocation::GetList(
					array(),
					array("ID" => $curVal),
					false,
					false,
					array("ID", "CITY_ID")
				);
				$arCity = $rsLocationsList->GetNext();

				if (intval($arCity["CITY_ID"]) <= 0)
					unset($arDeleteFieldLocation[$arProperties["ID"]]);
				else
					$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}
			elseif ($arProperties["IS_LOCATION"] == "Y" && intval($arProperties["INPUT_FIELD_LOCATION"]) > 0)
			{
				$arDeleteFieldLocation[$arProperties["ID"]] = $arProperties["INPUT_FIELD_LOCATION"];
			}

			$arProperties["SIZE1"] = ((intval($arProperties["SIZE1"]) > 0) ? $arProperties["SIZE1"] : 1);
			$dbVariants = CSaleLocation::GetList(
					array("SORT" => "ASC", "COUNTRY_NAME_LANG" => "ASC", "CITY_NAME_LANG" => "ASC"),
					array("LID" => LANGUAGE_ID),
					false,
					false,
					array("ID", "COUNTRY_NAME", "CITY_NAME", "SORT", "COUNTRY_NAME_LANG", "CITY_NAME_LANG")
				);
			while ($arVariants = $dbVariants->GetNext())
			{
				if (intval($arVariants["ID"]) == intval($curVal) || (!isset($curVal) && intval($arVariants["ID"]) == intval($arProperties["DEFAULT_VALUE"])) || (strlen($curLocation) > 0 && ToUpper($curLocation) == ToUpper($arVariants["CITY_NAME"])))
				{
					$arVariants["SELECTED"] = "Y";
					$arProperties["VALUE_FORMATED"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
					$arProperties["VALUE"] = $arVariants["ID"];

					if ($arProperties["IS_LOCATION"]=="Y")
						$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
					if ($arProperties["IS_LOCATION4TAX"]=="Y")
						$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];

				}
				$arVariants["NAME"] = $arVariants["COUNTRY_NAME"].((strlen($arVariants["CITY_NAME"]) > 0) ? " - " : "").$arVariants["CITY_NAME"];
				$arProperties["VARIANTS"][] = $arVariants;
			}
			if(count($arProperties["VARIANTS"]) == 1)
			{
				$arProperties["VALUE"] = $arProperties["VARIANTS"][0]["ID"];
				if($arProperties["IS_LOCATION"]=="Y")
					$arUserResult["DELIVERY_LOCATION"] = $arProperties["VALUE"];
				if($arProperties["IS_LOCATION4TAX"]=="Y")
					$arUserResult["TAX_LOCATION"] = $arProperties["VALUE"];
			}
		}
	}
	elseif ($arProperties["TYPE"] == "RADIO")
	{
		$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
		while ($arVariants = $dbVariants->GetNext())
		{
			if ($arVariants["VALUE"] == $curVal || (!isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"]))
			{
				$arVariants["CHECKED"]="Y";
				$arProperties["VALUE_FORMATED"] = $arVariants["NAME"];
			}

			$arProperties["VARIANTS"][] = $arVariants;
		}
	}
	elseif ($arProperties["TYPE"] == "FILE")
	{
		$arProperties["SIZE1"] = intval($arProperties["SIZE1"]);
		$arProperties["VALUE"] = isset($curVal) ? CSaleHelper::getFileInfo($curVal) : $arProperties["DEFAULT_VALUE"];
	}

	return $arProperties;
}