if(typeof so.messages['stage_'+stageCode] == 'undefined'){
					this.setStatusText('Unknown status', true);
					sv.stage = false;
					return;
				}

				this.setStatusText(this.opts.messages['stage_'+stageCode], false);
				sv.stage = stageCode;
			}
		});

		<?if(!CSaleLocation::isLocationProMigrated()):?>

			new BX.locationMigration(<?php 
echo CUtil::PhpToJSObject(array('url' => Helper::getMigrationUrl(), 'scope' => 'location-migration', 'ajaxFlag' => 'AJAX_MODE', 'redirectTo' => LocationHelper::getListUrl(0), 'messages' => array('error_occured' => Loc::getMessage('SALE_LOCATION_MIGRATION_ERROR'), 'stage_CREATE_TYPES' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_CREATE_TYPES'), 'stage_CONVERT_TREE' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_CONVERT_TREE'), 'stage_CONVERT_ZONES' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_CONVERT_ZONES'), 'stage_CONVERT_LINKS' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_CONVERT_LINKS'), 'stage_COPY_DEFAULT_LOCATIONS' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_COPY_DEFAULT_LOCATIONS'), 'stage_COPY_ZIP_CODES' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_COPY_ZIP_CODES'), 'stage_COMPLETE' => Loc::getMessage('SALE_LOCATION_MIGRATION_STAGE_COMPLETE'))), false, false, true);
?>
);

		<?endif?>

	</script>

	<style>
		.adm-loc-m-statusbar {
			margin-top: 10px;
			margin-bottom: -15px;
		}
		.bx-ui-loc-m-progressbar{
			display: none;
		}
示例#2
0
 public static function SetTaxRateLocation($ID, $arFields, $arOptions = array())
 {
     if (CSaleLocation::isLocationProMigrated()) {
         Helper::resetLocationsForEntity($ID, $arFields, self::CONN_ENTITY_NAME, !!$arOptions['EXPECT_LOCATION_CODES']);
     } else {
         global $DB;
         $ID = intval($ID);
         if (0 >= $ID) {
             return;
         }
         $DB->Query("DELETE FROM b_sale_tax2location WHERE TAX_RATE_ID = " . $ID);
         if (is_array($arFields)) {
             $countField = count($arFields);
             for ($i = 0; $i < $countField; $i++) {
                 $arFields[$i]["LOCATION_ID"] = intval($arFields[$i]["LOCATION_ID"]);
                 if ($arFields[$i]["LOCATION_TYPE"] != "G") {
                     $arFields[$i]["LOCATION_TYPE"] = "L";
                 }
                 if ($arFields[$i]["LOCATION_ID"] > 0) {
                     $strSql = "INSERT INTO b_sale_tax2location(TAX_RATE_ID, LOCATION_CODE, LOCATION_TYPE) " . "VALUES(" . $ID . ", " . $arFields[$i]["LOCATION_ID"] . ", '" . $arFields[$i]["LOCATION_TYPE"] . "')";
                     $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
                 }
             }
         }
     }
 }
 /**
  * Function checks if user have basic permissions to launch the component
  * @return void
  */
 protected function checkPermissions()
 {
     $result = true;
     if (!LocationHelper::checkLocationEnabled()) {
         $this->errors['FATAL'][] = 'Locations were disabled or data has not been converted';
         $result = false;
     }
     return $result;
 }
示例#4
0
 static function initJs()
 {
     static $done = false;
     if (!$done) {
         $done = true;
         \CJSCore::RegisterExt('input', array('js' => '/bitrix/js/sale/input.js', 'lang' => '/bitrix/modules/sale/lang/' . LANGUAGE_ID . '/lib/internals/input.php'));
         \CJSCore::Init(array('input'));
         print '<div style="display:none">';
         $GLOBALS['APPLICATION']->IncludeComponent("bitrix:sale.location.selector." . \Bitrix\Sale\Location\Admin\LocationHelper::getWidgetAppearance(), "", array("ID" => '', "CODE" => '', "INPUT_NAME" => 'SALE_LOCATION_SELECTOR_RESOURCES', "PROVIDE_LINK_BY" => 'code', "FILTER_BY_SITE" => 'Y', "SHOW_DEFAULT_LOCATIONS" => 'Y', "SEARCH_BY_PRIMARY" => 'Y', "JS_CONTROL_GLOBAL_ID" => 'SALE_LOCATION_SELECTOR_RESOURCES', "USE_JS_SPAWN" => 'Y'), false, array('HIDE_ICONS' => 'Y'));
         print '</div>';
     }
 }
示例#5
0
	/**
	 * Function checks if user have basic permissions to launch the component
	 * @throws Exception
	 * @return void
	 */
	protected function checkPermissions()
	{
		$result = true;

		if ($GLOBALS['APPLICATION']->GetGroupRight("sale") < "W")
		{
			$this->errors['FATAL'][] = Loc::getMessage("SALE_SLI_SALE_MODULE_WRITE_ACCESS_DENIED");
			$result = false;
		}

		if(!LocationHelper::checkLocationEnabled())
		{
			$this->errors['FATAL'][] = 'Locations were disabled or data has not been converted';
			$result = false;
		}

		return $result;
	}
示例#6
0
 protected static function checkAccessPermissions($parameters = array())
 {
     if (!is_array($parameters)) {
         $parameters = array();
     }
     $errors = array();
     if ($GLOBALS['APPLICATION']->GetGroupRight("sale") < "W") {
         $errors[] = Loc::getMessage("SALE_SLI_SALE_MODULE_WRITE_ACCESS_DENIED");
     }
     if (!LocationHelper::checkLocationEnabled()) {
         $errors[] = 'Locations were disabled or data has not been converted';
     }
     if ($parameters['CHECK_CSRF']) {
         $post = \Bitrix\Main\Context::getCurrent()->getRequest()->getPostList();
         if (!strlen($post['csrf']) || bitrix_sessid() != $post['csrf']) {
             $errors[] = 'CSRF token is not valid';
         }
     }
     return $errors;
 }
示例#7
0
 protected static function checkAccessPermissions($parameters = array())
 {
     if (!is_array($parameters)) {
         $parameters = array();
     }
     $errors = array();
     $CCrmPerms = new CCrmPerms($GLOBALS['USER']->GetID());
     if ($CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE, 'WRITE')) {
         $errors[] = Loc::getMessage("SALE_CCLI2_CRM_MODULE_WRITE_ACCESS_DENIED");
     }
     if (!LocationHelper::checkLocationEnabled()) {
         $errors[] = 'Locations were disabled or data has not been converted';
     }
     if ($parameters['CHECK_CSRF']) {
         $post = \Bitrix\Main\Context::getCurrent()->getRequest()->getPostList();
         if (!strlen($post['csrf']) || bitrix_sessid() != $post['csrf']) {
             $errors[] = 'CSRF token is not valid';
         }
     }
     return $errors;
 }
示例#8
0
 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);
     }
 }
示例#9
0
 protected function obtainDataConnectors()
 {
     if (!$this->arParams['LINK_ENTITY_NAME']) {
         $this->errors['FATAL'][] = Loc::getMessage('SALE_SLSS_LINK_ENTITY_NAME_NOT_SET');
         return;
     }
     $class = $this->entityClass;
     $parameters = array('select' => array('ID', 'CODE', 'LEFT_MARGIN', 'RIGHT_MARGIN', 'SORT', 'TYPE_ID', 'LNAME' => 'NAME.NAME'), 'filter' => array('NAME.LANGUAGE_ID' => LANGUAGE_ID));
     $linkFld = $this->useCodes ? 'CODE' : 'ID';
     $res = false;
     $points = array();
     // get locations to display
     if ($this->locationsFromRequest !== false) {
         // get from request when form save fails or smth
         $res = self::getEntityListByListOfPrimary(self::LOCATION_ENTITY_NAME, $this->locationsFromRequest, $parameters, $linkFld);
     } elseif (strlen($this->arParams['ENTITY_PRIMARY'])) {
         // get from database, if entity exists
         $res = $class::getConnectedLocations($this->arParams['ENTITY_PRIMARY'], $parameters);
     }
     if ($res !== false) {
         $res->addReplacedAliases(array('LNAME' => 'NAME'));
         while ($item = $res->fetch()) {
             $points[$item['ID']] = $item;
         }
     }
     if (!empty($points)) {
         // same algorythm repeated on client side - fetch PATH for only visible items
         if (count($points) - static::PAGE_SIZE > static::HUGE_TAIL_LEN) {
             $pointsToGetPath = array_slice($points, 0, static::PAGE_SIZE);
         } else {
             $pointsToGetPath = $points;
         }
         try {
             $res = Location\LocationTable::getPathToMultipleNodes($pointsToGetPath, array('select' => array('LNAME' => 'NAME.NAME'), 'filter' => array('NAME.LANGUAGE_ID' => LANGUAGE_ID)));
             while ($item = $res->Fetch()) {
                 $item['ID'] = intval($item['ID']);
                 if (!is_array($item['PATH']) || empty($item['PATH'])) {
                     // we got empty PATH. This is not a normal case, item without a path is not sutable for displaying. Skip.
                     unset($points[$item['ID']]);
                 } else {
                     foreach ($item['PATH'] as &$node) {
                         $node['NAME'] = $node['LNAME'];
                         unset($node['LNAME']);
                     }
                     $points[$item['ID']]['PATH'] = $item['PATH'];
                 }
             }
         } catch (\Bitrix\Main\ArgumentException $e) {
             LocationHelper::informAdminLocationDatabaseFailure();
         }
         // clean up some fields
         foreach ($points as $i => &$location) {
             unset($location['LEFT_MARGIN']);
             // system fields should not figure in $arResult
             unset($location['RIGHT_MARGIN']);
             // same
         }
         unset($location);
     }
     $this->dbResult['CONNECTIONS']['LOCATION'] = $points;
     if ($this->useGroups) {
         $parameters = array('select' => array('ID', 'CODE', 'LNAME' => 'NAME.NAME'), 'filter' => array('NAME.LANGUAGE_ID' => LANGUAGE_ID));
         $res = false;
         $points = array();
         if ($this->groupsFromRequest !== false) {
             $res = self::getEntityListByListOfPrimary('Bitrix\\Sale\\Location\\GroupTable', $this->groupsFromRequest, $parameters, $linkFld);
         } elseif (strlen($this->arParams['ENTITY_PRIMARY'])) {
             $res = $class::getConnectedGroups($this->arParams['ENTITY_PRIMARY'], $parameters);
         }
         if ($res !== false) {
             $res->addReplacedAliases(array('LNAME' => 'NAME'));
             while ($item = $res->fetch()) {
                 $item['ID'] = intval($item['ID']);
                 $points[$item['ID']] = $item;
             }
         }
         $this->dbResult['CONNECTIONS']['GROUP'] = $points;
     }
 }
示例#10
0
 public static function doAjaxStuff($parameters = array())
 {
     $errors = static::checkAccessPermissions(array('CHECK_CSRF' => true));
     $data = array();
     if (count($errors) == 0) {
         $import = static::getImportInstance($parameters);
         $request = static::getRequest();
         // action: restore indexes
         if (isset($request['POST']['RESTORE_INDEXES'])) {
             $import->restoreIndexes();
             $import->unLockProcess();
         }
         // action: process ajax
         if (isset($request['POST']['AJAX_CALL'])) {
             $data = array();
             if ($request['POST']['step'] == 0) {
                 $import->reset();
             }
             @set_time_limit(0);
             $data['PERCENT'] = $import->performStage();
             $data['NEXT_STAGE'] = $import->getStageCode();
             if ($data['PERCENT'] == 100) {
                 $import->logFinalResult();
                 $data['STAT'] = array_values($import->getStatisticsAll());
                 // to force to [] in json
                 Finder::setIndexInvalid();
                 // drop search index
                 LocationHelper::deleteInformer('SALE_LOCATIONPRO_DATABASE_FAILURE');
                 // delete database failure messages, if any
                 $GLOBALS['CACHE_MANAGER']->ClearByTag('sale-location-data');
                 if ($request['POST']['OPTIONS']['DROP_ALL'] == 1 || $request['POST']['ONLY_DELETE_ALL'] == 1) {
                     Main\Config\Option::set('sale', self::LOC2_IMPORT_PERFORMED_OPTION, 'Y');
                 }
             }
         }
     }
     return array('ERRORS' => $errors, 'DATA' => $data);
 }
示例#11
0
				}
				elseif($arProps["TYPE"] == "CHECKBOX")
				{
					if($arProps["VALUE"] == "Y")
					{
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], GetMessage("SALE_YES"));
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], GetMessage("SALE_YES"));
					}
				}
				elseif($arProps["TYPE"] == "LOCATION")
				{
					if(CSaleLocation::isLocationProEnabled())
					{
						$path = htmlspecialcharsEx(Helper::getLocationPathDisplay($arProps["VALUE"]));

						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], $path);
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], $path);
					}
					else
					{
						$arVal = CSaleLocation::GetByID($arProps["VALUE"], LANG);
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], htmlspecialcharsEx($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]));
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], htmlspecialcharsEx($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]));
					}
				}
示例#12
0
             $arProperties["VALUE_FORMATED"] .= ", ";
         }
         $arProperties["VALUE_FORMATED"] .= htmlspecialcharsEx($arVal["NAME"]);
     }
 } elseif ($arProperties["TYPE"] == "LOCATION") {
     $arVal = CSaleLocation::GetByID($curVal, LANGUAGE_ID);
     /*
     $arProperties["VALUE_FORMATED"] = htmlspecialcharsEx($arVal["COUNTRY_NAME"]);
     if (strlen($arVal["COUNTRY_NAME"]) > 0 && strlen($arVal["CITY_NAME"]) > 0)
     	$arProperties["VALUE_FORMATED"] .= " - ";
     $arProperties["VALUE_FORMATED"] .= htmlspecialcharsEx($arVal["CITY_NAME"]);
     */
     $locationName = "";
     if (CSaleLocation::isLocationProMigrated()) {
         if (intval($arVal['ID'])) {
             $locationName = \Bitrix\Sale\Location\Admin\LocationHelper::getLocationStringById($arVal['ID']);
         }
     } else {
         $locationName .= strlen($arVal["COUNTRY_NAME"]) <= 0 ? "" : $arVal["COUNTRY_NAME"];
         if (strlen($arVal["COUNTRY_NAME"]) > 0 && strlen($arVal["REGION_NAME"]) > 0) {
             $locationName .= " - " . $arVal["REGION_NAME"];
         } elseif (strlen($arVal["REGION_NAME"]) > 0) {
             $locationName .= $arVal["REGION_NAME"];
         }
         if (strlen($arVal["COUNTRY_NAME"]) > 0 || strlen($arVal["REGION_NAME"]) > 0) {
             $locationName .= " - " . $arVal["CITY_NAME"];
         } elseif (strlen($arVal["CITY_NAME"]) > 0) {
             $locationName .= $arVal["CITY_NAME"];
         }
     }
     $arProperties["VALUE_FORMATED"] .= htmlspecialcharsEx($locationName);
示例#13
0
     $arMenu["items"][] = array("text" => GetMessage("SALE_TAX"), "title" => GetMessage("SALE_TAX_DESCR"), "items_id" => "menu_sale_taxes", "items" => $arSubItems);
 }
 if ($APPLICATION->GetGroupRight("sale") == "W") {
     $arMenu["items"][] = array("text" => GetMessage("SALE_PERSON_TYPE"), "title" => GetMessage("SALE_PERSON_TYPE_DESCR"), "url" => "sale_person_type.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_person_type_edit.php"));
     $arMenu["items"][] = array("text" => GetMessage("SALE_STATUS"), "title" => GetMessage("SALE_STATUS_DESCR"), "url" => "sale_status.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_status_edit.php"));
     if (Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N') == 'Y') {
         $arMenu["items"][] = array("text" => GetMessage("SALE_BUSINESS_VALUE"), "title" => 'SALE_BUSINESS_VALUE title', "url" => "sale_business_value.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_business_value.php"));
     }
     $arMenu["items"][] = array("text" => GetMessage("SALE_ORDER_PROPS"), "title" => GetMessage("SALE_ORDER_PROPS_DESCR"), "items_id" => "menu_sale_properties", "items" => array(array("text" => GetMessage("sale_menu_properties"), "title" => GetMessage("sale_menu_properties_title"), "url" => "sale_order_props.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_order_props_edit.php")), array("text" => GetMessage("SALE_ORDER_PROPS_GR"), "title" => GetMessage("SALE_ORDER_PROPS_GR_DESCR"), "url" => "sale_order_props_group.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_order_props_group_edit.php"))));
     /* 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"), "title" => GetMessage("SALE_LOCATION_GROUPS_DESCR"), "url" => Location\Admin\GroupHelper::getListUrl(), "more_url" => array(Location\Admin\GroupHelper::getEditUrl())), array("text" => GetMessage("SALE_MENU_LOCATION_ZONES"), "title" => GetMessage("SALE_MENU_LOCATION_ZONES_TITLE"), "url" => Location\Admin\SiteLocationHelper::getListUrl(), "more_url" => array(Location\Admin\SiteLocationHelper::getEditUrl())), array("text" => GetMessage("SALE_MENU_LOCATION_DEFAULT"), "title" => GetMessage("SALE_MENU_LOCATION_DEFAULT_TITLE"), "url" => Location\Admin\DefaultSiteHelper::getListUrl(), "more_url" => array(Location\Admin\DefaultSiteHelper::getEditUrl())), array("text" => GetMessage("SALE_MENU_LOCATION_TYPES"), "title" => GetMessage("SALE_MENU_LOCATION_TYPES_TITLE"), "url" => Location\Admin\TypeHelper::getListUrl(), "more_url" => array(Location\Admin\TypeHelper::getEditUrl())), array("text" => GetMessage("SALE_MENU_LOCATION_SERVICES"), "title" => GetMessage("SALE_MENU_LOCATION_SERVICES_TITLE"), "url" => Location\Admin\ExternalServiceHelper::getListUrl(), "more_url" => array(Location\Admin\ExternalServiceHelper::getEditUrl())), array("text" => GetMessage("SALE_LOCATION_IMPORT"), "title" => GetMessage("SALE_LOCATION_IMPORT_DESCR"), "url" => Location\Admin\Helper::getImportUrl()), array("text" => GetMessage("SALE_LOCATION_REINDEX"), "title" => GetMessage("SALE_LOCATION_REINDEX_DESCR"), "url" => Location\Admin\Helper::getReindexUrl()));
         } else {
             $locationMenu["items"] = array(array("text" => GetMessage("sale_menu_locations"), "title" => GetMessage("sale_menu_locations_title"), "url" => "sale_location_admin.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_location_edit.php")), array("text" => GetMessage("SALE_LOCATION_GROUPS"), "title" => GetMessage("SALE_LOCATION_GROUPS_DESCR"), "url" => "sale_location_group_admin.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_location_group_edit.php")), array("text" => GetMessage("SALE_LOCATION_IMPORT"), "title" => GetMessage("SALE_LOCATION_IMPORT_DESCR"), "url" => "sale_location_import.php?lang=" . LANGUAGE_ID));
             $locationMenu["items"][] = array("text" => GetMessage("SALE_MENU_LOCATION_MIGRATION"), "title" => GetMessage("SALE_MENU_LOCATION_MIGRATION_TITLE"), "url" => Location\Admin\Helper::getMigrationUrl());
         }
         $arMenu["items"][] = $locationMenu;
         unset($locationMenu);
     }
     /* LOCATIONS END */
     $arMenu["items"][] = array("text" => GetMessage("MAIN_MENU_1C_INTEGRATION"), "title" => GetMessage("MAIN_MENU_1C_INTEGRATION_TITLE"), "url" => "1c_admin.php?lang=" . LANGUAGE_ID, "more_url" => array("1c_admin.php"));
     $arMenu["items"][] = array("text" => GetMessage("MAIN_MENU_REPORT_EDIT"), "title" => GetMessage("MAIN_MENU_REPORT_EDIT_TITLE"), "url" => "sale_report_edit.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_report_edit.php"));
     if ($APPLICATION->GetGroupRight("sale") == "W" && (LANGUAGE_ID == "ru" || LANGUAGE_ID == "ua")) {
         $arMenu["items"][] = array("text" => GetMessage("SALE_TRADING_PLATFORMS"), "title" => GetMessage("SALE_TRADING_PLATFORMS_DESCR"), "items_id" => "menu_sale_trading_platforms", "items" => array(array("text" => GetMessage("SALE_YANDEX_MARKET"), "title" => GetMessage("SALE_YANDEX_MARKET_DESCR"), "url" => "sale_ymarket.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_ymarket.php")), array("text" => "Ebay", "title" => "Ebay", "items_id" => "menu_sale_trading_platforms_ebay", "more_url" => array("sale_ebay_actions.php"), "items" => array(array("text" => GetMessage("SALE_MENU_EBAY_WIZARD"), "title" => GetMessage("SALE_MENU_EBAY_EXCHANGE_DESCR"), "url" => "sale_ebay_wizard.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_ebay_wizard.php")), array("text" => GetMessage("SALE_MENU_EBAY_SETT"), "title" => GetMessage("SALE_MENU_EBAY_SETT_DESCR"), "url" => "sale_ebay.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_ebay.php")), array("text" => GetMessage("SALE_MENU_EBAY_POLICY"), "title" => GetMessage("SALE_MENU_EBAY_POLICY_DESCR"), "url" => "sale_ebay_policy.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_ebay_policy.php")), array("text" => GetMessage("SALE_MENU_EBAY_EXCHANGE"), "title" => GetMessage("SALE_MENU_EBAY_EXCHANGE_DESCR"), "url" => "sale_ebay_exchange.php?lang=" . LANGUAGE_ID, "more_url" => array("sale_ebay_exchange.php"))))));
     }
 }
 $aMenu[] = $arMenu;
示例#14
0
echo Loc::getMessage('SALE_LOCATION_L_FROM_AND_TO');
?>
)<?endif?>:</td>
					<td>

					<?if($code == 'TYPE_ID'):?>

						<select name="find_<?php 
echo $code;
?>
">
							<option value="">(<?php 
echo Loc::getMessage('SALE_LOCATION_L_ANY');
?>
)</option>
							<?foreach(Helper::getTypeList() as $tId => $tName):?>
								<option value="<?php 
echo intval($tId);
?>
"<?php 
echo $tId == $GLOBALS['find_' . $code] ? ' selected' : '';
?>
><?php 
echo htmlspecialcharsbx($tName);
?>
</option>
							<?endforeach?>
						</select>

					<?elseif($code == 'PARENT_ID'):?>
示例#15
0
	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;
	}
示例#16
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->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;
 }
示例#17
0
    }
}
$tabControl->ShowUserFieldsWithReadyData(CompanyTable::getUfId(), $fields, false, 'ID');
$tabControl->AddCheckBoxField("ACTIVE", GetMessage("COMPANY_ACTIVE"), false, 'Y', $fields['ACTIVE'] == 'Y');
$tabControl->AddEditField("NAME", GetMessage("COMPANY_NAME"), true, array(), htmlspecialcharsbx($fields['NAME']));
$tabControl->BeginCustomField('LOCATIONS', GetMessage("COMPANY_LOCATION_ID"));
if ($saleModulePermissions >= 'W') {
    ?>
	<tr>
		<td><strong><?php 
    echo GetMessage("COMPANY_LOCATION_ID");
    ?>
</strong></td>
		<td>
			<?php 
    $APPLICATION->IncludeComponent("bitrix:sale.location.selector." . \Bitrix\Sale\Location\Admin\LocationHelper::getWidgetAppearance(), "", array("ID" => "", "CODE" => $fields['LOCATION_ID'], "INPUT_NAME" => "LOCATION_ID", "PROVIDE_LINK_BY" => "code", "SHOW_ADMIN_CONTROLS" => 'Y', "SELECT_WHEN_SINGLE" => 'N', "FILTER_BY_SITE" => 'Y', "FILTER_SITE_ID" => Application::getInstance()->getContext()->getSite(), "SHOW_DEFAULT_LOCATIONS" => 'N', "SEARCH_BY_PRIMARY" => 'Y'), false);
    ?>
		</td>
	</tr>
<?php 
} else {
    $res = \Bitrix\Sale\Location\LocationTable::getPathToNodeByCode($fields['LOCATION_ID'], array('select' => array('CHAIN' => 'NAME.NAME'), 'filter' => array('NAME.LANGUAGE_ID' => $lang)));
    $path = array();
    while ($item = $res->fetch()) {
        $path[] = $item['CHAIN'];
    }
    $path = implode(', ', array_reverse($path));
    ?>
	<tr>
		<td><?php 
    echo GetMessage("COMPANY_LOCATION");
示例#18
0
     $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $arOrderProps["VALUE"]);
     echo htmlspecialcharsEx($arVal["NAME"]);
 } elseif ($arOrderProps["TYPE"] == "MULTISELECT") {
     $curVal = explode(",", $arOrderProps["VALUE"]);
     $countCurVal = count($curVal);
     for ($i = 0; $i < $countCurVal; $i++) {
         $arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
         if ($i > 0) {
             echo ", ";
         }
         echo htmlspecialcharsEx($arVal["NAME"]);
     }
 } elseif ($arOrderProps["TYPE"] == "LOCATION") {
     $arOrder["LOCATION_TO"] = $arOrderProps["VALUE"];
     if (CSaleLocation::isLocationProEnabled()) {
         $locationString = \Bitrix\Sale\Location\Admin\LocationHelper::getLocationStringById($arOrderProps['VALUE']);
         if (!strlen($locationString)) {
             $locationString = $arOrderProps['VALUE'];
         }
         print htmlspecialcharsEx($locationString);
     } else {
         $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) {
示例#19
0
<?php

define("NO_KEEP_STATISTIC", true);
define("NO_AGENT_STATISTIC", true);
use Bitrix\Main;
use Bitrix\Main\Loader;
use Bitrix\Sale\Location;
use Bitrix\Sale\Location\Admin\LocationHelper as Helper;
require_once $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/include/prolog_before.php';
Loader::includeModule('sale');
CUtil::JSPostUnescape();
$result = array('ERRORS' => array(), 'DATA' => array());
$item = Helper::getLocationsByZip($_REQUEST['ZIP'], array('limit' => 1))->fetch();
if (!isset($item['LOCATION_ID'])) {
    $result['ERRORS'] = array('Not found');
} else {
    $siteId = '';
    if (strlen($_REQUEST['SITE_ID'])) {
        $siteId = $_REQUEST['SITE_ID'];
    } elseif (strlen(SITE_ID)) {
        $siteId = SITE_ID;
    }
    $result['DATA']['ID'] = intval($item['LOCATION_ID']);
    if (strlen($siteId)) {
        if (!Location\SiteLocationTable::checkConnectionExists($siteId, $result['DATA']['ID'])) {
            $result['ERRORS'] = array('Found, but not connected');
        }
    }
}
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
print CUtil::PhpToJSObject(array('result' => empty($result['ERRORS']), 'errors' => $result['ERRORS'], 'data' => $result['DATA']), false, false, true);
<?php

define("STOP_STATISTICS", true);
define('NO_AGENT_CHECK', true);
define("DisableEventsCheck", true);
require_once $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/main/include/prolog_before.php';
use Bitrix\Main;
use Bitrix\Sale\Location\Admin\LocationHelper as Helper;
Main\Loader::includeModule('sale');
$APPLICATION->ShowHeadStrings();
$APPLICATION->ShowCSS();
$properties = $_REQUEST['PROPERTIES'];
$APPLICATION->IncludeComponent("bitrix:sale.location.selector." . Helper::getWidgetAppearance(), "", array("ID" => intval($properties['ID']) ? intval($properties['ID']) : '', "CODE" => strlen($properties['CODE']) ? $properties['CODE'] : '', "INPUT_NAME" => $properties['INPUT_NAME'], "PROVIDE_LINK_BY" => $properties['PROVIDE_LINK_BY'] == 'id' ? 'id' : 'code', "FILTER_SITE_ID" => $properties['FILTER_SITE_ID'], "SHOW_DEFAULT_LOCATIONS" => 'Y', "SEARCH_BY_PRIMARY" => $properties['SEARCH_BY_PRIMARY'], "JS_CONTROL_GLOBAL_ID" => 'SALE_LOCATION_SELECTOR_RESOURCES', "USE_JS_SPAWN" => 'Y'), false, array('HIDE_ICONS' => 'Y'));
示例#21
0
								$countCurVal = count($curVal);
								for ($i = 0; $i < $countCurVal; $i++)
								{
									$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
									if ($i > 0)
										echo ", ";
									echo htmlspecialcharsEx($arVal["NAME"]);
								}
							}
							elseif ($arOrderProps["TYPE"] == "LOCATION")
							{
								$arOrder["LOCATION_TO"] = $arOrderProps["VALUE"];

								if(CSaleLocation::isLocationProEnabled())
								{
									print(Location\Admin\LocationHelper::getLocationPathDisplay($arOrderProps['VALUE']));
								}
								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)
示例#22
0
				}
				elseif($arProps["TYPE"] == "CHECKBOX")
				{
					if($arProps["VALUE"] == "Y")
					{
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], GetMessage("SALE_YES"));
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], GetMessage("SALE_YES"));
					}
				}
				elseif($arProps["TYPE"] == "LOCATION")
				{
					if(CSaleLocation::isLocationProEnabled())
					{
						$path = Helper::getLocationStringByCode($arProps["VALUE"]);
						if(!strlen($path))
							$path = $arProps["VALUE"];

						$path = htmlspecialcharsEx($path);

						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], $path);
						else
							$row->AddField("PROP_".$arProps["ORDER_PROPS_ID"], $path);
					}
					else
					{
						$arVal = CSaleLocation::GetByID($arProps["VALUE"], LANG);
						if(strlen($arProps["CODE"]) > 0)
							$row->AddField("PROP_".$arProps["CODE"], htmlspecialcharsEx($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]));
示例#23
0
 /**
  * @param $arFields
  * @param array $arOptions
  * @return bool|int
  * @throws Exception
  * @deprecated
  */
 static function Add($arFields, $arOptions = array())
 {
     $fields = array_intersect_key($arFields, Bitrix\Sale\Delivery\Services\Table::getMap());
     if (array_key_exists("LOGOTIP", $arFields) && is_array($arFields["LOGOTIP"])) {
         $arFields["LOGOTIP"]["MODULE_ID"] = "sale";
         CFile::SaveForDB($arFields, "LOGOTIP", "sale/delivery/logotip");
         $fields["LOGOTIP"] = $arFields["LOGOTIP"];
     }
     $fields["CODE"] = isset($arFields["CODE"]) ? $arFields["CODE"] : strval(mktime());
     $fields["PARENT_ID"] = 0;
     $fields["CLASS_NAME"] = '\\Bitrix\\Sale\\Delivery\\Services\\Configurable';
     $fields["CONFIG"] = array("MAIN" => array("PRICE" => $arFields["PRICE"], "PERIOD" => array("FROM" => $arFields["PERIOD_FROM"], "TO" => $arFields["PERIOD_TO"], "TYPE" => $arFields["PERIOD_TYPE"])));
     $res = \Bitrix\Sale\Delivery\Services\Table::add($fields);
     if (!$res->isSuccess()) {
         return false;
     }
     $newId = $res->getId();
     $res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $newId, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\BySite', "PARAMS" => array("SITE_ID" => array($arFields["LID"]))));
     if (intval($arFields["WEIGHT_FROM"]) > 0 || intval($arFields["WEIGHT_TO"]) > 0) {
         $res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $newId, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByWeight', "PARAMS" => array("MIN_WEIGHT" => $arFields["WEIGHT_FROM"], "MAX_WEIGHT" => $arFields["WEIGHT_TO"])));
     }
     if (intval($arFields["ORDER_PRICE_FROM"]) > 0 || intval($arFields["ORDER_PRICE_TO"]) > 0) {
         $res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $newId, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPrice', "PARAMS" => array("MIN_PRICE" => $arFields["ORDER_PRICE_FROM"], "MAX_PRICE" => $arFields["ORDER_PRICE_TO"], "CURRENCY" => $arFields["ORDER_CURRENCY"])));
     }
     if (isset($arFields["LOCATIONS"]) && is_array($arFields["LOCATIONS"])) {
         Helper::resetLocationsForEntity($newId, $arFields['LOCATIONS'], self::CONN_ENTITY_NAME, !!$arOptions['EXPECT_LOCATION_CODES']);
     }
     if (isset($arFields["PAY_SYSTEM"])) {
         CSaleDelivery::UpdateDeliveryPay($newId, $arFields["PAY_SYSTEM"]);
     }
     if (isset($arFields["STORE"])) {
         $stores = unserialize($arFields["STORE"]);
         if ($stores) {
             \Bitrix\Sale\Delivery\ExtraServices\Manager::saveStores($newId, $stores);
         }
     }
     return $newId;
 }
示例#24
0
 /**
  * Here we get some data that cannot be cached for a long time
  * @return boolean
  */
 protected function obtainNonCachedData()
 {
     // types
     $types = LocationHelper::getTypeList();
     $selectedTypes = array_flip(Search\Finder::getIndexedTypes());
     $this->dbResult['TYPES'] = array();
     foreach ($types as $id => $name) {
         $this->dbResult['TYPES'][$id] = array('NAME' => $name, 'SELECTED' => isset($selectedTypes[$id]));
     }
     // langs
     $langs = TypeHelper::getLanguageList();
     $selectedLangs = array_flip(Search\Finder::getIndexedLanguages());
     $this->dbResult['LANGS'] = array();
     foreach ($langs as $id => $name) {
         $this->dbResult['LANGS'][$id] = array('NAME' => $name, 'SELECTED' => isset($selectedLangs[$id]));
     }
     return true;
 }
示例#25
0
			'ERRORS' => array(),
			'DATA' => array()
		);

		if($_REQUEST['ACT'] == 'GET_LOC_BY_ZIP')
		{
			$zip = '';
			if (isset($_REQUEST['ZIP']))
				$zip = (string)$_REQUEST['ZIP'];
			if ($zip == '')
			{
				$result['ERRORS'] = array('Not found');
			}
			else
			{
				$item = Location\Admin\LocationHelper::getLocationsByZip($zip, array('limit' => 1))->fetch();

				if (!isset($item['LOCATION_ID']))
					$result['ERRORS'] = array('Not found');
				else
				{
					$siteId = '';
					if(!empty($_REQUEST['SITE_ID']))
						$siteId = (string)$_REQUEST['SITE_ID'];
					elseif (defined('SITE_ID'))
						$siteId = SITE_ID;

					$result['DATA']['ID'] = (int)$item['LOCATION_ID'];

					if ($siteId != '')
					{
echo $field['title'];
?>
</td>
									<?endforeach?>
									<td><?php 
echo Loc::getMessage('SALE_LOCATION_E_HEADER_EXT_REMOVE');
?>
</td>
								</tr>

								<?if(is_array($formData['EXTERNAL']) && !empty($formData['EXTERNAL'])):?>

									<?foreach($formData['EXTERNAL'] as $id => $ext):?>
										<tr>
											<?foreach($externalMap as $code => $field):?>
												<?$value = Helper::makeSafeDisplay($ext[$code], $code);?>
												<td>
													<?if($code == 'SERVICE_ID'):?>
														<select name="element[EXTERNAL][<?php 
echo $ext['ID'];
?>
][<?php 
echo $code;
?>
]">
															<?foreach($services as $sId => $serv):?>
																<option value="<?php 
echo intval($serv['ID']);
?>
"<?php 
echo $serv['ID'] == $value ? ' selected' : '';
示例#27
0
								$countCurVal = count($curVal);
								for ($i = 0; $i < $countCurVal; $i++)
								{
									$arVal = CSaleOrderPropsVariant::GetByValue($arOrderProps["ORDER_PROPS_ID"], $curVal[$i]);
									if ($i > 0)
										echo ", ";
									echo htmlspecialcharsEx($arVal["NAME"]);
								}
							}
							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"];
示例#28
0
 protected function identifyLinkType(&$items)
 {
     if ($this->filterBySite && is_array($items) && !empty($items)) {
         try {
             $linkTypeMap = Location\SiteLocationTable::getLinkStatusForMultipleNodes($items, $this->arParams['FILTER_SITE_ID'], $this->dbResult['TEMP']['CONNECTORS']);
             foreach ($linkTypeMap as $id => $linkType) {
                 $items[$id]['LINK_TYPE'] = $linkType;
             }
         } catch (\Bitrix\Main\ArgumentException $e) {
             LocationHelper::informAdminLocationDatabaseFailure();
             foreach ($items as $id => &$item) {
                 $items['LINK_TYPE'] = Location\SiteLocationTable::LSTAT_IN_NOT_CONNECTED_BRANCH;
             }
         }
     }
 }
示例#29
0
				"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"),
						"title" => GetMessage("SALE_LOCATION_GROUPS_DESCR"),
						"url" => Location\Admin\GroupHelper::getListUrl(),
						"more_url" => array(Location\Admin\GroupHelper::getEditUrl()),
					),
					array(
						"text" => GetMessage("SALE_MENU_LOCATION_ZONES"),
						"title" => GetMessage("SALE_MENU_LOCATION_ZONES_TITLE"),
						"url" => Location\Admin\SiteLocationHelper::getListUrl(),
						"more_url" => array(Location\Admin\SiteLocationHelper::getEditUrl()),
					),
					array(
						"text" => GetMessage("SALE_MENU_LOCATION_DEFAULT"),
示例#30
0
 protected static function getPathToNodesV2($list, $parameters = array())
 {
     $select = static::getPathNodesSelect();
     if (is_array($parameters['select'])) {
         $select = $parameters['select'];
         // orm wont return a correct result in case of array("ID", "VALUE" => "ID") select passed, so orm fix required
         unset($select['VALUE']);
         $select[] = 'ID';
     }
     $result = array('ITEM_NAMES' => array(), 'PATH_ITEMS' => array());
     try {
         $res = Location\LocationTable::getPathToMultipleNodes($list, array('select' => $select, 'filter' => array('=NAME.LANGUAGE_ID' => (string) $parameters['filter']['=NAME.LANGUAGE_ID'] != '' ? $parameters['filter']['=NAME.LANGUAGE_ID'] : LANGUAGE_ID)));
     } catch (\Bitrix\Main\ArgumentException $e) {
         LocationHelper::informAdminLocationDatabaseFailure();
         return $result;
     }
     $pathItems = array();
     while ($path = $res->fetch()) {
         // format path as required for JSON responce
         $chain = array();
         $itemId = false;
         $i = -1;
         foreach ($path['PATH'] as $id => $pItem) {
             $i++;
             if (!$i) {
                 $itemId = $id;
                 $result['ITEM_NAMES'][$id] = $pItem['DISPLAY'];
                 continue;
             }
             // orm fix, return everything back
             if (isset($pItem['ID'])) {
                 $pItem['VALUE'] = intval($pItem['ID']);
             }
             $chain[] = intval($pItem['VALUE']);
             $id = $pItem['VALUE'];
             unset($pItem['ID']);
             $pathItems[$id] = $pItem;
         }
         $result['PATH'][$itemId] = $chain;
     }
     $result['PATH_ITEMS'] = $pathItems;
     return $result;
 }