예제 #1
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);
     }
 }
예제 #2
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;
 }
예제 #3
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);
예제 #4
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) {
예제 #5
0
             $row->AddField("PROP_" . $arProps["CODE"], "[" . htmlspecialcharsEx($arProps["VALUE"]) . "] " . htmlspecialcharsEx($arPropVariant["NAME"]));
         } else {
             $row->AddField("PROP_" . $arProps["ORDER_PROPS_ID"], "[" . htmlspecialcharsEx($arProps["VALUE"]) . "] " . htmlspecialcharsEx($arPropVariant["NAME"]));
         }
     }
 } 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::getLocationStringById($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"]));
         } 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"]));