本文整理汇总了PHP中CSaleOrderUserProps::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderUserProps::Update方法的具体用法?PHP CSaleOrderUserProps::Update怎么用?PHP CSaleOrderUserProps::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderUserProps
的用法示例。
在下文中一共展示了CSaleOrderUserProps::Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoSaveUserProfile
static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
{
$profileId = intval($profileId);
$arIDs = array();
if ($profileId > 0) {
$dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
$arProfile = $dbProfile->Fetch();
if (!$arProfile) {
$arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
return false;
}
if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
return false;
}
//if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
if (strlen($profileName) > 0) {
$arFields = array("NAME" => $profileName, "USER_ID" => $userId);
CSaleOrderUserProps::Update($profileId, $arFields);
}
$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
$arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
}
}
if (!is_array($orderProps)) {
$dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
$orderProps = array();
while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
$orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
}
}
$dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
$curVal = $orderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if (strlen($curVal) > 0) {
if ($profileId <= 0) {
if (strlen($profileName) <= 0) {
$profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
}
$arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
$profileId = CSaleOrderUserProps::Add($arFields);
}
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
$arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
$arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderUserPropsValue::Delete($id);
}
}
示例2: GetMessage
}
elseif ($arOrderProps["TYPE"] == "MULTISELECT")
{
if (!is_array($curVal) || count($curVal) <= 0)
$bErrorField = true;
}
}
if ($bErrorField)
$errorMessage .= GetMessage("SALE_NO_FIELD")." \"".$arOrderProps["NAME"]."\".<br />";
}
}
if (strlen($errorMessage) <= 0)
{
$arFields = array("NAME" => $NAME);
if (!CSaleOrderUserProps::Update($ID, $arFields))
$errorMessage .= GetMessage("SALE_ERROR_EDIT_PROF")."<br />";
}
if (strlen($errorMessage) <= 0)
{
CSaleOrderUserPropsValue::DeleteAll($ID);
$dbOrderProps = CSaleOrderProps::GetList(
array("SORT" => "ASC", "NAME" => "ASC"),
array(
"PERSON_TYPE_ID" => $arUserProps["PERSON_TYPE_ID"],
"USER_PROPS" => "Y", "ACTIVE" => "Y", "UTIL" => "N"
),
false,
false,
示例3: Update
static function Update($profileID, $arFields) {
global $DB;
$result = new WS_SaleUserProfilesErrorsContainer();
if (empty($profileID)) {
return $result->addErrorString(GetMessage("ws.saleuserprofiles_save_error_required_id"));
}
$DB->StartTransaction();
if (!empty($arFields["PROPS"])) {
$props = $arFields["PROPS"];
unset($arFields["PROPS"]);
}
// сохраняем поля
if (!empty($arFields)) {
if(!$profileID = CSaleOrderUserProps::Update($profileID, $arFields)){
$result->addErrorString(GetMessage("ws.saleuserprofiles_save_error_save_fields"));
} else {
$arFields = CSaleOrderUserProps::GetByID($profileID);
}
}
// сохраняем свойства
if (!empty($props) && !$result->getErrorsAsString()) {
// удаляем все свойства
CSaleOrderUserPropsValue::DeleteAll($profileID);
$res = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $arFields["PERSON_TYPE_ID"], "USER_PROPS" => "Y"), false, false, array());
while ($arRes = $res->Fetch()) {
if ($arRes['REQUIED'] === 'Y' && empty($props[$arRes['ID']])) {
$result->addErrorString(GetMessage("ws.saleuserprofiles_save_error_required_field") . "\"" . $arRes["NAME"] . "\"");
continue;
}
$arValueTemp = $props[$arRes['ID']];
if (is_array($arValueTemp)) {
$arValueTemp = "";
for ($i = 0; $i < count($props[$arRes['ID']]); $i++) {
if ($i > 0) {
$arValueTemp .= ",";
}
$arValueTemp .= $props[$arRes['ID']][$i];
}
}
$arProp = array(
"VALUE" => $arValueTemp,
"NAME" => $arRes["NAME"],
"ORDER_PROPS_ID" => $arRes['ID'],
"USER_PROPS_ID" => $profileID
);
CSaleOrderUserPropsValue::Add($arProp);
}
}
if ($result->getErrorsAsString()) {
$DB->Rollback();
} else {
$DB->Commit();
}
return $result;
}
示例4: nodeHandler
function nodeHandler(CDataXML $value)
{
$value = $value->GetArray();
if(!empty($value[GetMessage("CC_BSC1_DOCUMENT")]))
{
$value = $value[GetMessage("CC_BSC1_DOCUMENT")];
$arOrder = $this->collectOrderInfo($value);
if(!empty($arOrder))
{
if(strlen($arOrder["ID"]) <= 0 && strlen($arOrder["ID_1C"]) > 0)//try to search order from 1C
{
$dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID_1C" => $arOrder["ID_1C"]), false, false, array("ID", "ID_1C"));
if($orderInfo = $dbOrder->Fetch())
{
$arOrder["ID"] = $orderInfo["ID"];
}
}
if(strlen($arOrder["ID"]) > 0) // exists site order
{
$dbOrder = CSaleOrder::GetList(array(), array("ACCOUNT_NUMBER" => $arOrder["ID"]), false, false, array("ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "CANCELED", "DATE_CANCELED", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION", "ADDITIONAL_INFO", "COMMENTS", "TAX_VALUE", "DELIVERY_DOC_NUM", "DELIVERY_DOC_DATE", "STORE_ID", "ACCOUNT_NUMBER", "VERSION", "VERSION_1C", "ID_1C"));
if($orderInfo = $dbOrder->Fetch())
{
if($arOrder["VERSION_1C"] != $orderInfo["VERSION_1C"] || (strlen($orderInfo["VERSION_1C"]) <= 0 || strlen($arOrder["VERSION_1C"]) <= 0)) // skip update if the same version
{
$arOrderFields = array();
$orderId = $orderInfo["ID"];
CSaleOrderChange::AddRecord($orderId, "ORDER_1C_IMPORT");
if($arOrder["ID_1C"] != $orderInfo["ID_1C"])
$arOrderFields["ID_1C"] = $arOrder["ID_1C"];
$arOrderFields["VERSION_1C"] = $arOrder["VERSION_1C"];
if($orderInfo["PAYED"] != "Y" && $orderInfo["ALLOW_DELIVERY"] != "Y" && $orderInfo["STATUS_ID"] != "F")
{
$dbOrderTax = CSaleOrderTax::GetList(
array(),
array("ORDER_ID" => $orderId),
false,
false,
array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
);
$bTaxFound = false;
if($arOrderTax = $dbOrderTax->Fetch())
{
$bTaxFound = true;
if(IntVal($arOrderTax["VALUE_MONEY"]) != IntVal($arOrder["TAX"]["VALUE_MONEY"]) || IntVal($arOrderTax["VALUE"]) != IntVal($arOrder["TAX"]["VALUE"]) || ($arOrderTax["IS_IN_PRICE"] != $arOrder["TAX"]["IS_IN_PRICE"]))
{
if(IntVal($arOrder["TAX"]["VALUE"])>0)
{
$arFields = Array(
"TAX_NAME" => $arOrder["TAX"]["NAME"],
"ORDER_ID" => $orderId,
"VALUE" => $arOrder["TAX"]["VALUE"],
"IS_PERCENT" => "Y",
"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"],
"CODE" => "VAT1C",
"APPLY_ORDER" => "100"
);
CSaleOrderTax::Update($arOrderTax["ID"], $arFields);
$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
}
else
{
CSaleOrderTax::Delete($arOrderTax["ID"]);
$arOrderFields["TAX_VALUE"] = 0;
}
}
}
if(!$bTaxFound)
{
if(IntVal($arOrder["TAX"]["VALUE"])>0)
{
$arFields = Array(
"TAX_NAME" => $arOrder["TAX"]["NAME"],
"ORDER_ID" => $orderId,
"VALUE" => $arOrder["TAX"]["VALUE"],
"IS_PERCENT" => "Y",
"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"]
);
CSaleOrderTax::Add($arFields);
$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
}
}
$arShoppingCart = array();
$bNeedUpdate = false;
$dbBasket = CSaleBasket::GetList(
array("NAME" => "ASC"),
array("ORDER_ID" => $orderId),
false,
false,
array(
"ID",
"QUANTITY",
"CANCEL_CALLBACK_FUNC",
//.........这里部分代码省略.........
示例5: DoSaveUserProfile
static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
{
$profileId = intval($profileId);
$arIDs = array();
if ($profileId > 0) {
$dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
$arProfile = $dbProfile->Fetch();
if (!$arProfile) {
$arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
return false;
}
if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
return false;
}
//if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
if (strlen($profileName) > 0) {
$arFields = array("NAME" => $profileName, "USER_ID" => $userId);
CSaleOrderUserProps::Update($profileId, $arFields);
}
$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
$arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
}
}
if (!is_array($orderProps)) {
$dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
$orderProps = array();
while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
$orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
}
}
/*
TRANSLATION_CUT_OFF
else
{
// map location ID to CODE, if taken from parameters
static::TranslateLocationPropertyValues($personTypeId, $orderProps);
}
*/
$utilPropertyList = array();
$dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE", "UTIL"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
if ($arOrderProperty['UTIL'] == "Y") {
$utilPropertyList[] = $arIDs[$arOrderProperty["ID"]];
continue;
}
$curVal = $orderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if ($arOrderProperty["TYPE"] == "FILE" && is_array($curVal)) {
$fileList = array();
foreach ($curVal as $fileDat) {
$fileList[] = $fileDat['ID'];
}
$curVal = serialize($fileList);
}
if (strlen($curVal) > 0) {
if ($profileId <= 0) {
if (strlen($profileName) <= 0) {
$profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
}
$arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
$profileId = CSaleOrderUserProps::Add($arFields);
}
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
$arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
$arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
if (!empty($utilPropertyList) && in_array($id, $utilPropertyList)) {
continue;
}
CSaleOrderUserPropsValue::Delete($id);
}
}
示例6: trim
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
CModule::IncludeModule("sale");
if ($_REQUEST["action"] == "delete" && intval($_REQUEST["id"]) > 0) {
CSaleOrderUserProps::Delete(intval($_REQUEST["id"]));
}
if ($_REQUEST["action"] == "update" && intval($_REQUEST["id"]) > 0) {
$profileName = trim($_REQUEST["f_name"] . " " . $_REQUEST["name"] . " " . $_REQUEST["last_name"]);
$arFields = array("NAME" => $profileName);
CSaleOrderUserProps::Update($_REQUEST["id"], $arFields);
if (!empty($_REQUEST["name"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["name_id"], array("VALUE" => $_REQUEST["name"]));
}
if (!empty($_REQUEST["f_name"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["f_name_id"], array("VALUE" => $_REQUEST["f_name"]));
}
if (!empty($_REQUEST["last_name"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["last_name_id"], array("VALUE" => $_REQUEST["last_name"]));
}
if (!empty($_REQUEST["email"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["email_id"], array("VALUE" => $_REQUEST["email"]));
}
if (!empty($_REQUEST["phone"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["phone_id"], array("VALUE" => $_REQUEST["phone"]));
}
if (!empty($_REQUEST["phone"])) {
CSaleOrderUserPropsValue::Update($_REQUEST["phone_id"], array("VALUE" => $_REQUEST["phone"]));
}