本文整理汇总了PHP中CCurrency类的典型用法代码示例。如果您正苦于以下问题:PHP CCurrency类的具体用法?PHP CCurrency怎么用?PHP CCurrency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCurrency类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PrepareCurrency4Where
public static function PrepareCurrency4Where($val, $key, $operation, $negative, $field, &$arField, &$arFilter)
{
$val = DoubleVal($val);
$baseSiteCurrency = "";
if (isset($arFilter["LID"]) && strlen($arFilter["LID"]) > 0)
$baseSiteCurrency = CSaleLang::GetLangCurrency($arFilter["LID"]);
elseif (isset($arFilter["CURRENCY"]) && strlen($arFilter["CURRENCY"]) > 0)
$baseSiteCurrency = $arFilter["CURRENCY"];
if (strlen($baseSiteCurrency) <= 0)
return False;
$strSqlSearch = "";
$dbCurrency = CCurrency::GetList(($by = "sort"), ($order = "asc"));
while ($arCurrency = $dbCurrency->Fetch())
{
$val1 = roundEx(CCurrencyRates::ConvertCurrency($val, $baseSiteCurrency, $arCurrency["CURRENCY"]), SALE_VALUE_PRECISION);
if (strlen($strSqlSearch) > 0)
$strSqlSearch .= " OR ";
$strSqlSearch .= "(D.ORDER_CURRENCY = '".$arCurrency["CURRENCY"]."' AND ";
if ($negative == "Y")
$strSqlSearch .= "NOT";
$strSqlSearch .= "(".$field." ".$operation." ".$val1." OR ".$field." IS NULL OR ".$field." = 0)";
$strSqlSearch .= ")";
}
return "(".$strSqlSearch.")";
}
示例2: 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;
}
示例3: 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))));
}
示例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
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))));
}
示例6: 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))));
}
示例7: __AddCellCurrency
/**
* @param $intRangeID
* @param $strPrefix
* @return string
*/
function __AddCellCurrency($intRangeID, $strPrefix)
{
$currencySelectbox = CCurrency::SelectBox("{$strPrefix}CURRENCY[{$intRangeID}]", '', "", true, "", "class=\"adm-select\" style=\"width: 169px;\"");
return <<<CURRENCYCELL
\t<td width="30%">
\t\t<span class="adm-select-wrap">
\t\t\t{$currencySelectbox}
\t\t</span>
\t</td>
CURRENCYCELL;
}
示例8: GetWMCurrency
static function GetWMCurrency($currency) {
$arCurrency = array();
if(CModule::IncludeModule("currency")) {
$lcur = CCurrency::GetList(($b="name"), ($order1="asc"), LANGUAGE_ID);
while($lcur_res = $lcur->Fetch()) {
$arCurrency[$lcur_res['CURRENCY']] = COption::GetOptionString(COnpayPayment::$module_id, "currency_".$lcur_res['CURRENCY']);
}
}
if(isset($arCurrency, $currency)) $currency = $arCurrency[$currency];
return $currency;
}
示例9: PrepareListItems
public static function PrepareListItems()
{
if (!CModule::IncludeModule('currency')) {
return array();
}
$ary = array();
$dbCurrencies = CCurrency::GetList($by = 'sort', $order = 'asc');
while ($arCurrency = $dbCurrencies->Fetch()) {
$ary[$arCurrency['CURRENCY']] = $arCurrency['FULL_NAME'];
}
return $ary;
}
示例10: 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),
),
)
);
}
示例11: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
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")) {
if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGO_WRONG_PERSON_TYPE")), "ERROR_NO_PERSON_TYPE");
return false;
}
}
if (is_set($arFields, "PAY_SYSTEM_ID") && IntVal($arFields["PAY_SYSTEM_ID"]) > 0) {
if (!($arPaySystem = CSalePaySystem::GetByID(IntVal($arFields["PAY_SYSTEM_ID"])))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PAY_SYSTEM_ID"], GetMessage("SKGO_WRONG_PS")), "ERROR_NO_PAY_SYSTEM");
return false;
}
}
if (is_set($arFields, "DELIVERY_ID") && (strpos($arFields["DELIVERY_ID"], ":") !== false || IntVal($arFields["DELIVERY_ID"]) > 0)) {
if (strpos($arFields["DELIVERY_ID"], ":") !== false) {
$arId = explode(":", $arFields["DELIVERY_ID"]);
$obDelivery = new CSaleDeliveryHandler();
if ($arDelivery = $obDelivery->GetBySID($arId[0])) {
if ($arDelivery = $arDelivery->Fetch()) {
if (!is_set($arDelivery["PROFILES"], $arId[1])) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
return false;
}
}
} else {
//.........这里部分代码省略.........
示例12: switch
switch ($_REQUEST['action']) {
case "delete":
if ($CURRENCY_RIGHT == "W") {
if (!CCurrency::Delete($ID)) {
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(GetMessage("currency_err1"), $ID);
}
}
}
break;
}
}
}
$rsData = CCurrency::GetList($by, $order);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("CURRENCY_TITLE")));
$arHeaders = array();
$arHeaders[] = array("id" => "CURRENCY", "content" => GetMessage('currency_curr'), "sort" => "CURRENCY", "default" => true);
$arHeaders[] = array("id" => "FULL_NAME", "content" => GetMessage('CURRENCY_FULL_NAME'), "sort" => "name", "default" => true);
$arHeaders[] = array("id" => "SORT", "content" => GetMessage('currency_sort'), "sort" => "sort", "default" => true);
$arHeaders[] = array("id" => "AMOUNT_CNT", "content" => GetMessage('currency_rate_cnt'), "default" => true);
$arHeaders[] = array("id" => "AMOUNT", "content" => GetMessage('currency_rate'), "default" => true);
$lAdmin->AddHeaders($arHeaders);
while ($arRes = $rsData->NavNext(true, "f_")) {
$row =& $lAdmin->AddRow($f_CURRENCY, $arRes, "/bitrix/admin/currency_edit.php?ID=" . $f_CURRENCY . "&lang=" . LANGUAGE_ID, GetMessage('CURRENCY_A_EDIT'));
$row->AddViewField("CURRENCY", '<a href="/bitrix/admin/currency_edit.php?ID=' . $f_CURRENCY . '&lang=' . LANGUAGE_ID . '" title="' . GetMessage('CURRENCY_A_EDIT_TITLE') . '">' . $f_CURRENCY . '</a>');
$row->AddInputField("SORT", array("size" => "3"));
$row->AddViewField("FULL_NAME", $f_FULL_NAME);
示例13: __ConvertOldFormat
protected function __ConvertOldFormat($strAction, &$arFields)
{
global $APPLICATION;
$arMsg = array();
$boolResult = true;
$arNeedFields = array('LID', 'CURRENCY', 'DISCOUNT_TYPE', 'DISCOUNT_VALUE', 'PRICE_FROM', 'PRICE_TO');
$arUpdateFields = array('DISCOUNT_VALUE', 'PRICE_FROM', 'PRICE_TO');
$strAction = ToUpper($strAction);
if (!array_key_exists('CONDITIONS', $arFields) && !array_key_exists('ACTIONS', $arFields)) {
$strSiteCurrency = '';
$boolUpdate = false;
if ('UPDATE' == $strAction) {
$boolNeedQuery = false;
foreach ($arUpdateFields as &$strFieldID) {
if (array_key_exists($strFieldID, $arFields)) {
$boolUpdate = true;
break;
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
if ($boolUpdate) {
foreach ($arNeedFields as &$strFieldID) {
if (!array_key_exists($strFieldID, $arFields)) {
$boolNeedQuery = true;
break;
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
if ($boolNeedQuery) {
$rsDiscounts = CSaleDiscount::GetList(array(), array('ID' => $arFields['ID']), false, false, $arNeedFields);
if ($arDiscount = $rsDiscounts->Fetch()) {
foreach ($arNeedFields as &$strFieldID) {
if (!array_key_exists($strFieldID, $arFields)) {
$arFields[$strFieldID] = $arDiscount[$strFieldID];
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
} else {
$boolUpdate = false;
$boolResult = false;
$arMsg[] = array('id' => 'ID', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_ABSENT'));
}
}
}
}
if ('ADD' == $strAction || $boolUpdate) {
if (!array_key_exists('LID', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_SITE_ID_ABSENT'));
} else {
$arFields['LID'] = strval($arFields['LID']);
if ('' == $arFields['LID']) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_SITE_ID_ABSENT'));
} else {
$rsSites = CSite::GetByID($arFields["LID"]);
if (!($arSite = $rsSites->Fetch())) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => Loc::getMessage('SKGD_NO_SITE', array('#ID#' => $arFields['LID'])));
} else {
$strSiteCurrency = CSaleLang::GetLangCurrency($arFields['LID']);
}
}
}
if (!array_key_exists('CURRENCY', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_CURRENCY_ABSENT'));
} else {
$arFields['CURRENCY'] = strval($arFields['CURRENCY']);
if ('' == $arFields['CURRENCY']) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_CURRENCY_ABSENT'));
} else {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => Loc::getMessage('SKGD_NO_CURRENCY', array('#ID#' => $arFields['CURRENCY'])));
}
}
}
if (!array_key_exists("DISCOUNT_TYPE", $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_TYPE', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_TYPE_ABSENT'));
} else {
$arFields["DISCOUNT_TYPE"] = strval($arFields["DISCOUNT_TYPE"]);
if (CSaleDiscount::OLD_DSC_TYPE_PERCENT != $arFields["DISCOUNT_TYPE"] && CSaleDiscount::OLD_DSC_TYPE_FIX != $arFields["DISCOUNT_TYPE"]) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_TYPE', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_TYPE_BAD'));
}
}
if (!array_key_exists('DISCOUNT_VALUE', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_VALUE', 'text' => Loc::getMessage('BT_MOD_SALE_ERR_DSC_VALUE_ABSENT'));
} else {
$arFields['DISCOUNT_VALUE'] = (double) str_replace(',', '.', $arFields['DISCOUNT_VALUE']);
//.........这里部分代码省略.........
示例14: array
$bVarsFromForm = true;
}
}
$dbUserCards = CSaleUserCards::GetList(array("DATE_UPDATE" => "DESC"), array("ID" => $ID, "USER_ID" => IntVal($GLOBALS["USER"]->GetID())), false, false, array("ID", "USER_ID", "ACTIVE", "SORT", "PAY_SYSTEM_ACTION_ID", "CURRENCY", "CARD_TYPE", "CARD_NUM", "CARD_CODE", "CARD_EXP_MONTH", "CARD_EXP_YEAR", "DESCRIPTION", "SUM_MIN", "SUM_MAX", "SUM_CURRENCY", "TIMESTAMP_X", "LAST_STATUS", "LAST_STATUS_CODE", "LAST_STATUS_DESCRIPTION", "LAST_STATUS_MESSAGE", "LAST_SUM", "LAST_CURRENCY", "LAST_DATE"));
if ($arUserCards = $dbUserCards->GetNext()) {
$arResult = $arUserCards;
$arResult["CARD_NUM"] = CSaleUserCards::CryptData($arResult["CARD_NUM"], "D");
} else {
$arResult["ID"] = 0;
$arResult["ACTIVE"] = "Y";
$arResult["SORT"] = 100;
}
if ($bVarsFromForm) {
foreach ($_POST as $k => $v) {
$arResult[$k] = htmlspecialcharsex($v);
$arResult['~' . $k] = $v;
}
}
$arResult["ERROR_MESSAGE"] = $errorMessage;
$dbPaySysActions = CSalePaySystemAction::GetList(array("PERSON_TYPE_ID" => "ASC", "NAME" => "ASC", "PT_NAME" => "ASC", "PS_NAME" => "ASC"), array("PS_LID" => SITE_ID, "HAVE_ACTION" => "Y"), false, false, array("*"));
$arResult["PAY_SYSTEM"] = array();
while ($arPaySysActions = $dbPaySysActions->GetNext()) {
$arResult["PAY_SYSTEM"][] = $arPaySysActions;
}
$dbCurrency = CCurrency::GetList($by = "sort", $order = "asc");
$arResult["CURRENCY_INFO"] = array();
while ($arCurrency = $dbCurrency->GetNext()) {
$arResult["CURRENCY_INFO"][] = $arCurrency;
}
$arResult["CARD_TYPE_INFO"] = array("VISA" => "Visa", "MASTERCARD" => "MasterCard", "AMEX" => "Amex", "DINERS" => "Diners", "DISCOVER" => "Discover", "JCB" => "JCB", "ENROUTE" => "Enroute");
$this->IncludeComponentTemplate();
示例15: unset
unset($strEmptyPreview);
$arSKUPropList = array();
$arSKUPropIDs = array();
$arSKUPropKeys = array();
$boolSKU = false;
$strBaseCurrency = '';
$boolConvert = isset($arResult['CONVERT_CURRENCY']['CURRENCY_ID']);
//
$skuPropList = array();
// array("id_catalog" => array(...))
$skuPropIds = array();
// array("id_catalog" => array(...))
$skuPropKeys = array();
// array("id_catalog" => array(...))
if (!$boolConvert) {
$strBaseCurrency = CCurrency::GetBaseCurrency();
}
$catalogs = array();
foreach ($arResult['CATALOGS'] as $catalog) {
$offersCatalogId = (int) $catalog['OFFERS_IBLOCK_ID'];
$offersPropId = (int) $catalog['OFFERS_PROPERTY_ID'];
$catalogId = (int) $catalog['IBLOCK_ID'];
$sku = false;
if ($offersCatalogId > 0 && $offersPropId > 0) {
$sku = array("IBLOCK_ID" => $offersCatalogId, "SKU_PROPERTY_ID" => $offersPropId, "PRODUCT_IBLOCK_ID" => $catalogId);
}
if (!empty($sku) && is_array($sku)) {
$skuPropList[$catalogId] = CIBlockPriceTools::getTreeProperties($sku, $arParams['OFFER_TREE_PROPS'][$offersCatalogId], array('PICT' => $arEmptyPreview, 'NAME' => '-'));
$needValues = array();
CIBlockPriceTools::getTreePropertyValues($skuPropList[$catalogId], $needValues);
$skuPropIds[$catalogId] = array_keys($skuPropList[$catalogId]);