本文整理汇总了PHP中CSaleDeliveryHandler::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleDeliveryHandler::Set方法的具体用法?PHP CSaleDeliveryHandler::Set怎么用?PHP CSaleDeliveryHandler::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleDeliveryHandler
的用法示例。
在下文中一共展示了CSaleDeliveryHandler::Set方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPostForm
function OnPostForm()
{
$wizard =& $this->GetWizard();
if ($wizard->IsNextButtonClick()) {
$arResult = $wizard->GetVars(true);
COption::SetOptionString("sale", "order_email", $arResult["orderEmail"]);
COption::SetOptionString("sale", "delete_after", $arResult["saveBasket"]);
COption::SetOptionString("sale", "default_currency", $arResult["currencyID"]);
$arFields["LID"] = $arResult["siteID"];
$arFields["CURRENCY"] = $arResult["currencyID"];
CSaleLang::Update($arResult["siteID"], array("LID" => $arResult["siteID"], "CURRENCY" => $arResult["currencyID"]));
CSaleGroupAccessToSite::DeleteBySite($arResult["siteID"]);
foreach ($arResult["groupID"] as $v) {
CSaleGroupAccessToSite::Add(array("SITE_ID" => $arResult["siteID"], "GROUP_ID" => $v));
}
if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
COption::SetOptionString("catalog", "1C_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
}
COption::SetOptionString("catalog", "1C_ELEMENT_ACTION", $arResult["1C_ELEMENT_ACTION"]);
COption::SetOptionString("catalog", "1C_SECTION_ACTION", $arResult["1C_SECTION_ACTION"]);
COption::SetOptionString("catalog", "1C_INTERVAL", $arResult["1C_INTERVAL"]);
COption::SetOptionString("catalog", "1C_FILE_SIZE_LIMIT", $arResult["1C_FILE_SIZE_LIMIT"]);
COption::SetOptionString("catalog", "1C_SITE_LIST", $arResult["siteID"]);
if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
COption::SetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
}
COption::SetOptionString("sale", "1C_EXPORT_PAYED_ORDERS", $arResult["1C_EXPORT_PAYED_ORDERS"]);
COption::SetOptionString("sale", "1C_EXPORT_ALLOW_DELIVERY_ORDERS", $arResult["1C_EXPORT_ALLOW_DELIVERY_ORDERS"]);
COption::SetOptionString("sale", "1C_EXPORT_FINAL_ORDERS", $arResult["1C_EXPORT_FINAL_ORDERS"]);
COption::SetOptionString("sale", "1C_FINAL_STATUS_ON_DELIVERY", $arResult["1C_FINAL_STATUS_ON_DELIVERY"]);
COption::SetOptionString("sale", "1C_SALE_SITE_LIST", $arResult["siteID"]);
foreach ($arResult["groupID"] as $v) {
$perm = $GLOBALS["APPLICATION"]->GetGroupRight("sale", $v);
if ($perm != "W") {
$GLOBALS["APPLICATION"]->SetGroupRight("sale", $v, "U");
}
}
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"]), false, false, array("ID", "LID", "SORT"));
while ($arStatus = $dbStatus->Fetch()) {
$arPerms = array();
foreach ($arResult["groupID"] as $v) {
$arPerms[] = array("GROUP_ID" => $v, "PERM_VIEW" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"] == "Y" ? "Y" : $arResult["perm"][$arStatus["ID"]][$v]["PERM_VIEW"], "PERM_CANCEL" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"], "PERM_MARK" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_MARK"], "PERM_DEDUCTION" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DEDUCTION"], "PERM_DELIVERY" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"], "PERM_PAYMENT" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"], "PERM_STATUS" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS"], "PERM_STATUS_FROM" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS_FROM"], "PERM_UPDATE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"], "PERM_DELETE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"]);
}
CSaleStatus::Update($arStatus["ID"], array("PERMS" => $arPerms, "SORT" => $arStatus["SORT"]));
}
$paySystemID = array();
$paySystem = array();
foreach ($arResult["paySystem"] as $pType => $pSystem) {
if (!empty($pSystem)) {
foreach ($pSystem as $v) {
$paySystem[$v][] = $pType;
if (!in_array($v, $paySystemID)) {
$paySystemID[] = $v;
}
}
}
}
$dbPaySys = CSalePaySystem::GetList(array(), array("ACTIVE" => "Y"), false, false, array("ID", "ACTIVE"));
while ($arPaySys = $dbPaySys->Fetch()) {
if (!in_array($arPaySys["ID"], $paySystemID)) {
CSalePaySystem::Update($arPaySys["ID"], array("ACTIVE" => "N"));
}
}
foreach ($paySystem as $pID => $value) {
$dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
while ($arPaySysAction = $dbPaySysAction->Fetch()) {
if (!in_array($arPaySysAction["PERSON_TYPE_ID"], $value)) {
CSalePaySystemAction::Delete($arPaySysAction["ID"]);
}
}
}
function LocalGetPSActionParams($fileName)
{
$arPSCorrespondence = array();
if (file_exists($fileName) && is_file($fileName)) {
include $fileName;
}
return $arPSCorrespondence;
}
foreach ($paySystem as $pID => $value) {
foreach ($value as $personID) {
$arFields = array();
$arPaySysAction = "";
$dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID, "PERSON_TYPE_ID" => $personID));
if ($arPaySysAction = $dbPaySysAction->Fetch()) {
$pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"];
} else {
$dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
if ($arPaySysActionTmp = $dbPaySysAction->Fetch()) {
$pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysActionTmp["ACTION_FILE"];
}
}
if (strlen($pathToAction) > 0) {
$arPSCorrespondence = LocalGetPSActionParams($pathToAction . "/.description.php");
$arParams = array();
foreach ($arPSCorrespondence as $k => $v) {
$typeTmp = $arResult[$pID . "_" . $k . "_" . $personID];
$valueTmp = $arResult["VALUE1_" . $pID . "_" . $k . "_" . $personID];
if (strlen($valueTmp) <= 0) {
$valueTmp = $arResult["VALUE2_" . $pID . "_" . $k . "_" . $personID];
//.........这里部分代码省略.........
示例2: array
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "ups", "NAME" => "UPS", "SORT" => 300, "DESCRIPTION" => GetMessage("SALE_WIZARD_UPS"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_ups.php", "SETTINGS" => "/bitrix/modules/sale/delivery/ups/ru_csv_zones.csv;/bitrix/modules/sale/delivery/ups/ru_csv_export.csv", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif");
}
if ($delivery["ups"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDeliveryHandler::Set("ups", $arFields);
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "dhlusa", "NAME" => "DHL (USA)", "SORT" => 300, "DESCRIPTION" => GetMessage("SALE_WIZARD_UPS"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_dhl_usa.php ", "SETTINGS" => "", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif");
}
if ($delivery["dhl"] != "Y") {
$arFields["ACTIVE"] = "N";
}
CSaleDeliveryHandler::Set("dhlusa", $arFields);
}
}
if (CModule::IncludeModule('subscribe')) {
$templates_dir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/subscribe/templates";
$template = $templates_dir . "/store_news_" . WIZARD_SITE_ID;
//Copy template from module if where was no template
if (!file_exists($template)) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/php_interface/subscribe/templates/news", $template, false, true);
$fname = $template . "/template.php";
if (file_exists($fname) && is_file($fname) && ($fh = fopen($fname, "rb"))) {
$php_source = fread($fh, filesize($fname));
$php_source = preg_replace("#([\"'])(SITE_ID)(\\1)(\\s*=>\\s*)([\"'])(.*?)(\\5)#", "\\1\\2\\3\\4\\5" . WIZARD_SITE_ID . "\\7", $php_source);
$php_source = str_replace("Windows-1251", $arSite["CHARSET"], $php_source);
$php_source = str_replace("Hello!", GetMessage("SUBSCR_1"), $php_source);
$php_source = str_replace("<P>Best Regards!</P>", "", $php_source);
示例3: elseif
}
} elseif ($shopLocalization == "ua") {
if ($delivery["ua_post"] == "Y" && $arAutoDeliveries["ua_post"] != "Y") {
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "ua_post", "NAME" => GetMessage("SALE_WIZARD_UA_POST"), "SORT" => 600, "DESCRIPTION" => "", "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_ua_post.php", "SETTINGS" => "23", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
CSaleDeliveryHandler::Set("ua_post", $arFields);
}
} elseif ($shopLocalization == "kz") {
if ($delivery["kaz_post"] == "Y" && $arAutoDeliveries["kaz_post"] != "Y") {
$arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "kaz_post", "NAME" => GetMessage("SALE_WIZARD_KAZ_POST"), "SORT" => 600, "DESCRIPTION" => "", "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_kaz_post.php", "SETTINGS" => "23", "PROFILES" => "", "TAX_RATE" => 0);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif")) {
$arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/ru/delivery/" . $arFields["HID"] . "_logo.gif");
}
CSaleDeliveryHandler::Set("kaz_post", $arFields);
}
}
}
}
if (CModule::IncludeModule('subscribe')) {
$templates_dir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/subscribe/templates";
$template = $templates_dir . "/store_news_" . WIZARD_SITE_ID;
//Copy template from module if where was no template
if (!file_exists($template)) {
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/php_interface/subscribe/templates/news", $template, false, true);
$fname = $template . "/template.php";
if (file_exists($fname) && is_file($fname) && ($fh = fopen($fname, "rb"))) {
$php_source = fread($fh, filesize($fname));
$php_source = preg_replace("#([\"'])(SITE_ID)(\\1)(\\s*=>\\s*)([\"'])(.*?)(\\5)#", "\\1\\2\\3\\4\\5" . WIZARD_SITE_ID . "\\7", $php_source);
$php_source = str_replace("Windows-1251", $arSite["CHARSET"], $php_source);
示例4: convertToNew
/**
* @return \Bitrix\Sale\Result|bool
* @throws Exception
* @throws \Bitrix\Main\SystemException
*/
public static function convertToNew($renameTable = false)
{
$result = new \Bitrix\Sale\Result();
$con = \Bitrix\Main\Application::getConnection();
if (!$con->isTableExists("b_sale_delivery_handler")) {
return true;
}
$sqlHelper = $con->getSqlHelper();
$deliveryRes = $con->query('SELECT * FROM b_sale_delivery_handler WHERE CONVERTED != \'Y\'');
$tablesToUpdate = array('b_sale_order', 'b_sale_order_history');
\CSaleDeliveryHandler::Initialize();
$handlers = \CSaleDeliveryHandler::__getRegisteredHandlers();
while ($delivery = $deliveryRes->fetch()) {
if (strlen($delivery["PROFILES"]) > 0) {
$delivery["PROFILES"] = unserialize($delivery["PROFILES"]);
} else {
$delivery["PROFILES"] = $handlers[$delivery["HID"]]["PROFILES"];
foreach ($delivery["PROFILES"] as $id => $params) {
$delivery["PROFILES"][$id]["ACTIVE"] = $delivery["ACTIVE"];
}
}
// Something strange it probably not used
if ($delivery["PROFILES"] == false || !is_array($delivery["PROFILES"]) || empty($delivery["PROFILES"])) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't receive info about profiles. Delivery HID: \"" . $delivery["HID"] . "\""));
continue;
}
unset($delivery["ID"]);
$delivery["CONFIG"] = array();
if (strlen($delivery["SETTINGS"]) > 0) {
if (isset($handlers[$delivery["HID"]]["DBGETSETTINGS"]) && is_callable($handlers[$delivery["HID"]]["DBGETSETTINGS"])) {
$delivery["CONFIG"] = call_user_func($handlers[$delivery["HID"]]["DBGETSETTINGS"], $delivery["SETTINGS"]);
} else {
$delivery["CONFIG"] = $delivery["SETTINGS"];
}
} elseif (is_callable($handlers[$delivery["HID"]]["GETCONFIG"])) {
$config = call_user_func($handlers[$delivery["HID"]]["GETCONFIG"], strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
foreach ($config["CONFIG"] as $key => $arConfig) {
if (!empty($arConfig["DEFAULT"])) {
$delivery["CONFIG"][$key] = $arConfig["DEFAULT"];
}
}
}
$delivery["SID"] = $handlers[$delivery["HID"]]["SID"];
$id = \CSaleDeliveryHandler::Set($delivery["HID"], $delivery, strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
if (intval($id) <= 0) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't convert delivery handler with hid: " . $delivery["HID"] . (strlen($delivery["LID"]) > 0 ? " for site: " . $delivery["LID"] : "")));
continue;
}
$con->queryExecute('UPDATE b_sale_delivery_handler SET CONVERTED="Y" WHERE HID="' . $sqlHelper->forSql($delivery["HID"]) . '"');
$ids = array($id);
foreach ($delivery["PROFILES"] as $profileName => $profileData) {
$fullSid = $delivery["HID"] . ":" . $profileName;
$profileId = \Bitrix\Sale\Delivery\Services\Table::getIdByCode($fullSid);
$ids[] = $profileId;
if (intval($profileId) > 0) {
foreach ($tablesToUpdate as $table) {
$con->queryExecute("UPDATE " . $table . " SET DELIVERY_ID=" . $sqlHelper->forSql($profileId) . " WHERE DELIVERY_ID = '" . $sqlHelper->forSql($fullSid) . "'");
}
$con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID=" . $sqlHelper->forSql($profileId) . ", DELIVERY_PROFILE_ID='' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND DELIVERY_PROFILE_ID='" . $profileName . "'");
} else {
$result->addError(new \Bitrix\Main\Entity\EntityError("Cant determine id for profile code: " . $fullSid));
}
}
$con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID=" . $sqlHelper->forSql($id) . ", DELIVERY_PROFILE_ID='' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND (DELIVERY_PROFILE_ID='' OR DELIVERY_PROFILE_ID IS NULL)");
$d2pRes = \Bitrix\Sale\Internals\DeliveryPaySystemTable::getList(array('filter' => array('DELIVERY_ID' => $ids), 'select' => array("DELIVERY_ID"), 'group' => array("DELIVERY_ID")));
while ($d2p = $d2pRes->fetch()) {
$res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $d2p["DELIVERY_ID"], "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem', "SORT" => 100));
if (!$res->isSuccess()) {
$result->addErrors($res->getErrors());
}
}
}
if ($renameTable && $result->isSuccess()) {
$con->queryExecute("ALTER TABLE b_sale_delivery_handler RENAME b_sale_delivery_handler_old");
}
return $result;
}
示例5: convertToNew
/**
* @return \Bitrix\Sale\Result
* @throws Exception
* @throws \Bitrix\Main\SystemException
*/
public static function convertToNew($renameTable = false)
{
$result = new \Bitrix\Sale\Result();
$con = \Bitrix\Main\Application::getConnection();
if (!$con->isTableExists("b_sale_delivery_handler")) {
return $result;
}
$sqlHelper = $con->getSqlHelper();
$deliveryRes = $con->query('SELECT * FROM b_sale_delivery_handler WHERE CONVERTED != \'Y\'');
$tablesToUpdate = array('b_sale_order', 'b_sale_order_history');
\CSaleDeliveryHandler::Initialize();
$handlers = \CSaleDeliveryHandler::__getRegisteredHandlers();
while ($delivery = $deliveryRes->fetch()) {
if (strlen($delivery["HID"]) <= 0) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't find delivery HID. ID: \"" . $delivery["ID"] . "\""));
continue;
}
if (!isset($handlers[$delivery["HID"]])) {
\CEventLog::Add(array("SEVERITY" => "ERROR", "AUDIT_TYPE_ID" => "SALE_CONVERTER_ERROR", "MODULE_ID" => "sale", "ITEM_ID" => "CAllSaleDeliveryHandler::convertToNew()", "DESCRIPTION" => "Can't find delivery handler for registered HID: \"" . $delivery["HID"] . "\""));
//$result->addError( new \Bitrix\Main\Entity\EntityError("Can't find delivery handler for registered HID: \"".$delivery["HID"]."\""));
continue;
}
if (strlen($delivery["PROFILES"]) > 0) {
//get from base
$delivery["PROFILES"] = unserialize($delivery["PROFILES"]);
} else {
//or default.
$delivery["PROFILES"] = $handlers[$delivery["HID"]]["PROFILES"];
}
// Something strange it probably not used
if ($delivery["PROFILES"] == false || !is_array($delivery["PROFILES"]) || empty($delivery["PROFILES"])) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't receive info about profiles. Delivery HID: \"" . $delivery["HID"] . "\""));
continue;
}
//Set profiles activity
foreach ($delivery["PROFILES"] as $id => $params) {
if (!isset($delivery["PROFILES"][$id]["ACTIVE"]) || $delivery["ACTIVE"] == "N") {
$delivery["PROFILES"][$id]["ACTIVE"] = $delivery["ACTIVE"];
}
}
unset($delivery["ID"]);
$delivery["CONFIG"] = array();
if (strlen($delivery["SETTINGS"]) > 0) {
if (isset($handlers[$delivery["HID"]]["DBGETSETTINGS"]) && is_callable($handlers[$delivery["HID"]]["DBGETSETTINGS"])) {
$delivery["CONFIG"] = call_user_func($handlers[$delivery["HID"]]["DBGETSETTINGS"], $delivery["SETTINGS"]);
} else {
$delivery["CONFIG"] = $delivery["SETTINGS"];
}
} elseif (isset($handlers[$delivery["HID"]]["GETCONFIG"]) && is_callable($handlers[$delivery["HID"]]["GETCONFIG"])) {
$config = call_user_func($handlers[$delivery["HID"]]["GETCONFIG"], strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
foreach ($config["CONFIG"] as $key => $arConfig) {
if (!empty($arConfig["DEFAULT"])) {
$delivery["CONFIG"][$key] = $arConfig["DEFAULT"];
}
}
}
if (empty($delivery["NAME"])) {
if (!empty($handlers[$delivery["HID"]]["NAME"])) {
$delivery["NAME"] = $handlers[$delivery["HID"]]["NAME"];
} else {
$delivery["NAME"] = "-";
}
}
$delivery["SID"] = $handlers[$delivery["HID"]]["SID"];
$id = \CSaleDeliveryHandler::Set($delivery["HID"], $delivery, strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
if (intval($id) <= 0) {
$result->addError(new \Bitrix\Main\Entity\EntityError("Can't convert delivery handler with hid: " . $delivery["HID"] . (strlen($delivery["LID"]) > 0 ? " for site: " . $delivery["LID"] : "")));
continue;
}
$con->queryExecute("UPDATE b_sale_delivery_handler SET CONVERTED='Y' WHERE HID LIKE '" . $sqlHelper->forSql($delivery["HID"]) . "'");
$ids = array($id);
foreach ($delivery["PROFILES"] as $profileName => $profileData) {
$fullSid = $delivery["HID"] . ":" . $profileName;
$profileId = \CSaleDelivery::getIdByCode($fullSid);
$ids[] = $profileId;
if (intval($profileId) > 0) {
foreach ($tablesToUpdate as $table) {
$con->queryExecute("UPDATE " . $table . " SET DELIVERY_ID='" . $sqlHelper->forSql($profileId) . "' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($fullSid) . "'");
}
$con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID='" . $sqlHelper->forSql($profileId) . "', DELIVERY_PROFILE_ID='##CONVERTED##' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND DELIVERY_PROFILE_ID='" . $profileName . "'");
} else {
$result->addError(new \Bitrix\Main\Entity\EntityError("Cant determine id for profile code: " . $fullSid));
}
}
$con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID='" . $sqlHelper->forSql($id) . "', DELIVERY_PROFILE_ID='##CONVERTED##' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND (DELIVERY_PROFILE_ID='' OR DELIVERY_PROFILE_ID IS NULL)");
$d2pRes = \Bitrix\Sale\Internals\DeliveryPaySystemTable::getList(array('filter' => array('DELIVERY_ID' => $ids), 'select' => array("DELIVERY_ID"), 'group' => array("DELIVERY_ID")));
while ($d2p = $d2pRes->fetch()) {
$res = \Bitrix\Sale\Internals\ServiceRestrictionTable::add(array("SERVICE_ID" => $d2p["DELIVERY_ID"], "SERVICE_TYPE" => \Bitrix\Sale\Services\Base\RestrictionManager::SERVICE_TYPE_SHIPMENT, "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem', "SORT" => 100));
if (!$res->isSuccess()) {
$result->addErrors($res->getErrors());
}
}
}
if ($renameTable && $result->isSuccess()) {
$con->renameTable('b_sale_delivery_handler', 'b_sale_delivery_handler_old');
//.........这里部分代码省略.........
示例6: __IncludeLang
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('sale')) {
return;
}
$siteID = $arParams["site_id"];
if (strlen($arParams["site_id"]) <= 0) {
$siteID = "s1";
}
$dbSite = CSite::GetByID($siteID);
if ($arSite = $dbSite->Fetch()) {
$lang = $arSite["LANGUAGE_ID"];
}
if (strlen($lang) <= 0) {
$lang = "ru";
}
$bRus = false;
if ($lang == "ru") {
$bRus = true;
}
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/step8.php", $lang));
$dbLocation = CSaleLocation::GetList(array("ID" => "ASC"), array("LID" => $lang));
if ($arLocation = $dbLocation->Fetch()) {
if ($bRus) {
CSaleDeliveryHandler::Set("cpcr", array("LID" => "", "ACTIVE" => "Y", "HID" => "cpcr", "NAME" => GetMessage("SALE_WIZARD_SPSR"), "SORT" => 150, "DESCRIPTION" => GetMessage("SALE_WIZARD_SPSR_DESCR"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_cpcr.php", "SETTINGS" => "8", "PROFILES" => "", "TAX_RATE" => 0));
CSaleDeliveryHandler::Set("russianpost", array("LID" => "", "ACTIVE" => "Y", "HID" => "russianpost", "NAME" => GetMessage("SALE_WIZARD_MAIL"), "SORT" => 200, "DESCRIPTION" => GetMessage("SALE_WIZARD_MAIL_DESCR"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_russianpost.php", "SETTINGS" => "23", "PROFILES" => "", "TAX_RATE" => 0));
}
CSaleDeliveryHandler::Set("ups", array("LID" => "", "ACTIVE" => "Y", "HID" => "ups", "NAME" => "UPS", "SORT" => 200, "DESCRIPTION" => GetMessage("SALE_WIZARD_UPS"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_ups.php", "SETTINGS" => "/bitrix/modules/sale/delivery/ups/ru_csv_zones.csv;/bitrix/modules/sale/delivery/ups/ru_csv_export.csv", "PROFILES" => "", "TAX_RATE" => 0));
}
示例7: __IncludeLang
}
if (strlen($lang) <= 0) {
$lang = "ru";
}
$bRus = false;
if ($lang == "ru") {
$bRus = true;
}
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/step8.php", $lang));
$dbLocation = CSaleLocation::GetList(array("ID" => "ASC"), array("LID" => $lang));
if ($arLocation = $dbLocation->Fetch()) {
$arLocation4Delivery = array();
do {
$arLocation4Delivery[] = array("LOCATION_ID" => $arLocation["ID"], "LOCATION_TYPE" => "L");
} while ($arLocation = $dbLocation->Fetch());
//Location group
$dblocationGroupID = CSaleLocationGroup::GetList(array("ID" => "DESC"));
if ($arLocationGroupID = $dblocationGroupID->Fetch()) {
$locationGroupID = $arLocationGroupID["ID"];
}
$arLocation4Delivery[] = array("LOCATION_ID" => $locationGroupID, "LOCATION_TYPE" => "G");
//delivery handler
CSaleDeliveryHandler::Set("simple", array("LID" => "", "ACTIVE" => "Y", "HID" => "simple", "NAME" => GetMessage("SALE_WIZARD_COUR1"), "SORT" => 100, "DESCRIPTION" => "", "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_simple.php", "SETTINGS" => "", "PROFILES" => "", "TAX_RATE" => 0, "CONFIG" => array("price_" . $locationGroupID => "100")));
//Tax
$taxID = CSaleTax::Add(array("LID" => $siteID, "NAME" => GetMessage("SALE_WIZARD_VAT"), "CODE" => "NDS"));
$dbPerson = CSalePersonType::GetList(array("SORT" => "DESC"));
if ($arPerson = $dbPerson->Fetch()) {
//Tax rate
CSaleTaxRate::Add(array("TAX_ID" => $taxID, "PERSON_TYPE_ID" => $arPerson["ID"], "VALUE" => 18, "CURRENCY" => $bRus ? "RUB" : "USD", "IS_PERCENT" => "Y", "IS_IN_PRICE" => "Y", "APPLY_ORDER" => 100, "ACTIVE" => "Y", "TAX_LOCATION" => $arLocation4Delivery));
}
}
示例8: foreach
}
$DB->StartTransaction();
$bError = false;
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "reset":
CSaleDeliveryHandler::Reset($ID);
break;
case 'activate':
CSaleDeliveryHandler::Set($ID, array('ACTIVE' => 'Y'));
break;
case 'deactivate':
CSaleDeliveryHandler::Set($ID, array('ACTIVE' => 'N'));
break;
}
if ($bError) {
break;
}
}
if (!$bError) {
$DB->Commit();
} else {
$DB->Rollback();
}
}
$arList = array();
$arDeliveryHandlersList = array();
$rsDeliveryHandlers = CSaleDeliveryHandler::GetAdminList(array($by => $order));
示例9: array
}
//add logotip
$arPicture = array();
if (array_key_exists("LOGOTIP", $_FILES) && $_FILES["LOGOTIP"]["error"] == 0) {
$arPicture = $_FILES["LOGOTIP"];
}
if ($_POST["LOGOTIP_del"] == "Y") {
$arPicture["del"] = trim($_POST["LOGOTIP_del"]);
}
if (!empty($arPicture)) {
$arHandlersData["ALL"]["LOGOTIP"] = $arPicture;
}
foreach ($arHandlersData as $SITE_ID => $arHandlerData) {
$APPLICATION->ResetException();
$arHandlerData["PROFILE_USE_DEFAULT"] == "N";
CSaleDeliveryHandler::Set($SID, $arHandlerData, $SITE_ID == "ALL" ? false : $SITE_ID);
if ($ex = $APPLICATION->GetException()) {
$errorsList .= $ex->GetString() . "<br />";
}
}
//pay system for delivery
if (is_set($_POST["PAY_SYSTEM"]) && is_array($_POST["PAY_SYSTEM"])) {
foreach ($_POST["PAY_SYSTEM"] as $profileName => $arPSIds) {
CSaleDelivery2PaySystem::UpdateDelivery($SID, array("PAYSYSTEM_ID" => $arPSIds, "DELIVERY_PROFILE_ID" => $profileName));
}
}
if (strlen($errorsList) <= 0) {
if (strlen($_REQUEST["apply"]) > 0) {
LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANG . "&SID=" . urlencode($SID));
} else {
LocalRedirect('/bitrix/admin/sale_delivery_handlers.php?lang=' . LANG);
示例10: DoInstall
function DoInstall()
{
global $DOCUMENT_ROOT, $APPLICATION, $step;
$step = IntVal($step);
$module_id = $this->MODULE_ID;
if($step < 2){
$APPLICATION->IncludeAdminFile(GetMessage('INSTALL_TITLE', array("#MODULE_ID#" => $module_id)), $DOCUMENT_ROOT."/bitrix/modules/".$module_id."/install/step1.php");
}elseif ($step == 2) {
$APPLICATION->IncludeAdminFile(GetMessage('INSTALL_TITLE', array("#MODULE_ID#" => $module_id)), $DOCUMENT_ROOT."/bitrix/modules/".$module_id."/install/step2.php");
} elseif ($step == 3) {
$APPLICATION->IncludeAdminFile(GetMessage('INSTALL_TITLE', array("#MODULE_ID#" => $module_id)), $DOCUMENT_ROOT."/bitrix/modules/".$module_id."/install/step3.php");
} elseif ($step == 4) {
$this->InstallFiles();
// $this->InstallDB();
CModule::IncludeModule('sale');
$gp_delivery_logo = CFile::MakeFileArray($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/'.$module_id.'/getparcel_small.png');
CSaleDeliveryHandler::Set('goparcel', array('LOGOTIP' => $gp_delivery_logo, 'ACTIVE' => "Y"));
RegisterModule($module_id);
RegisterModuleDependences('sale', 'OnSaleComponentOrderOneStepPaySystem', $module_id, 'CGPWidgetEventHandler', 'filterDeliveryAndPaySystems');
RegisterModuleDependences('sale', 'OnOrderNewSendEmail', $module_id, 'CGPWidgetEventHandler', 'sendNewOrderDataToGP');
RegisterModuleDependences('sale', 'OnBeforeOrderUpdate', $module_id, 'CGPWidgetEventHandler', 'sendUpdatedOrderDataToGP');
RegisterModuleDependences('sale', 'OnSaleStatusOrder', $module_id, 'CGPWidgetEventHandler', 'changeStatus');
RegisterModuleDependences('sale', 'OnBeforeOrderAdd', $module_id, 'CGPWidgetEventHandler', 'checkGPErrors');
RegisterModuleDependences('sale', 'OnBeforeOrderUpdate', $module_id, 'CGPWidgetEventHandler', 'sendGPDeselectedStatus');
$GLOBALS["errors"] = $this->errors;
$APPLICATION->IncludeAdminFile(GetMessage('INSTALL_TITLE', array("#MODULE_ID#" => $module_id)), $DOCUMENT_ROOT."/bitrix/modules/".$module_id."/install/step4.php");
}
return true;
}
示例11: DoInstall
public function DoInstall()
{
if ($GLOBALS['APPLICATION']->GetGroupRight('main') < 'W') {
return;
}
if (is_array($this->NEED_MODULES) && !empty($this->NEED_MODULES)) {
foreach ($this->NEED_MODULES as $module) {
if (!IsModuleInstalled($module)) {
$this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES', array('#MODULE#' => $module, '#NEED#' => $this->NEED_MODULES)));
return;
}
include $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $module . '/install/version.php';
if (!CheckVersion($arModuleVersion['VERSION'], $this->NEED_MAIN_VERSION)) {
$this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES', array('#MODULE#' => $module, '#NEED#' => $this->NEED_MAIN_VERSION)));
return;
}
}
}
if (!function_exists('curl_init')) {
$this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_MODULES_CURL', array('#MODULE#' => 'cURL')));
return;
}
if (CheckVersion(SM_VERSION, $this->NEED_MAIN_VERSION)) {
RegisterModuleDependences('sale', 'onSaleDeliveryHandlersBuildList', self::MODULE_ID, 'DDeliveryEvents', 'Init');
RegisterModuleDependences('sale', 'OnOrderNewSendEmail', self::MODULE_ID, 'DDeliveryEvents', 'OnOrderNewSendEmail');
RegisterModuleDependences('sale', 'OnSaleBeforeStatusOrder', self::MODULE_ID, 'DDeliveryEvents', 'OnSaleBeforeStatusOrder');
if (!symlink(__DIR__ . "/components/ddelivery", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components/ddelivery")) {
CopyDirFiles(__DIR__ . "/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
}
RegisterModule(self::MODULE_ID);
CModule::IncludeModule("sale");
$ddeliveryConfig = CSaleDeliveryHandler::GetBySID('ddelivery')->Fetch();
$ddeliveryConfig['ACTIVE'] = 'N';
CSaleDeliveryHandler::Set('ddelivery', $ddeliveryConfig, false);
include_once __DIR__ . '/../include.php';
include_once __DIR__ . '/../DDeliveryEvents.php';
include_once __DIR__ . '/../DDeliveryShop.php';
// Добавляем свойства в бд
CSaleOrderProps::add(array('PERSON_TYPE_ID' => '1', 'NAME' => 'DDelivery LocalID', 'TYPE' => 'TEXT', 'REQUIED' => 'N', 'DEFAULT_VALUE' => '', 'SORT' => '10000', 'USER_PROPS' => 'N', 'IS_LOCATION' => 'N', 'PROPS_GROUP_ID' => '2', 'IS_EMAIL' => 'N', 'IS_PROFILE_NAME' => 'N', 'IS_PAYER' => 'N', 'IS_LOCATION4TAX' => 'N', 'IS_ZIP' => 'N', 'CODE' => 'DDELIVERY_ID', 'IS_FILTERED' => 'Y', 'ACTIVE' => 'Y', 'UTIL' => 'Y', 'INPUT_FIELD_LOCATION' => '0', 'MULTIPLE' => 'N'));
$IntegratorShop = new DDeliveryShop($ddeliveryConfig['CONFIG']['CONFIG'], array(), array());
$ddeliveryUI = new DDeliveryUI($IntegratorShop, true);
$ddeliveryUI->createTables();
$this->ShowForm('OK', GetMessage('MOD_INST_OK'), true);
} else {
$this->ShowForm('ERROR', $this->GetMessage('DDELIVERY_NEED_RIGHT_VER', array('#NEED#' => $this->NEED_MAIN_VERSION)));
}
}