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


PHP CurrencyManager::checkCurrencyID方法代码示例

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


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

示例1: convertCurrency

 /**
  * Convert discount data to other currency (sale currency).
  *
  * @param array &$discount				Discout data.
  * @param string $currency				New currency.
  * @return void
  */
 public static function convertCurrency(&$discount, $currency)
 {
     $currency = Currency\CurrencyManager::checkCurrencyID($currency);
     if ($currency === false || empty($discount) || !is_array($discount)) {
         return;
     }
     if (!isset($discount['VALUE_TYPE']) || !isset($discount['CURRENCY']) || $discount['CURRENCY'] == $currency) {
         return;
     }
     switch ($discount['VALUE_TYPE']) {
         case self::VALUE_TYPE_FIX:
         case self::VALUE_TYPE_SALE:
             $discount['VALUE'] = roundEx(\CCurrencyRates::convertCurrency($discount['VALUE'], $discount['CURRENCY'], $currency), CATALOG_VALUE_PRECISION);
             $discount['CURRENCY'] = $currency;
             break;
         case self::VALUE_TYPE_PERCENT:
             if ($discount['MAX_DISCOUNT'] > 0) {
                 $discount['MAX_DISCOUNT'] = roundEx(\CCurrencyRates::convertCurrency($discount['MAX_DISCOUNT'], $discount['CURRENCY'], $currency), CATALOG_VALUE_PRECISION);
             }
             $discount['CURRENCY'] = $currency;
             break;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:30,代码来源:discount.php

示例2: OrderProduct

 /**
  * @param array $arParams
  * @return array|false
  */
 public static function OrderProduct($arParams)
 {
     $adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true;
     $arParams['RENEWAL'] = isset($arParams['RENEWAL']) && $arParams['RENEWAL'] == 'Y' ? 'Y' : 'N';
     $arParams['CHECK_QUANTITY'] = isset($arParams['CHECK_QUANTITY']) && $arParams['CHECK_QUANTITY'] == 'N' ? 'N' : 'Y';
     $arParams['CHECK_DISCOUNT'] = isset($arParams['CHECK_DISCOUNT']) && $arParams['CHECK_DISCOUNT'] == 'N' ? 'N' : 'Y';
     $arParams['USER_ID'] = isset($arParams['USER_ID']) ? (int) $arParams['USER_ID'] : 0;
     if ($arParams['USER_ID'] < 0) {
         $arParams['USER_ID'] = 0;
     }
     $arParams['SITE_ID'] = isset($arParams['SITE_ID']) ? $arParams['SITE_ID'] : false;
     $strSiteID = $arParams['SITE_ID'];
     $arParams['BASKET_ID'] = (string) (isset($arParams['BASKET_ID']) ? $arParams['BASKET_ID'] : '0');
     $arParams['CURRENCY'] = isset($arParams['CURRENCY']) ? Currency\CurrencyManager::checkCurrencyID($arParams['CURRENCY']) : false;
     if ($arParams['CURRENCY'] === false) {
         $arParams['CURRENCY'] = CSaleLang::GetLangCurrency($strSiteID ? $strSiteID : SITE_ID);
     }
     global $USER;
     $productID = (int) $arParams['PRODUCT_ID'];
     $quantity = (double) $arParams['QUANTITY'];
     $intUserID = (int) $arParams['USER_ID'];
     $arResult = array();
     if ($adminSection) {
         if ($intUserID == 0) {
             return $arResult;
         }
         if (!($userGroups = static::getHitCache('USER_GROUPS', $intUserID))) {
             $userGroups = self::getUserGroups($intUserID);
             static::setHitCache('USER_GROUPS', $intUserID, $userGroups);
         }
         if (empty($userGroups)) {
             return $arResult;
         }
         if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT_PERM_N', $productID))) {
             $dbIBlockElement = CIBlockElement::GetList(array(), array('ID' => $productID, 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'CHECK_PERMISSION' => 'N'), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
             if ($arProduct = $dbIBlockElement->GetNext()) {
                 static::setHitCache('IBLOCK_ELEMENT_PERM_N', $productID, $arProduct);
             }
             unset($dbIBlockElement);
         }
         if (empty($arProduct) || !is_array($arProduct)) {
             return $arResult;
         }
         $iblockRightByID = null;
         if (!($iblockRightByID = static::getHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID']))) {
             if ($iblockRightByID = CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'RIGHTS_MODE')) {
                 static::setHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID'], $iblockRightByID);
             }
         }
         if ($iblockRightByID == 'E') {
             $proxyUserPermissionKey = $productID . "|" . $intUserID;
             if (!($arUserRights = static::getHitCache('USER_RIGHT', $proxyUserPermissionKey))) {
                 if ($arUserRights = CIBlockElementRights::GetUserOperations($productID, $intUserID)) {
                     static::setHitCache('USER_RIGHT', $proxyUserPermissionKey, $arUserRights);
                 }
             }
             if (empty($arUserRights) || !isset($arUserRights['element_read'])) {
                 return $arResult;
             }
             unset($arUserRights);
         } else {
             $proxyIblockPermissionKey = $arProduct['IBLOCK_ID'] . "|" . $intUserID;
             if (!($iblockPermissions = static::getHitCache('IBLOCK_PERM', $proxyIblockPermissionKey))) {
                 if ($iblockPermissions = CIBlock::GetPermission($arProduct['IBLOCK_ID'], $intUserID)) {
                     static::setHitCache('IBLOCK_PERM', $proxyIblockPermissionKey, $iblockPermissions);
                 }
             }
             if ($iblockPermissions < 'R') {
                 return $arResult;
             }
         }
     } else {
         $userGroups = $USER->GetUserGroupArray();
         if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT_PERM_Y', $productID))) {
             $dbIBlockElement = CIBlockElement::GetList(array(), array('ID' => $productID, 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'CHECK_PERMISSIONS' => 'Y', 'MIN_PERMISSION' => 'R'), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
             if ($arProduct = $dbIBlockElement->GetNext()) {
                 static::setHitCache('IBLOCK_ELEMENT_PERM_Y', $productID, $arProduct);
             }
             unset($dbIBlockElement);
         }
         if (empty($arProduct) || !is_array($arProduct)) {
             return $arResult;
         }
     }
     if (!($arCatalogProduct = static::getHitCache('CATALOG_PRODUCT', $productID))) {
         $rsProducts = CCatalogProduct::GetList(array(), array('ID' => $productID), false, false, array('ID', 'CAN_BUY_ZERO', 'QUANTITY_TRACE', 'QUANTITY', 'WEIGHT', 'WIDTH', 'HEIGHT', 'LENGTH', 'BARCODE_MULTI', 'TYPE'));
         if ($arCatalogProduct = $rsProducts->Fetch()) {
             static::setHitCache('CATALOG_PRODUCT', $productID, $arCatalogProduct);
         }
         unset($rsProducts);
     }
     if (!empty($arCatalogProduct) && is_array($arCatalogProduct)) {
         $arCatalogProduct["QUANTITY"] = (double) $arCatalogProduct["QUANTITY"];
         if ($arParams["CHECK_QUANTITY"] == "Y") {
             if ('Y' != $arCatalogProduct["CAN_BUY_ZERO"] && 'Y' == $arCatalogProduct["QUANTITY_TRACE"] && ($arCatalogProduct["QUANTITY"] <= 0 || $quantity > $arCatalogProduct["QUANTITY"])) {
                 return $arResult;
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:product_provider.php

示例3: isExistCurrencyLanguage

	public static function isExistCurrencyLanguage($currency, $language)
	{
		global $DB;
		$currency = Currency\CurrencyManager::checkCurrencyID($currency);
		$language = Currency\CurrencyManager::checkLanguage($language);
		if ($currency === false || $language === false)
			return false;
		$query = "select LID from b_catalog_currency_lang where CURRENCY = '".$DB->ForSql($currency)."' and LID = '".$DB->ForSql($language)."'";
		$searchIterator = $DB->Query($query, false, 'File: '.__FILE__.'<br>Line: '.__LINE__);
		if ($result = $searchIterator->Fetch())
		{
			return true;
		}
		return false;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:15,代码来源:currency_lang.php

示例4: checkCurrencyID

 public static function checkCurrencyID($currency)
 {
     return Currency\CurrencyManager::checkCurrencyID($currency);
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:4,代码来源:currency.php

示例5: updateBaseCurrency

 protected static function updateBaseCurrency($currency)
 {
     global $DB, $USER;
     $currency = Currency\CurrencyManager::checkCurrencyID($currency);
     if ($currency === false) {
         return false;
     }
     $userID = self::isUserExists() ? (int) $USER->GetID() : false;
     $currentDate = $DB->GetNowFunction();
     $fields = array('BASE' => 'N', '~DATE_UPDATE' => $currentDate, 'MODIFIED_BY' => $userID);
     $update = $DB->PrepareUpdate('b_catalog_currency', $fields);
     $query = "update b_catalog_currency set " . $update . " where CURRENCY <> '" . $currency . "' and BASE = 'Y'";
     $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     $fields = array('BASE' => 'Y', '~DATE_UPDATE' => $currentDate, 'MODIFIED_BY' => $userID, 'AMOUNT' => 1, 'AMOUNT_CNT' => 1);
     $update = $DB->PrepareUpdate('b_catalog_currency', $fields);
     $query = "update b_catalog_currency set " . $update . " where CURRENCY = '" . $currency . "'";
     $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     self::updateBaseRates($currency);
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:20,代码来源:currency.php

示例6: array

$filterFields = array();

if (!isset($by))
	$by = 'SORT';
if (!isset($order))
	$order = 'ASC';
$by = strtoupper($by);
$order = strtoupper($order);

if ($adminList->EditAction() && $CURRENCY_RIGHT == "W")
{
	if (isset($FIELDS) && is_array($FIELDS))
	{
		foreach ($FIELDS as $ID => $arFields)
		{
			$ID = Currency\CurrencyManager::checkCurrencyID($ID);
			if ($ID === false)
				continue;

			if (!$adminList->IsUpdated($ID))
				continue;

			if (!CCurrency::Update($ID, $arFields))
			{
				if ($ex = $APPLICATION->GetException())
				{
					$adminList->AddUpdateError(GetMessage("CURRENCY_SAVE_ERR", array("#ID#" => $ID, "#ERROR_TEXT#" => $ex->GetString())), $ID);
				}
				else
				{
					$adminList->AddUpdateError(GetMessage("CURRENCY_SAVE_ERR2", array("#ID#"=>$ID)), $ID);
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:currencies.php

示例7: elseif

                echo $prefix;
                echo \CCurrencyLang::CurrencyFormat($profit, CurrencyManager::getBaseCurrency(), true);
                ?>
</div>
				<div class="seo-adv-block-text"><?php 
                echo Loc::getMessage('SEO_YANDEX_STATS_HINT_GROSS');
                ?>
</div>
			</div>
<?php 
                $color = $expences > 0 ? 'red' : 'gray';
                $prefix = $expences > 0 ? '&ndash;&nbsp;' : '';
                $text = CCurrencyLang::CurrencyFormat($expences, CurrencyManager::getBaseCurrency(), false);
                if ($currency == '') {
                    $text .= ' ' . Loc::getMessage('SEO_YANDEX_CURRENCY');
                } elseif (CurrencyManager::checkCurrencyID($currency)) {
                    $text = CCurrencyLang::CurrencyFormat($expences, $currency, true);
                } else {
                    $text .= ' ' . $currency;
                }
                ?>
			<div class="seo-adv-block seo-adv-block-<?php 
                echo $color;
                ?>
">
				<div class="seo-adv-block-icon"></div>
				<div class="seo-adv-block-title"><?php 
                echo $prefix;
                echo $text;
                ?>
</div>
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:seo_search_yandex_direct_stat.php

示例8: updateBaseCurrency

 /**
  * Update base currency.
  *
  * @param string $currency			Currency id.
  * @return bool
  */
 public static function updateBaseCurrency($currency)
 {
     /** @global \CUser $USER */
     global $USER;
     $currency = CurrencyManager::checkCurrencyID($currency);
     if ($currency === false) {
         return false;
     }
     $event = new Main\Event('currency', self::EVENT_ON_UPDATE_BASE_CURRENCY, array('NEW_BASE_CURRENCY' => $currency));
     $event->send();
     unset($event);
     $conn = Main\Application::getConnection();
     $helper = $conn->getSqlHelper();
     $userID = isset($USER) && $USER instanceof \CUser ? (int) $USER->getID() : 0;
     $tableName = $helper->quote(CurrencyTable::getTableName());
     $baseField = $helper->quote('BASE');
     $dateUpdateField = $helper->quote('DATE_UPDATE');
     $modifiedByField = $helper->quote('MODIFIED_BY');
     $amountField = $helper->quote('AMOUNT');
     $amountCntField = $helper->quote('AMOUNT_CNT');
     $currencyField = $helper->quote('CURRENCY');
     $query = 'update ' . $tableName . ' set ' . $baseField . ' = \'N\', ' . $dateUpdateField . ' = ' . $helper->getCurrentDateTimeFunction() . ', ' . $modifiedByField . ' = ' . ($userID == 0 ? 'NULL' : $userID) . ' where ' . $currencyField . ' <> \'' . $helper->forSql($currency) . '\' and ' . $baseField . ' = \'Y\'';
     $conn->queryExecute($query);
     $query = 'update ' . $tableName . ' set ' . $baseField . ' = \'Y\', ' . $dateUpdateField . ' = ' . $helper->getCurrentDateTimeFunction() . ', ' . $modifiedByField . ' = ' . ($userID == 0 ? 'NULL' : $userID) . ', ' . $amountField . ' = 1, ' . $amountCntField . ' = 1 where ' . $currencyField . ' = \'' . $helper->forSql($currency) . '\'';
     $conn->queryExecute($query);
     static::updateBaseRates();
     $event = new Main\Event('currency', self::EVENT_ON_AFTER_UPDATE_BASE_CURRENCY, array('NEW_BASE_CURRENCY' => $currency));
     $event->send();
     unset($event);
     self::$baseCurrency = '';
     return true;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:38,代码来源:currencymanager.php


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