本文整理汇总了PHP中CCurrency::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrency::GetByID方法的具体用法?PHP CCurrency::GetByID怎么用?PHP CCurrency::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurrency
的用法示例。
在下文中一共展示了CCurrency::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $APPLICATION;
if ((is_set($arFields, "PRODUCT_ID") || $ACTION == "ADD") && intval($arFields["PRODUCT_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_PRODUCT"), "EMPTY_PRODUCT_ID");
return false;
}
if ((is_set($arFields, "CATALOG_GROUP_ID") || $ACTION == "ADD") && intval($arFields["CATALOG_GROUP_ID"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CATALOG_GROUP"), "EMPTY_CATALOG_GROUP_ID");
return false;
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (isset($arFields['CURRENCY'])) {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$APPLICATION->ThrowException(Loc::getMessage("KGP_NO_CURRENCY", array('#ID#' => $arFields["CURRENCY"])), "CURRENCY");
return false;
}
}
if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if ((is_set($arFields, "QUANTITY_FROM") || $ACTION == "ADD") && intval($arFields["QUANTITY_FROM"]) <= 0) {
$arFields["QUANTITY_FROM"] = false;
}
if ((is_set($arFields, "QUANTITY_TO") || $ACTION == "ADD") && intval($arFields["QUANTITY_TO"]) <= 0) {
$arFields["QUANTITY_TO"] = false;
}
return true;
}
示例2: Init
function Init()
{
if (\Bitrix\Main\Loader::includeModule('currency') && ($arCurrency = CCurrency::GetByID('RUR'))) {
$base_currency = 'RUR';
} else {
$base_currency = 'RUB';
}
return array("SID" => "ems", "NAME" => GetMessage('SALE_DH_EMS_NAME'), "DESCRIPTION" => GetMessage('SALE_DH_EMS_DESCRIPTION'), "DESCRIPTION_INNER" => GetMessage('SALE_DH_EMS_DESCRIPTION_INNER'), "BASE_CURRENCY" => $base_currency, "HANDLER" => __FILE__, "DBGETSETTINGS" => array("CDeliveryEMS", "GetSettings"), "DBSETSETTINGS" => array("CDeliveryEMS", "SetSettings"), "GETCONFIG" => array("CDeliveryEMS", "GetConfig"), "COMPABILITY" => array("CDeliveryEMS", "Compability"), "CALCULATOR" => array("CDeliveryEMS", "Calculate"), "PROFILES" => array("delivery" => array("TITLE" => GetMessage("SALE_DH_EMS_DELIVERY_TITLE"), "DESCRIPTION" => '', "RESTRICTIONS_WEIGHT" => array(0, 31500), "RESTRICTIONS_SUM" => array(0))));
}
示例3: Init
public static function Init()
{
if ($arCurrency = CCurrency::GetByID('RUR')) {
$base_currency = 'RUR';
} else {
$base_currency = 'RUB';
}
return array("SID" => "ups", "NAME" => GetMessage('SALE_DH_UPS_NAME'), "DESCRIPTION" => GetMessage('SALE_DH_UPS_DESCRIPTION'), "DESCRIPTION_INNER" => GetMessage('SALE_DH_UPS_DESCRIPTION_INNER'), "BASE_CURRENCY" => $base_currency, "HANDLER" => __FILE__, "DBGETSETTINGS" => array("CDeliveryUPS", "GetSettings"), "DBSETSETTINGS" => array("CDeliveryUPS", "SetSettings"), "GETCONFIG" => array("CDeliveryUPS", "GetConfig"), "COMPABILITY" => array("CDeliveryUPS", "Compability"), "CALCULATOR" => array("CDeliveryUPS", "Calculate"), "PROFILES" => array("express" => array("TITLE" => GetMessage("SALE_DH_UPS_EXPRESS_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_UPS_EXPRESS_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, CSaleMeasure::Convert(150, "LBS", "G")), "RESTRICTIONS_SUM" => array(0)), "express_saver" => array("TITLE" => GetMessage("SALE_DH_UPS_EXPRESS_SAVER_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_UPS_EXPRESS_SAVER_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, CSaleMeasure::Convert(150, "LBS", "G")), "RESTRICTIONS_SUM" => array(0))));
}
示例4: Init
function Init()
{
if ($arCurrency = CCurrency::GetByID('RUR')) {
$base_currency = 'RUR';
} else {
$base_currency = 'RUB';
}
return array("SID" => "russianpost", "NAME" => GetMessage('SALE_DH_RUSSIANPOST_NAME'), "DESCRIPTION" => GetMessage('SALE_DH_RUSSIANPOST_DESCRIPTION'), "DESCRIPTION_INNER" => GetMessage('SALE_DH_RUSSIANPOST_DESCRIPTION_INNER') . GetMessage('SALE_DH_RUSSIANPOST_DESCRIPTION_INNER2'), "BASE_CURRENCY" => $base_currency, "HANDLER" => __FILE__, "DBGETSETTINGS" => array("CDeliveryRUSSIANPOST", "GetSettings"), "DBSETSETTINGS" => array("CDeliveryRUSSIANPOST", "SetSettings"), "GETCONFIG" => array("CDeliveryRUSSIANPOST", "GetConfig"), "COMPABILITY" => array("CDeliveryRUSSIANPOST", "Compability"), "CALCULATOR" => array("CDeliveryRUSSIANPOST", "Calculate"), "PROFILES" => array("ground" => array("TITLE" => GetMessage("SALE_DH_RUSSIANPOST_GROUND_TITLE"), "DESCRIPTION" => '', "RESTRICTIONS_WEIGHT" => array(0), "RESTRICTIONS_SUM" => array(0)), "avia" => array("TITLE" => GetMessage("SALE_DH_RUSSIANPOST_AVIA_TITLE"), "DESCRIPTION" => '', "RESTRICTIONS_WEIGHT" => array(0), "RESTRICTIONS_SUM" => array(0))));
}
示例5: Init
function Init()
{
// fix a possible currency bug
if ($arCurrency = CCurrency::GetByID('RUR')) {
$base_currency = 'RUR';
} else {
$base_currency = 'RUB';
}
return array("SID" => "cpcr", "NAME" => GetMessage('SALE_DH_CPCR_NAME'), "DESCRIPTION" => GetMessage('SALE_DH_CPCR_DESCRIPTION'), "DESCRIPTION_INNER" => GetMessage('SALE_DH_CPCR_DESCRIPTION_INNER'), "BASE_CURRENCY" => $base_currency, "HANDLER" => __FILE__, "COMPABILITY" => array("CDeliveryCPCR", "Compability"), "CALCULATOR" => array("CDeliveryCPCR", "Calculate"), "PROFILES" => array("simple" => array("TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 31500), "RESTRICTIONS_SUM" => array(0, 500000)), "simple13" => array("TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE13_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 31500), "RESTRICTIONS_SUM" => array(0, 500000)), "simple18" => array("TITLE" => GetMessage("SALE_DH_CPCR_SIMPLE18_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_SIMPLE_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 31500), "RESTRICTIONS_SUM" => array(0, 500000)), "econom" => array("TITLE" => GetMessage("SALE_DH_CPCR_ECONOM_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_ECONOM_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 68000), "RESTRICTIONS_SUM" => array(0, 500000)), "bizon" => array("TITLE" => GetMessage("SALE_DH_CPCR_BIZON_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_BIZON_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 68000), "RESTRICTIONS_SUM" => array(0, 500000)), "colibri" => array("TITLE" => GetMessage("SALE_DH_CPCR_COLIBRI_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_COLIBRI_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 68000), "RESTRICTIONS_SUM" => array(0, 500000)), "pelican" => array("TITLE" => GetMessage("SALE_DH_CPCR_PELICAN_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_PELICAN_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 68000), "RESTRICTIONS_SUM" => array(0, 500000)), "fraxt" => array("TITLE" => GetMessage("SALE_DH_CPCR_FRAXT_TITLE"), "DESCRIPTION" => GetMessage("SALE_DH_CPCR_FRAXT_DESCRIPTION"), "RESTRICTIONS_WEIGHT" => array(0, 68000), "RESTRICTIONS_SUM" => array(0, 500000))));
}
示例6: Init
public static function Init()
{
if ($arCurrency = CCurrency::GetByID('RUR'))
{
$base_currency = 'RUR';
}
else
{
$base_currency = 'RUB';
}
return array(
/* Basic description */
"SID" => "ems",
"NAME" => GetMessage('SALE_DH_EMS_NAME'),
"DESCRIPTION" => GetMessage('SALE_DH_EMS_DESCRIPTION'),
"DESCRIPTION_INNER" => GetMessage('SALE_DH_EMS_DESCRIPTION_INNER'),
"BASE_CURRENCY" => $base_currency,
"HANDLER" => __FILE__,
/* Handler methods */
"DBGETSETTINGS" => array("CDeliveryEMS", "GetSettings"),
"DBSETSETTINGS" => array("CDeliveryEMS", "SetSettings"),
"GETCONFIG" => array("CDeliveryEMS", "GetConfig"),
"COMPABILITY" => array("CDeliveryEMS", "Compability"),
"CALCULATOR" => array("CDeliveryEMS", "Calculate"),
/* List of delivery profiles */
"PROFILES" => array(
"delivery" => array(
"TITLE" => GetMessage("SALE_DH_EMS_DELIVERY_TITLE"),
"DESCRIPTION" => '', //GetMessage("SALE_DH_EMS_DELIVERY_DESCRIPTION"),
"RESTRICTIONS_WEIGHT" => array(0, 31500),
"RESTRICTIONS_SUM" => array(0),
),
)
);
}
示例7: array
<?php
$base_currency = CCurrency::GetByID('RUR') ? 'RUR' : 'RUB';
$arCMLCurrencies = array("USD" => "USD", "EUR" => "EUR", "RUR" => $base_currency, "RUB" => $base_currency, "руб." => $base_currency, "руб" => $base_currency);
示例8: array
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aContext = array(array("ICON" => "btn_list", "TEXT" => GetMessage("MAIN_ADMIN_MENU_LIST"), "LINK" => "currencies.php?lang=" . LANG, "TITLE" => GetMessage("MAIN_ADMIN_MENU_LIST")));
if (strlen($ID) > 0) {
$aContext[] = array("ICON" => "btn_new", "TEXT" => GetMessage("MAIN_ADMIN_MENU_CREATE"), "LINK" => "currency_edit.php?lang=" . LANG, "TITLE" => GetMessage("MAIN_ADMIN_MENU_CREATE"));
if ($CURRENCY_RIGHT == "W") {
$aContext[] = array("ICON" => "btn_delete", "TEXT" => GetMessage("MAIN_ADMIN_MENU_DELETE"), "ONCLICK" => "javascript:if(confirm('" . GetMessage("CONFIRM_DEL_MESSAGE") . "'))window.location='currencies.php?action=delete&ID[]=" . CUtil::JSEscape($ID) . "&lang=" . LANG . "&" . bitrix_sessid_get() . "';");
}
}
$context = new CAdminContextMenu($aContext);
$context->Show();
//Defaults
$f_SORT = "10";
$f_AMOUNT_CNT = "1";
if (strlen($ID) > 0 && !$bVarsFromForm) {
$result = CCurrency::GetByID($ID);
$f_AMOUNT_CNT = $result["AMOUNT_CNT"];
$f_AMOUNT = number_format($result["AMOUNT"], 4);
$f_SORT = $result["SORT"];
$res = CCurrencyLang::GetList($by, $order, $ID);
while ($ar = $res->Fetch()) {
${"l_FULL_NAME_" . $ar["LID"]} = $ar["FULL_NAME"];
${"l_FORMAT_STRING_" . $ar["LID"]} = $ar["FORMAT_STRING"];
${"l_DEC_POINT_" . $ar["LID"]} = $ar["DEC_POINT"];
${"l_THOUSANDS_SEP_" . $ar["LID"]} = $ar["THOUSANDS_SEP"];
${"l_THOUSANDS_VARIANT_" . $ar["LID"]} = $ar["THOUSANDS_VARIANT"];
${"l_DECIMALS_" . $ar["LID"]} = $ar["DECIMALS"];
}
}
if ($bVarsFromForm) {
$DB->InitTableVarsForEdit("b_catalog_currency", "", "f_");
示例9: array
if (!CCurrency::GetByID('UAH')) {
$arFields = array("CURRENCY" => "UAH", "AMOUNT" => 39.41, "AMOUNT_CNT" => 10, "SORT" => 400);
CCurrency::Add($arFields);
$dbLangs = CLanguage::GetList($b, $o, array("ACTIVE" => "Y"));
while ($arLangs = $dbLangs->Fetch()) {
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
$arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "UAH", "FORMAT_STRING" => GetMessage("CUR_INSTALL_UAH_FORMAT_STRING") ? GetMessage("CUR_INSTALL_UAH_FORMAT_STRING") : "", "FULL_NAME" => GetMessage("CUR_INSTALL_UAH_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_UAH_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_UAH_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2, "HIDE_ZERO" => "Y");
if (!empty($arFields)) {
CCurrencyLang::Add($arFields);
}
}
}
break;
case 'bl':
$iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices_bl.xml";
if (!CCurrency::GetByID('BYR')) {
$arFields = array("CURRENCY" => "BYR", "AMOUNT" => 36.72, "AMOUNT_CNT" => 10000, "SORT" => 500);
CCurrency::Add($arFields);
$dbLangs = CLanguage::GetList($b, $o, array("ACTIVE" => "Y"));
while ($arLangs = $dbLangs->Fetch()) {
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/currency/install_lang.php", $arLangs["LID"]);
$arFields = array("LID" => $arLangs["LID"], "CURRENCY" => "BYR", "FORMAT_STRING" => GetMessage("CUR_INSTALL_BYR_FORMAT_STRING") ? GetMessage("CUR_INSTALL_BYR_FORMAT_STRING") : "", "FULL_NAME" => GetMessage("CUR_INSTALL_BYR_FULL_NAME"), "DEC_POINT" => GetMessage("CUR_INSTALL_BYR_DEC_POINT"), "THOUSANDS_VARIANT" => GetMessage("CUR_INSTALL_BYR_THOUSANDS_SEP"), "THOUSANDS_SEP" => false, "DECIMALS" => 2, "HIDE_ZERO" => "Y");
if (!empty($arFields)) {
CCurrencyLang::Add($arFields);
}
}
}
break;
default:
$iblockXMLFilePrices = WIZARD_SERVICE_RELATIVE_PATH . "/xml/" . LANGUAGE_ID . "/catalog_prices.xml";
break;
示例10: GetCurrency
public static function GetCurrency($currency)
{
return CCurrency::GetByID($currency);
}
示例11: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB, $USER, $APPLICATION;
if (is_set($arFields, "PRODUCT_ID")) {
$arFields["PRODUCT_ID"] = IntVal($arFields["PRODUCT_ID"]);
}
if ((is_set($arFields, "PRODUCT_ID") || $ACTION == "ADD") && IntVal($arFields["PRODUCT_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty product field", "EMPTY_PRODUCT_ID");
return false;
}
if (is_set($arFields, "CALLBACK_FUNC") && strlen($arFields["CALLBACK_FUNC"]) > 0 || is_set($arFields, "PRODUCT_PROVIDER_CLASS") && strlen($arFields["PRODUCT_PROVIDER_CLASS"]) > 0 && (!is_set($arFields, "IGNORE_CALLBACK_FUNC") || $arFields["IGNORE_CALLBACK_FUNC"] != "Y")) {
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider(array("MODULE" => $arFields["MODULE"], "PRODUCT_PROVIDER_CLASS" => $arFields["PRODUCT_PROVIDER_CLASS"]))) {
$arPrice = $productProvider::GetProductData(array("PRODUCT_ID" => $arFields["PRODUCT_ID"], "QUANTITY" => $arFields["QUANTITY"], "RENEWAL" => $arFields["RENEWAL"], "USER_ID" => $arFields["USER_ID"], "SITE_ID" => $arFields["LID"]));
} else {
$arPrice = CSaleBasket::ExecuteCallbackFunction($arFields["CALLBACK_FUNC"], $arFields["MODULE"], $arFields["PRODUCT_ID"], $arFields["QUANTITY"], $arFields["RENEWAL"], $arFields["USER_ID"], $arFields["LID"]);
}
if (is_array($arPrice) && count($arPrice) > 0) {
$arFields["PRICE"] = $arPrice["PRICE"];
$arFields["CURRENCY"] = $arPrice["CURRENCY"];
$arFields["CAN_BUY"] = "Y";
$arFields["PRODUCT_PRICE_ID"] = $arPrice["PRODUCT_PRICE_ID"];
$arFields["NOTES"] = $arPrice["NOTES"];
} else {
$arFields["CAN_BUY"] = "N";
}
}
if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if (is_set($arFields, "DISCOUNT_PRICE") || $ACTION == "ADD") {
$arFields["DISCOUNT_PRICE"] = str_replace(",", ".", $arFields["DISCOUNT_PRICE"]);
$arFields["DISCOUNT_PRICE"] = DoubleVal($arFields["DISCOUNT_PRICE"]);
}
if (is_set($arFields, "VAT_RATE") || $ACTION == "ADD") {
$arFields["VAT_RATE"] = str_replace(",", ".", $arFields["VAT_RATE"]);
$arFields["VAT_RATE"] = DoubleVal($arFields["VAT_RATE"]);
}
if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty currency field", "EMPTY_CURRENCY");
return false;
}
if ((is_set($arFields, "LID") || $ACTION == "ADD") && strlen($arFields["LID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty site field", "EMPTY_SITE");
return false;
}
if ($ACTION != "ADD" && IntVal($ID) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("Empty ID field", "EMPTY_ID");
return false;
}
if (is_set($arFields, "ORDER_ID")) {
if (!($arOrder = CSaleOrder::GetByID($arFields["ORDER_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_ID"], GetMessage("SKGB_NO_ORDER")), "ERROR_NO_ORDER");
return false;
}
}
if (is_set($arFields, "CURRENCY")) {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGB_NO_CURRENCY")), "ERROR_NO_CURRENCY");
return false;
}
}
if (is_set($arFields, "LID")) {
$dbSite = CSite::GetByID($arFields["LID"]);
if (!$dbSite->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGB_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
if ($ACTION != "ADD" && (strlen($arFields["LID"]) <= 0 && (is_set($arFields, "PRICE") || is_set($arFields, "CURRENCY")) || is_set($arFields, "PRICE") && !is_set($arFields, "CURRENCY") || !is_set($arFields, "PRICE") && is_set($arFields, "CURRENCY"))) {
$tmp_res = CSaleBasket::GetByID($ID);
if (strlen($arFields["LID"]) <= 0) {
$arFields["LID"] = $tmp_res["LID"];
}
if (!is_set($arFields, "PRICE")) {
$arFields["PRICE"] = $tmp_res["PRICE"];
}
if (!is_set($arFields, "CURRENCY") || strlen($arFields["CURRENCY"]) <= 0) {
$arFields["CURRENCY"] = $tmp_res["CURRENCY"];
}
}
if (strlen($arFields["LID"]) > 0 && strlen($arFields["CURRENCY"]) > 0) {
$BASE_LANG_CURR = CSaleLang::GetLangCurrency($arFields["LID"]);
if ($BASE_LANG_CURR != $arFields["CURRENCY"]) {
$arFields["PRICE"] = roundEx(CCurrencyRates::ConvertCurrency($arFields["PRICE"], $arFields["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
if (is_set($arFields, "DISCOUNT_PRICE")) {
$arFields["DISCOUNT_PRICE"] = roundEx(CCurrencyRates::ConvertCurrency($arFields["DISCOUNT_PRICE"], $arFields["CURRENCY"], $BASE_LANG_CURR), SALE_VALUE_PRECISION);
}
$arFields["CURRENCY"] = $BASE_LANG_CURR;
}
}
// Changed by Sigurd, 2007-08-16
if (is_set($arFields, "QUANTITY")) {
$arFields["QUANTITY"] = DoubleVal($arFields["QUANTITY"]);
}
if ((is_set($arFields, "QUANTITY") || $ACTION == "ADD") && DoubleVal($arFields["QUANTITY"]) <= 0) {
$arFields["QUANTITY"] = 1;
}
if (is_set($arFields, "DELAY") && $arFields["DELAY"] != "Y") {
//.........这里部分代码省略.........
示例12: array
{
$arParams['CURRENCY_ID'] = '';
}
$arParams["PRICE_VAT_INCLUDE"] = $arParams["PRICE_VAT_INCLUDE"] !== "N";
$arConvertParams = array();
if ($arParams['CONVERT_CURRENCY'] == 'Y')
{
if (!CModule::IncludeModule('currency'))
{
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
}
else
{
$arCurrencyInfo = CCurrency::GetByID($arParams['CURRENCY_ID']);
if (!(is_array($arCurrencyInfo) && !empty($arCurrencyInfo)))
{
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
}
else
{
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
$arResult['CONVERT_CURRENCY'] = $arConvertParams;
$countSetDefaultItems = 0;
示例13: CheckFields
function CheckFields($ACTION, &$arFields)
{
global $DB;
if ((is_set($arFields, "NAME") || $ACTION=="ADD") && strlen($arFields["NAME"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGD_EMPTY_DELIVERY"), "ERROR_NO_NAME");
return false;
}
if ((is_set($arFields, "LID") || $ACTION=="ADD") && strlen($arFields["LID"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGD_EMPTY_SITE"), "ERROR_NO_SITE");
return false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y")
$arFields["ACTIVE"] = "N";
if ((is_set($arFields, "SORT") || $ACTION=="ADD") && IntVal($arFields["SORT"]) <= 0)
$arFields["SORT"] = 100;
if (is_set($arFields, "PRICE"))
{
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if ((is_set($arFields, "PRICE") || $ACTION=="ADD") && DoubleVal($arFields["PRICE"]) < 0)
return false;
if ((is_set($arFields, "CURRENCY") || $ACTION=="ADD") && strlen($arFields["CURRENCY"]) <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGD_EMPTY_CURRENCY"), "ERROR_NO_CURRENCY");
return false;
}
if (is_set($arFields, "ORDER_PRICE_FROM"))
{
$arFields["ORDER_PRICE_FROM"] = str_replace(",", ".", $arFields["ORDER_PRICE_FROM"]);
$arFields["ORDER_PRICE_FROM"] = DoubleVal($arFields["ORDER_PRICE_FROM"]);
}
if (is_set($arFields, "ORDER_PRICE_TO"))
{
$arFields["ORDER_PRICE_TO"] = str_replace(",", ".", $arFields["ORDER_PRICE_TO"]);
$arFields["ORDER_PRICE_TO"] = DoubleVal($arFields["ORDER_PRICE_TO"]);
}
if ((is_set($arFields, "LOCATIONS") || $ACTION=="ADD") && (!is_array($arFields["LOCATIONS"]) || count($arFields["LOCATIONS"]) <= 0))
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGD_EMPTY_LOCATION"), "ERROR_NO_LOCATIONS");
return false;
}
if (is_set($arFields, "LID"))
{
$dbSite = CSite::GetByID($arFields["LID"]);
if (!$dbSite->Fetch())
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGD_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
if (is_set($arFields, "CURRENCY"))
{
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGD_NO_CURRENCY")), "ERROR_NO_CURRENCY");
return false;
}
}
if (is_set($arFields, "LOCATIONS"))
{
$countField = count($arFields["LOCATIONS"]);
for ($i = 0; $i < $countField; $i++)
{
if ($arFields["LOCATIONS"][$i]["LOCATION_TYPE"] != "G")
$arFields["LOCATIONS"][$i]["LOCATION_TYPE"] = "L";
}
}
return True;
}
示例14: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $USER_FIELD_MANAGER, $DB;
if (is_set($arFields, "SITE_ID") && strlen($arFields["SITE_ID"]) > 0)
$arFields["LID"] = $arFields["SITE_ID"];
if ((is_set($arFields, "LID") || $ACTION=="ADD") && strlen($arFields["LID"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_SITE"), "EMPTY_SITE_ID");
return false;
}
if ((is_set($arFields, "PERSON_TYPE_ID") || $ACTION=="ADD") && IntVal($arFields["PERSON_TYPE_ID"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_PERS_TYPE"), "EMPTY_PERSON_TYPE_ID");
return false;
}
if ((is_set($arFields, "USER_ID") || $ACTION=="ADD") && IntVal($arFields["USER_ID"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_USER_ID"), "EMPTY_USER_ID");
return false;
}
if (is_set($arFields, "PAYED") && $arFields["PAYED"]!="Y")
$arFields["PAYED"]="N";
if (is_set($arFields, "CANCELED") && $arFields["CANCELED"]!="Y")
$arFields["CANCELED"]="N";
if (is_set($arFields, "STATUS_ID") && strlen($arFields["STATUS_ID"])<=0)
$arFields["STATUS_ID"]="N";
if (is_set($arFields, "ALLOW_DELIVERY") && $arFields["ALLOW_DELIVERY"]!="Y")
$arFields["ALLOW_DELIVERY"]="N";
if (is_set($arFields, "PRICE") || $ACTION=="ADD")
{
$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
}
if (is_set($arFields, "PRICE_DELIVERY") || $ACTION=="ADD")
{
$arFields["PRICE_DELIVERY"] = str_replace(",", ".", $arFields["PRICE_DELIVERY"]);
$arFields["PRICE_DELIVERY"] = DoubleVal($arFields["PRICE_DELIVERY"]);
}
if (is_set($arFields, "SUM_PAID") || $ACTION=="ADD")
{
$arFields["SUM_PAID"] = str_replace(",", ".", $arFields["SUM_PAID"]);
$arFields["SUM_PAID"] = DoubleVal($arFields["SUM_PAID"]);
}
if (is_set($arFields, "DISCOUNT_VALUE") || $ACTION=="ADD")
{
$arFields["DISCOUNT_VALUE"] = str_replace(",", ".", $arFields["DISCOUNT_VALUE"]);
$arFields["DISCOUNT_VALUE"] = DoubleVal($arFields["DISCOUNT_VALUE"]);
}
if (is_set($arFields, "TAX_VALUE") || $ACTION=="ADD")
{
$arFields["TAX_VALUE"] = str_replace(",", ".", $arFields["TAX_VALUE"]);
$arFields["TAX_VALUE"] = DoubleVal($arFields["TAX_VALUE"]);
}
if(!is_set($arFields, "LOCKED_BY") && (!is_set($arFields, "UPDATED_1C") || (is_set($arFields, "UPDATED_1C") && $arFields["UPDATED_1C"] != "Y")))
{
$arFields["UPDATED_1C"] = "N";
}
if ((is_set($arFields, "CURRENCY") || $ACTION=="ADD") && strlen($arFields["CURRENCY"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
return false;
}
if (is_set($arFields, "CURRENCY"))
{
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGO_WRONG_CURRENCY")), "ERROR_NO_CURRENCY");
return false;
}
}
if (is_set($arFields, "LID"))
{
$dbSite = CSite::GetByID($arFields["LID"]);
if (!$dbSite->Fetch())
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGO_WRONG_SITE")), "ERROR_NO_SITE");
return false;
}
}
if (is_set($arFields, "USER_ID"))
{
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if (!$dbUser->Fetch())
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGO_WRONG_USER")), "ERROR_NO_USER_ID");
return false;
}
}
if (is_set($arFields, "PERSON_TYPE_ID"))
{
//.........这里部分代码省略.........
示例15: getRub
public static function getRub()
{
$result = "RUB";
if ($arCurrency = \CCurrency::GetByID('RUR')) {
$result = 'RUR';
}
return $result;
}