当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleLocation::isLocationProMigrated方法代码示例

本文整理汇总了PHP中CSaleLocation::isLocationProMigrated方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLocation::isLocationProMigrated方法的具体用法?PHP CSaleLocation::isLocationProMigrated怎么用?PHP CSaleLocation::isLocationProMigrated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleLocation的用法示例。


在下文中一共展示了CSaleLocation::isLocationProMigrated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRegionsList

 /**
  * getRegionsList
  * @return array regions (locations) list
  */
 public static function getRegionsList($countryId = 0, $bFlip = false)
 {
     static $arRegions = array();
     $flipIndex = intval($bFlip);
     if (isset($arRegions[$countryId][$flipIndex])) {
         return $arRegions[$countryId][$flipIndex];
     }
     if (CSaleLocation::isLocationProMigrated()) {
         $types = array();
         $res = \Bitrix\Sale\Location\TypeTable::getList(array('select' => array('ID', 'CODE')));
         while ($item = $res->fetch()) {
             $types[$item['CODE']] = $item['ID'];
         }
         $filter = array(array('LOGIC' => 'OR', array('=TYPE_ID' => $types['CITY'], '=NAME.LANGUAGE_ID' => LANGUAGE_ID, array('LOGIC' => 'OR', array('=PARENT.TYPE_ID' => $types['COUNTRY']), array('=PARENT.TYPE_ID' => $types['COUNTRY_DISTRICT']), array('=PARENT_ID' => '0'))), array('=TYPE_ID' => $types['REGION'])));
         if (intval($countryId)) {
             $filter['=PARENTS.TYPE_ID'] = $types['COUNTRY'];
             $filter['=PARENTS.ID'] = $countryId;
         }
         $dbRegionList = \Bitrix\Sale\Location\LocationTable::getList(array('filter' => $filter, 'select' => array('ID', 'CODE', 'NAME_LANG' => 'NAME.NAME'), 'order' => array('NAME.NAME' => 'asc')));
     } else {
         $arFilterRegion = array();
         if (intval($countryId) > 0) {
             $arFilterRegion["COUNTRY_ID"] = $countryId;
         }
         $dbRegionList = CSaleLocation::GetRegionList(array("NAME_LANG" => "ASC"), $arFilterRegion, LANGUAGE_ID);
     }
     $key = 'ID';
     while ($arRegionList = $dbRegionList->Fetch()) {
         if ($key == 'ID' && isset($arRegionList['CODE'])) {
             $key = 'CODE';
         }
         if ($key == 'CODE' && strlen($arRegionList['CODE']) <= 0) {
             continue;
         }
         $arRegions[$countryId][0][$arRegionList[$key]] = $arRegionList["NAME_LANG"];
         // $bFlip == false
         $arRegions[$countryId][1][$arRegionList["NAME_LANG"]] = $arRegionList[$key];
         // $bFlip == true
     }
     return isset($arRegions[$countryId][$flipIndex]) ? $arRegions[$countryId][$flipIndex] : array();
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:45,代码来源:delivery_helper.php

示例2: onBeforePerformIteration

	public function onBeforePerformIteration()
	{
		if(\CSaleLocation::isLocationProMigrated())
			throw new Main\SystemException('Already migrated');

		if(!isset($this->data['migrator_data']))
			$this->migrator = new CUpdaterLocationPro();
		else
			$this->migrator = unserialize($this->data['migrator_data']);
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:10,代码来源:migration.php

示例3: addPropertyValueField

 protected static function addPropertyValueField($tableAlias = 'V', &$arFields, &$arSelectFields)
 {
     $tableAlias = \Bitrix\Main\HttpApplication::getConnection()->getSqlHelper()->forSql($tableAlias);
     // locations kept in CODEs, but must be shown as IDs
     if (CSaleLocation::isLocationProMigrated()) {
         $arSelectFields = array_merge(array('PROP_TYPE'), $arSelectFields);
         // P.TYPE should be there and go above our join
         $arFields['VALUE'] = array("FIELD" => "\n\t\t\t\tCASE\n\n\t\t\t\t\tWHEN\n\t\t\t\t\t\tP.TYPE = 'LOCATION'\n\t\t\t\t\tTHEN\n\t\t\t\t\t\tCAST(L.ID as " . \Bitrix\Sale\Location\DB\Helper::getSqlForDataType('char', 255) . ")\n\n\t\t\t\t\tELSE\n\t\t\t\t\t\t" . $tableAlias . ".VALUE\n\t\t\t\tEND\n\t\t\t", "TYPE" => "string", "FROM" => "LEFT JOIN b_sale_location L ON (P.TYPE = 'LOCATION' AND " . $tableAlias . ".VALUE IS NOT NULL AND " . $tableAlias . ".VALUE = L.CODE)");
         $arFields['VALUE_ORIG'] = array("FIELD" => $tableAlias . ".VALUE", "TYPE" => "string");
     } else {
         $arFields['VALUE'] = array("FIELD" => $tableAlias . ".VALUE", "TYPE" => "string");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:order_user_props_value.php

示例4: Update

 function Update($ID, $arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     // need to check here if we got CODE or ID came
     if (isset($arFields['VALUE']) && (string) $arFields['VALUE'] != '' && CSaleLocation::isLocationProMigrated()) {
         $propValue = self::GetByID($ID);
         if ($propValue['TYPE'] == 'LOCATION') {
             $arFields['VALUE'] = CSaleLocation::tryTranslateIDToCode($arFields['VALUE']);
         }
     }
     $strUpdate = $DB->PrepareUpdate("b_sale_user_props_value", $arFields);
     $strSql = "UPDATE b_sale_user_props_value SET " . "\t" . $strUpdate . " " . "WHERE ID = " . $ID . " ";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     return $ID;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:16,代码来源:order_user_props_value.php

示例5: getLocationString

 public static function getLocationString($locID)
 {
     if (CSaleLocation::isLocationProMigrated()) {
         if (!strlen($locID)) {
             return '';
         }
         if ((string) $locID === (string) intval($locID)) {
             return \Bitrix\Sale\Location\Admin\LocationHelper::getLocationStringById($locID);
         } else {
             return \Bitrix\Sale\Location\Admin\LocationHelper::getLocationStringByCode($locID);
         }
     } else {
         if (!is_int($locID)) {
             $locID = (int) $locID;
         }
         if ($locID <= 0 || !(IsModuleInstalled('sale') && CModule::IncludeModule('sale'))) {
             return '';
         }
         $entity = new CSaleLocation();
         return $entity->GetLocationString($locID);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:crm_locations.php

示例6: IncludeModuleLangFile

use Bitrix\Main;
use Bitrix\Main\Loader;
use Bitrix\Main\SiteTable;
use Bitrix\Main\Config\Option;
use Bitrix\Sale\SalesZone;
use Bitrix\Sale;
$SALE_RIGHT = $APPLICATION->GetGroupRight($module_id);
if ($SALE_RIGHT >= "R") {
    IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/options.php');
    IncludeModuleLangFile(__FILE__);
    Main\Page\Asset::getInstance()->addJs('/bitrix/js/sale/options.js');
    $APPLICATION->SetAdditionalCSS("/bitrix/themes/.default/sale.css");
    Loader::includeModule('sale');
    Loader::includeModule('currency');
    $lpEnabled = CSaleLocation::isLocationProEnabled();
    $lMigrated = CSaleLocation::isLocationProMigrated();
    function checkAccountNumberValue($templateType, $number_data, $number_prefix)
    {
        $res = true;
        switch ($templateType) {
            case 'NUMBER':
                if (strlen($number_data) <= 0 || strlen($number_data) > 7 || !preg_match('/^[0-9]+$/', $number_data) || intval($number_data) < intval(COption::GetOptionString("sale", "account_number_data", ""))) {
                    $res = false;
                }
                break;
            case 'PREFIX':
                if (strlen($number_prefix) <= 0 || strlen($number_prefix) > 7 || preg_match('/[^a-zA-Z0-9_-]/', $number_prefix)) {
                    $res = false;
                }
                break;
        }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:options.php

示例7: calculatePackPrice

 private static function calculatePackPrice($arPackage, $profile, $arConfig, $arLocationTo)
 {
     $arDebug = array();
     /*1 Land price
     		1.1 Base Price less 10 kg*/
     $code = self::getRegionCodeByOldName($arLocationTo['REGION_NAME_LANG']);
     // old location
     if (strlen($code) <= 0 && CSaleLocation::isLocationProMigrated()) {
         $dbRes = Location\LocationTable::getList(array('filter' => array('=TYPE.CODE' => 'REGION', '=REGION_ID' => intval($arLocationTo["REGION_ID"]), '=CITY_ID' => false), 'select' => array('ID', 'CODE', 'NAME')));
         if ($locReg = $dbRes->fetch()) {
             $code = $locReg["CODE"];
         }
     }
     if (strlen($code) <= 0) {
         throw new \Bitrix\Main\SystemException(GetMessage("SALE_DH_RP_ERROR_LOCATION_NOT_FOUND"));
     }
     $zoneTo = self::getConfValue($arConfig, 'REG_' . $code);
     $basePrice = floatval(self::getConfValue($arConfig, 'ZONE_RATE_MAIN_' . $zoneTo));
     $arDebug[] = 'Base Price less 500 g: ' . $basePrice;
     if ($arPackage['WEIGHT'] > self::$BASE_WEIGHT) {
         $addWeight = ceil($arPackage['WEIGHT'] / self::$BASE_WEIGHT - 1);
         $addPrice = floatval(self::getConfValue($arConfig, 'ZONE_RATE_ADD_' . $zoneTo));
         $arDebug[] = 'Price for additional weight more than 500 g: ' . $addWeight * $addPrice;
         $basePrice += $addWeight * $addPrice;
     }
     $totalPrice = $basePrice;
     /* 1.2 Service "heavy weight" 10 - 20 kg*/
     $hwPrice = 0;
     if ($arPackage['WEIGHT'] >= self::$MAX_WEIGHT) {
         $hwTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_HEAVY_WEIGHT . '_value'));
         $hwPrice += $totalPrice * $hwTarif / 100;
         $arDebug[] = 'Heavy weight: ' . $hwPrice;
         $totalPrice += $hwPrice;
     }
     /* 1.5 Service "fragile" */
     $fPrice = 0;
     if (self::isConfCheckedVal($arConfig, 'service_' . self::$TARIF_FRAGILE . '_enabled')) {
         $fTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_FRAGILE . '_value'));
         $fPrice += $totalPrice * $fTarif / 100;
         $arDebug[] = 'Fragile: ' . $fPrice;
         $totalPrice += $fPrice;
     }
     /* 4. Service "declared value" */
     $dvPrice = 0;
     if (self::isConfCheckedVal($arConfig, 'service_' . self::$TARIF_DECLARED_VAL . '_enabled')) {
         $dvTarif = floatval(self::getConfValue($arConfig, 'service_' . self::$TARIF_DECLARED_VAL . '_value'));
         $dvPrice += ($arPackage['PRICE'] + $totalPrice) * $dvTarif;
         $arDebug[] = 'Declared value: ' . $dvPrice;
         $totalPrice += $dvPrice;
     }
     if ($profile == 'avia') {
         $aviaPrice = 0;
         $aviaPrice = floatval(self::getConfValue($arConfig, 'tarif_avia_' . self::$TARIF_AVIA_STANDART . '_value'));
         $arDebug[] = 'avia price: ' . $aviaPrice;
         $totalPrice += $aviaPrice;
         $aviaHeavyPrice = 0;
         if ($arPackage['WEIGHT'] > self::$MAX_WEIGHT) {
             $aviaHeavyPrice = floatval(self::getConfValue($arConfig, 'tarif_avia_' . self::$TARIF_AVIA_HEAVY . '_value'));
             $arDebug[] = 'avia heavy price: ' . $aviaHeavyPrice;
             $totalPrice += $aviaHeavyPrice;
         }
     }
     return $totalPrice;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:64,代码来源:delivery_rus_post.php

示例8: GetLocationList

 /**
  * @param array $arFilter
  * @return bool|CDBResult
  * @deprecated
  */
 function GetLocationList($arFilter = array())
 {
     if (CSaleLocation::isLocationProMigrated()) {
         try {
             return CSaleLocation::getDenormalizedLocationList(self::CONN_ENTITY_NAME, $arFilter);
         } catch (Exception $e) {
             $dbResult = new CDBResult();
             $dbResult->InitFromArray(array());
             return $dbResult;
         }
     } else {
         global $DB;
         $arSqlSearch = array();
         if (!is_array($arFilter)) {
             $filter_keys = array();
         } else {
             $filter_keys = array_keys($arFilter);
         }
         $countFilterKey = count($filter_keys);
         for ($i = 0; $i < $countFilterKey; $i++) {
             $val = $DB->ForSql($arFilter[$filter_keys[$i]]);
             if (strlen($val) <= 0) {
                 continue;
             }
             $key = $filter_keys[$i];
             if ($key[0] == "!") {
                 $key = substr($key, 1);
                 $bInvert = true;
             } else {
                 $bInvert = false;
             }
             switch (ToUpper($key)) {
                 case "DELIVERY_ID":
                     $arSqlSearch[] = "DL.DELIVERY_ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                     break;
                 case "LOCATION_ID":
                     $arSqlSearch[] = "DL.LOCATION_CODE " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                     break;
                 case "LOCATION_TYPE":
                     $arSqlSearch[] = "DL.LOCATION_TYPE " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                     break;
             }
         }
         $strSqlSearch = "";
         $countSqlSearch = count($arSqlSearch);
         for ($i = 0; $i < $countSqlSearch; $i++) {
             $strSqlSearch .= " AND ";
             $strSqlSearch .= " (" . $arSqlSearch[$i] . ") ";
         }
         $strSql = "SELECT DL.DELIVERY_ID, DL.LOCATION_CODE as LOCATION_ID, DL.LOCATION_TYPE " . "FROM b_sale_delivery2location DL " . "WHERE 1 = 1 " . "\t" . $strSqlSearch . " ";
         $db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         return $db_res;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:delivery.php

示例9: getLocationCODEbyID

	public static function getLocationCODEbyID($id)
	{
		if(CSaleLocation::isLocationProMigrated() && intval($id))
		{
			// we must convert ID to CODE
			$item = Location\LocationTable::getById($id)->fetch();

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

			return $item['CODE'];
		}

		return $id;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:15,代码来源:location.php

示例10: Array

			$arResult["ORDER_PROP"]["PRINT"][$arProperties["ID"]] = Array("ID" => $arProperties["ID"], "NAME" => $arProperties["NAME"], "VALUE" => $arProperties["VALUE_FORMATED"], "SHOW_GROUP_NAME" => $arProperties["SHOW_GROUP_NAME"]);
		}

		// additional city property process
		foreach($propIndex as $propId => $propDesc)
		{
			if(intval($propDesc['INPUT_FIELD_LOCATION']) && isset($propIndex[$propDesc['INPUT_FIELD_LOCATION']]))
				$propIndex[$propDesc['INPUT_FIELD_LOCATION']]['IS_ALTERNATE_LOCATION_FOR'] = $propId;
		}

		foreach(GetModuleEvents("sale", "OnSaleComponentOrderOneStepOrderProps", true) as $arEvent)
			ExecuteModuleEventEx($arEvent, Array(&$arResult, &$arUserResult, &$arParams));
		/* Order Props End */

		//delete prop for text location
		if (!CSaleLocation::isLocationProMigrated() && count($arDeleteFieldLocation) > 0)
		{
			foreach ($arDeleteFieldLocation as $fieldId)
				unset($arResult["ORDER_PROP"]["USER_PROPS_Y"][$fieldId]);
		}

		/* Delivery Begin */
		if ((int)$arUserResult["DELIVERY_LOCATION"] > 0)
		{
			$arFilter = array(
				"COMPABILITY" => array(
					"WEIGHT" => $arResult["ORDER_WEIGHT"],
					"PRICE" => $arResult["ORDER_PRICE"],
					"LOCATION_FROM" => COption::GetOptionString('sale', 'location', false, SITE_ID),
					"LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"],
					"LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"],
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:component.php

示例11: obtainProps

 /**
  * 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->GetNext()) {
         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::isLocationProMigrated()) {
                         $locationName = Location\Admin\LocationHelper::getLocationStringById($arOrderProps["VALUE"]);
                     } else {
                         $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;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:73,代码来源:class.php

示例12: Update

	function Update($ID, $arFields, $arOptions = array())
	{
		global $DB;

		$ID = intval($ID);

		if ($ID <= 0 || !CSaleDelivery::CheckFields("UPDATE", $arFields))
			return false;

		if (array_key_exists("LOGOTIP", $arFields) && is_array($arFields["LOGOTIP"]))
			$arFields["LOGOTIP"]["MODULE_ID"] = "sale";

		CFile::SaveForDB($arFields, "LOGOTIP", "sale/delivery/logotip");

		$strUpdate = $DB->PrepareUpdate("b_sale_delivery", $arFields);

		$strSql = "UPDATE b_sale_delivery SET ".$strUpdate." WHERE ID = ".$ID."";
		$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

		if (is_set($arFields, "LOCATIONS"))
		{
			if(CSaleLocation::isLocationProMigrated())
			{
				Helper::resetLocationsForEntity($ID, $arFields['LOCATIONS'], self::CONN_ENTITY_NAME, !!$arOptions['EXPECT_LOCATION_CODES']);
			}
			else
			{
				$DB->Query("DELETE FROM b_sale_delivery2location WHERE DELIVERY_ID = ".$ID."");

				$countarFieldLoc = count($arFields["LOCATIONS"]);
				for ($i = 0; $i < $countarFieldLoc; $i++)
				{
					// change location id to location code
					$arFields["LOCATIONS"][$i]['LOCATION_CODE'] = $arFields["LOCATIONS"][$i]['LOCATION_ID'];
					unset($arFields["LOCATIONS"][$i]['LOCATION_ID']);
					
					$arInsert = $DB->PrepareInsert("b_sale_delivery2location", $arFields["LOCATIONS"][$i]);

					$strSql =
						"INSERT INTO b_sale_delivery2location(DELIVERY_ID, ".$arInsert[0].") ".
						"VALUES(".$ID.", ".$arInsert[1].")";
					$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
				}
			}
		}

		if (is_set($arFields, "PAY_SYSTEM"))
		{
			CSaleDelivery::UpdateDeliveryPay($ID, $arFields["PAY_SYSTEM"]);
		}

		return $ID;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:53,代码来源:delivery.php

示例13: strlen

							}
							elseif ($arOrderProps["TYPE"] == "LOCATION")
							{
								$arOrder["LOCATION_TO"] = $arOrderProps["VALUE"];

								if(CSaleLocation::isLocationProEnabled())
								{
									$locationString = Location\Admin\LocationHelper::getLocationStringByCode($arOrderProps['VALUE']);
									if(!strlen($locationString))
										$locationString = $arOrderProps['VALUE'];

									print(htmlspecialcharsEx($locationString));
								}
								else
								{
									if(CSaleLocation::isLocationProMigrated())
										$arOrderProps["VALUE"] = CSaleLocation::getLocationIDbyCODE($arOrderProps["VALUE"]);

									$arVal = CSaleLocation::GetByID($arOrderProps["VALUE"], LANG);
									$locationString = $arVal["COUNTRY_NAME"];

									if (strlen($arVal["REGION_NAME"]) > 0 && strlen($locationString) > 0)
										$locationString .= " - ".$arVal["REGION_NAME"];
									elseif (strlen($locationString) <= 0 && strlen($arVal["REGION_NAME"]) > 0)
										$locationString = $arVal["REGION_NAME"];

									if (strlen($locationString) > 0 && strlen($arVal["CITY_NAME"]) > 0)
										$locationString .= " - ".$arVal["CITY_NAME"];
									elseif (strlen($locationString) <= 0  && strlen($arVal["CITY_NAME"]) > 0)
										$locationString = $arVal["CITY_NAME"];
开发者ID:akniyev,项目名称:arteva.ru,代码行数:30,代码来源:order_detail.php

示例14: GetList


//.........这里部分代码省略.........
         }
         switch (ToUpper($key)) {
             case "ID":
                 $arSqlSearch[] = "TR.ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                 break;
             case "LID":
                 $arSqlSearch[] = "T.LID " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "CODE":
                 $arSqlSearch[] = "T.CODE " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "TAX_ID":
                 $arSqlSearch[] = "TR.TAX_ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                 break;
             case "PERSON_TYPE_ID":
                 $arSqlSearch[] = " (TR.PERSON_TYPE_ID " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " OR TR.PERSON_TYPE_ID = 0 OR TR.PERSON_TYPE_ID IS NULL) ";
                 break;
             case "CURRENCY":
                 $arSqlSearch[] = "TR.CURRENCY " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "IS_PERCENT":
                 $arSqlSearch[] = "TR.IS_PERCENT " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "IS_IN_PRICE":
                 $arSqlSearch[] = "TR.IS_IN_PRICE " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "ACTIVE":
                 $arSqlSearch[] = "TR.ACTIVE " . ($bInvert ? "<>" : "=") . " '" . $val . "' ";
                 break;
             case "APPLY_ORDER":
                 $arSqlSearch[] = "TR.APPLY_ORDER " . ($bInvert ? "<>" : "=") . " " . IntVal($val) . " ";
                 break;
             case "LOCATION":
                 if (CSaleLocation::isLocationProMigrated()) {
                     try {
                         $class = self::CONN_ENTITY_NAME . 'Table';
                         $arSqlSearch[] = "\tTR.ID in (" . $class::getConnectedEntitiesQuery(IntVal($val), 'id', array('select' => array('ID'))) . ") ";
                     } catch (Exception $e) {
                     }
                 } else {
                     $arSqlSearch[] = "\tTR.ID = TR2L.TAX_RATE_ID " . "\tAND (TR2L.LOCATION_CODE = " . IntVal($val) . " AND TR2L.LOCATION_TYPE = 'L' " . "\t\tOR L2LG.LOCATION_ID = " . IntVal($val) . " AND TR2L.LOCATION_TYPE = 'G') ";
                     $arSqlSearchFrom[] = ", b_sale_tax2location TR2L " . "\tLEFT JOIN b_sale_location2location_group L2LG ON (TR2L.LOCATION_TYPE = 'G' AND TR2L.LOCATION_CODE = L2LG.LOCATION_GROUP_ID) ";
                 }
                 break;
         }
     }
     $strSqlSearch = "";
     $countSqlSearch = count($arSqlSearch);
     for ($i = 0; $i < $countSqlSearch; $i++) {
         $strSqlSearch .= " AND ";
         $strSqlSearch .= " (" . $arSqlSearch[$i] . ") ";
     }
     $strSqlSearchFrom = "";
     $countSqlSearchForm = count($arSqlSearchFrom);
     for ($i = 0; $i < $countSqlSearchForm; $i++) {
         $strSqlSearchFrom .= " " . $arSqlSearchFrom[$i] . " ";
     }
     $strSql = "SELECT DISTINCT TR.ID, TR.TAX_ID, TR.PERSON_TYPE_ID, TR.VALUE, TR.CURRENCY, " . "\tTR.IS_PERCENT, TR.IS_IN_PRICE, TR.APPLY_ORDER, " . $DB->DateToCharFunction("TR.TIMESTAMP_X", "FULL") . " as TIMESTAMP_X, " . "\tT.LID, T.NAME, T.DESCRIPTION, TR.ACTIVE, T.CODE " . "FROM b_sale_tax_rate TR, b_sale_tax T " . "\t" . $strSqlSearchFrom . " " . "WHERE TR.TAX_ID = T.ID " . "\t" . $strSqlSearch . " ";
     $arSqlOrder = array();
     foreach ($arOrder as $by => $order) {
         $by = ToUpper($by);
         $order = ToUpper($order);
         if ($order != "ASC") {
             $order = "DESC";
         }
         if ($by == "ID") {
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:tax_rate.php

示例15: Update


//.........这里部分代码省略.........
  *       )
  * );
  *  
  * $arFields["CITY"] = $arCity;
  *  
  * if (!CSaleLocation::Update(6, $arFields))
  *    echo "Ошибка изменения местоположения";
  * ?&gt;
  * 
  * 
  * 
  *  function CreateCityRussia($arFields, $regionName, &amp;$strError) {
  *    // Ищем группу местоположений, к которой необходимо привязать местоположение
  *    $locGroupID = 0;
  *    $resLocationGroup = CSaleLocationGroup::GetList(array("ID"=&gt;"ASC"), array());
  *    while($arLocationGroup = $resLocationGroup-&gt;Fetch()) {
  *      if(mb_strtolower($arLocationGroup["NAME"], "Windows-1251") == mb_strtolower($regionName, "Windows-1251")) $locGroupID = $arLocationGroup["ID"];
  *    }
  *    
  *    // Если группа найдена, определяем список привязанных к ней местоположений и добавляем к списку новое
  *    if($locGroupID) {
  *      // Создаем новый город в стране Россия и новое местоположение
  *      $arCoutry = CSaleLocation::GetList(array(), array("LID" =&gt; LANGUAGE_ID, "CITY_NAME" =&gt; false, "COUNTRY_NAME" =&gt; "Россия"))-&gt;Fetch();
  *      $cityId = CSaleLocation::AddCity($arFields);
  *      $ID = CSaleLocation::AddLocation(array("COUNTRY_ID" =&gt; $arCoutry['COUNTRY_ID'], "CITY_ID" =&gt; $cityId));
  *      
  *      // Формируем новый список местоположений группы
  *      $resLocGroup = CSaleLocationGroup::GetLocationList(array("LOCATION_GROUP_ID" =&gt; $locGroupID));
  *      $locList = array();
  *      while($arLocGroup = $resLocGroup-&gt;Fetch()) {
  *        $locList[] = $arLocGroup["LOCATION_ID"];
  *      }
  *      $locList[] = $ID;
  *      
  *      // Записываем новый список местоположений группы
  *      $arFields = CSaleLocationGroup::GetByID($locGroupID);
  *      $arFields["LOCATION_ID"] = $locList;
  *      if (!CSaleLocationGroup::Update($locGroupID, $arFields))
  *         $strError = "Ошибка добавления местоположения к группе местоположений";
  *      return $ID;
  *    } else {
  *      // В противном случае записываем сообщение об ошибке
  *      $strError = "Ошибка создания местоположения: Не найдена группа местоположений $regionName";
  *      return false; 
  *    }
  *     }
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalelocationgroup/csalelocationgroup__update.c02c467b.php
  * @author Bitrix
  */
 public static function Update($ID, $arFields)
 {
     global $DB;
     $ID = IntVal($ID);
     if (!CSaleLocationGroup::CheckFields("UPDATE", $arFields)) {
         return false;
     }
     $db_events = GetModuleEvents("sale", "OnBeforeLocationGroupUpdate");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
             return false;
         }
     }
     $events = GetModuleEvents("sale", "OnLocationGroupUpdate");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($ID, $arFields));
     }
     $strUpdate = $DB->PrepareUpdate("b_sale_location_group", $arFields);
     $strSql = "UPDATE b_sale_location_group SET " . $strUpdate . " WHERE ID = " . $ID . "";
     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     if (is_set($arFields, "LANG")) {
         $DB->Query("DELETE FROM b_sale_location_group_lang WHERE LOCATION_GROUP_ID = " . $ID . "");
         $countFieldLang = count($arFields["LANG"]);
         for ($i = 0; $i < $countFieldLang; $i++) {
             $arInsert = $DB->PrepareInsert("b_sale_location_group_lang", $arFields["LANG"][$i]);
             $strSql = "INSERT INTO b_sale_location_group_lang(LOCATION_GROUP_ID, " . $arInsert[0] . ") " . "VALUES(" . $ID . ", " . $arInsert[1] . ")";
             $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
     }
     if (is_set($arFields, "LOCATION_ID")) {
         if (CSaleLocation::isLocationProMigrated()) {
             try {
                 $entityClass = self::CONN_ENTITY_NAME . 'Table';
                 $entityClass::resetMultipleForOwner($ID, array(Location\Connector::DB_LOCATION_FLAG => $entityClass::normalizeLocationList($arFields["LOCATION_ID"])));
             } catch (Exception $e) {
             }
         } else {
             $DB->Query("DELETE FROM b_sale_location2location_group WHERE LOCATION_GROUP_ID = " . $ID . "");
             $countArFieldLoc = count($arFields["LOCATION_ID"]);
             for ($i = 0; $i < $countArFieldLoc; $i++) {
                 $strSql = "INSERT INTO b_sale_location2location_group(LOCATION_ID, LOCATION_GROUP_ID) " . "VALUES(" . $arFields["LOCATION_ID"][$i] . ", " . $ID . ")";
                 $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             }
         }
     }
     return $ID;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:location_group.php


注:本文中的CSaleLocation::isLocationProMigrated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。