本文整理汇总了PHP中CSaleDeliveryHandler::__spreadHandlerData方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDeliveryHandler::__spreadHandlerData方法的具体用法?PHP CSaleDeliveryHandler::__spreadHandlerData怎么用?PHP CSaleDeliveryHandler::__spreadHandlerData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleDeliveryHandler
的用法示例。
在下文中一共展示了CSaleDeliveryHandler::__spreadHandlerData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Set
function Set($SID, $arData, $SITE_ID = false)
{
if ($SITE_ID == 'ALL') {
$SITE_ID = false;
}
if (!defined('SALE_DH_INITIALIZED')) {
CSaleDeliveryHandler::Initialize();
}
global $APPLICATION, $DB;
$rsHandlerDataFull = CSaleDeliveryHandler::GetBySID($SID, $SITE_ID);
if ($arHandlerDataFull = $rsHandlerDataFull->Fetch()) {
$bInstalled = $arHandlerDataFull["INSTALLED"] == "Y";
$DB->StartTransaction();
$arQueryFields = array();
if ($SITE_ID) {
$arQueryFields["LID"] = "'" . ($SITE_ID == "ALL" ? "" : $DB->ForSql($SITE_ID)) . "'";
} else {
$arQueryFields["LID"] = "''";
}
if (is_set($arData, "ACTIVE")) {
$arQueryFields["ACTIVE"] = $arData["ACTIVE"] == 'Y' ? "'Y'" : "'N'";
} elseif ($bInstalled) {
$arQueryFields["ACTIVE"] = "'N'";
}
if (!$bInstalled) {
$arQueryFields["HID"] = "'" . $DB->ForSql($SID) . "'";
}
if (is_set($arData, "SORT")) {
$arQueryFields["SORT"] = "'" . intval($arData["SORT"]) . "'";
} elseif (!$bInstalled) {
$arQueryFields["SORT"] = '100';
}
if (is_set($arData, "NAME")) {
$arQueryFields["NAME"] = "'" . $DB->ForSql($arData["NAME"]) . "'";
} elseif (!$bInstalled) {
$arQueryFields["NAME"] = "'" . $DB->ForSql($arHandlerDataFull['NAME']) . "'";
}
if (is_set($arData, "DESCRIPTION")) {
$arQueryFields["DESCRIPTION"] = "'" . $DB->ForSql($arData["DESCRIPTION"]) . "'";
} elseif (!$bInstalled) {
$arQueryFields["DESCRIPTION"] = "'" . $DB->ForSql($arHandlerDataFull['DESCRIPTION']) . "'";
}
if (is_set($arData, "HANDLER")) {
$arQueryFields["HANDLER"] = "'" . $DB->ForSql($arData["HANDLER"]) . "'";
} elseif (!$bInstalled) {
$arQueryFields["HANDLER"] = "'" . $DB->ForSql($arHandlerDataFull['HANDLER']) . "'";
}
if (is_set($arData, "TAX_RATE")) {
$arQueryFields["TAX_RATE"] = "'" . doubleval($arData["TAX_RATE"]) . "'";
} elseif (!$bInstalled) {
$arQueryFields["TAX_RATE"] = 0;
}
if (is_set($arData, "CONFIG")) {
if (is_callable($arHandlerDataFull["DBSETSETTINGS"])) {
if (!($strSettings = call_user_func($arHandlerDataFull["DBSETSETTINGS"], $arData["CONFIG"]))) {
$DB->Rollback();
return false;
}
} else {
$strSettings = serialize($arData["CONFIG"]);
}
$arQueryFields["SETTINGS"] = "'" . $DB->ForSql($strSettings) . "'";
}
if (is_set($arData, "PROFILE_USE_DEFAULT") && $arData["PROFILE_USE_DEFAULT"] == 'Y') {
$arQueryFields["PROFILES"] = "''";
} else {
if (is_array($arData["PROFILES"]) && count($arData["PROFILES"]) > 0) {
$arQueryFields["PROFILES"] = "'" . $DB->ForSql(serialize($arData["PROFILES"])) . "'";
} elseif (!$bInstalled) {
$arQueryFields["PROFILES"] = "''";
}
}
if ($bInstalled) {
if ($rsHandlerDataFull->SelectedRowsCount() > 1 && $SITE_ID == false) {
$DB->Query("DELETE FROM b_sale_delivery_handler WHERE HID='" . $DB->ForSql($SID) . "' AND LID<>'" . $DB->ForSql($arHandlerDataFull['LID']) . "'");
$SITE_ID = $arHandlerDataFull['LID'];
} elseif ($arHandlerDataFull["LID"] == '' && $SITE_ID !== false) {
CSaleDeliveryHandler::__spreadHandlerData($SID);
}
$strWhere = "WHERE HID='" . $DB->ForSql($SID) . "'";
if ($SITE_ID) {
$strWhere .= " AND LID='" . $DB->ForSql($SITE_ID) . "'";
}
$DB->Update("b_sale_delivery_handler", $arQueryFields, $strWhere);
} else {
$DB->Insert("b_sale_delivery_handler", $arQueryFields);
}
$DB->Commit();
} else {
$APPLICATION->ThrowException('SALE_DH_ERROR_WRONG_HANDLER_FILE');
return false;
}
}
示例2: Set
//.........这里部分代码省略.........
$arQueryFields["BASE_CURRENCY"] = "'".$DB->ForSql($arData["BASE_CURRENCY"])."'";
elseif (!$bInstalled)
$arQueryFields["BASE_CURRENCY"] = '';
//save logotip
if (!$bInstalled && (!isset($arData["LOGOTIP"]) || count($arData["LOGOTIP"]) <= 1))
{
$logo = "";
if (is_set($arData, "HANDLER"))
$arPath = pathinfo($arData["HANDLER"]);
elseif (!$bInstalled)
$arPath = pathinfo($arHandlerDataFull["HANDLER"]);
if (!strpos($arPath["dirname"], ":"))
$arPath["dirname"] = $_SERVER["DOCUMENT_ROOT"].$arPath["dirname"];
if (file_exists($arPath["dirname"]."/".$SID."_logo.png"))
$logo = $arPath["dirname"]."/".$SID."_logo.png";
elseif (file_exists($arPath["dirname"]."/".$SID."_logo.jpg"))
$logo = $arPath["dirname"]."/".$SID."_logo.jpg";
elseif (file_exists($arPath["dirname"]."/".$SID."_logo.gif"))
$logo = $arPath["dirname"]."/".$SID."_logo.gif";
if(strlen($logo) > 0)
{
$arData["LOGOTIP"] = CFile::MakeFileArray($logo);
$arData["LOGOTIP"]["MODULE_ID"] = "sale";
}
}
$bDelLogotip = false;
if ($arData["LOGOTIP"]["del"] == "Y")
$bDelLogotip = true;
CFile::SaveForDB($arData, "LOGOTIP", "sale/delivery/logotip");
if (is_set($arData, 'LOGOTIP') && intval($arData["LOGOTIP"]) > 0)
$arQueryFields["LOGOTIP"] = $arData["LOGOTIP"];
if ($bDelLogotip)
$arQueryFields["LOGOTIP"] = 'NULL';
if (is_set($arData, "CONFIG"))
{
if (is_callable($arHandlerDataFull["DBSETSETTINGS"]))
{
if (!$strSettings = call_user_func($arHandlerDataFull["DBSETSETTINGS"], $arData["CONFIG"]))
{
$DB->Rollback();
return false;
}
}
else
{
$strSettings = serialize($arData["CONFIG"]);
}
$arQueryFields["SETTINGS"] = "'".$DB->ForSql($strSettings)."'";
}
/*
if (is_set($arData, "PROFILE_USE_DEFAULT") && $arData["PROFILE_USE_DEFAULT"] == 'Y')
$arQueryFields["PROFILES"] = "''";
else
{*/
if (is_array($arData["PROFILES"]) && count($arData["PROFILES"]) > 0)
$arQueryFields["PROFILES"] = "'".$DB->ForSql(serialize($arData["PROFILES"]))."'";
elseif (!$bInstalled)
$arQueryFields["PROFILES"] = "''";
/*}*/
if ($bInstalled)
{
if ($rsHandlerDataFull->SelectedRowsCount() > 1 && $SITE_ID === false)
{
$DB->Query("DELETE FROM b_sale_delivery_handler WHERE HID='".$DB->ForSql($SID)."' AND LID<>'".$DB->ForSql($arHandlerDataFull['LID'])."'");
$SITE_ID = $arHandlerDataFull['LID'];
}
elseif ($arHandlerDataFull["LID"] == '' && $SITE_ID !== false)
{
CSaleDeliveryHandler::__spreadHandlerData($SID);
}
$strWhere = "WHERE HID='".$DB->ForSql($SID)."'";
if ($SITE_ID) $strWhere .= " AND LID='".$DB->ForSql($SITE_ID)."'";
$DB->Update("b_sale_delivery_handler", $arQueryFields, $strWhere);
}
else
{
$DB->Insert("b_sale_delivery_handler", $arQueryFields);
}
$DB->Commit();
}
else
{
$APPLICATION->ThrowException('SALE_DH_ERROR_WRONG_HANDLER_FILE');
return false;
}
}