本文整理汇总了PHP中CSaleUserAccount::UpdateAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleUserAccount::UpdateAccount方法的具体用法?PHP CSaleUserAccount::UpdateAccount怎么用?PHP CSaleUserAccount::UpdateAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleUserAccount
的用法示例。
在下文中一共展示了CSaleUserAccount::UpdateAccount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transaction
public static function transaction($sum, $user_id, $comment)
{
CModule::IncludeModule("sale");
if (!CSaleUserAccount::UpdateAccount($user_id, doubleval($sum), "RUB", $comment)) {
return false;
}
return true;
}
示例2: OnSalePayOrder
public static function OnSalePayOrder($ID, $val)
{
$ID = intval($ID);
if ($ID > 0 && $val == 'Y') {
$arOrder = array();
$dbBasketItems = CSaleBasket::GetList(array(), array('ORDER_ID' => $ID), false, false, array('ID', 'MODULE', 'CATALOG_XML_ID', 'QUANTITY'));
while ($arItems = $dbBasketItems->Fetch()) {
if ($arItems['MODULE'] == 'asd.money' && !empty($arItems['CATALOG_XML_ID']) && strpos($arItems['CATALOG_XML_ID'], '@') !== false) {
if (empty($arOrder)) {
$rsOrders = CSaleOrder::GetList(array(), array('ID' => $ID), false, false, array('ID', 'USER_ID'));
$arOrder = $rsOrders->Fetch();
if (empty($arOrder)) {
return;
}
}
list($amount, $curr) = explode('@', $arItems['CATALOG_XML_ID']);
CSaleUserAccount::UpdateAccount($arOrder['USER_ID'], doubleval($amount) * doubleval($arItems['QUANTITY']), $curr, GetMessage('ASD_MODULE_TRANSACT_PREPAID'), $ID);
}
}
}
}
示例3: CancelOrder
function CancelOrder($ID, $val, $description = "")
{
global $DB, $USER;
$ID = IntVal($ID);
$val = $val != "Y" ? "N" : "Y";
$description = Trim($description);
if ($ID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_NO_ORDER_ID1"), "NO_ORDER_ID");
return False;
}
$arOrder = CSaleOrder::GetByID($ID);
if (!$arOrder) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGO_NO_ORDER")), "NO_ORDER");
return False;
}
if ($arOrder["CANCELED"] == $val) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGO_DUB_CANCEL")), "ALREADY_FLAG");
return False;
}
foreach (GetModuleEvents("sale", "OnSaleBeforeCancelOrder", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, $val)) === false) {
return false;
}
}
if ($val == "Y") {
if ($arOrder["PAYED"] == "Y") {
if (!CSaleOrder::PayOrder($ID, "N", True, True)) {
return False;
}
} else {
$arOrder["SUM_PAID"] = DoubleVal($arOrder["SUM_PAID"]);
if ($arOrder["SUM_PAID"] > 0) {
if (!CSaleUserAccount::UpdateAccount($arOrder["USER_ID"], $arOrder["SUM_PAID"], $arOrder["CURRENCY"], "ORDER_CANCEL_PART", $ID)) {
return False;
}
}
}
if ($arOrder["ALLOW_DELIVERY"] == "Y") {
if (!CSaleOrder::DeliverOrder($ID, "N")) {
return False;
}
}
}
$arFields = array("CANCELED" => $val, "=DATE_CANCELED" => $DB->GetNowFunction(), "REASON_CANCELED" => strlen($description) > 0 ? $description : false, "EMP_CANCELED_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false);
$res = CSaleOrder::Update($ID, $arFields);
unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
//this method is used only for catalogs without reservation and deduction support
CSaleBasket::OrderCanceled($ID, $val == "Y" ? True : False);
foreach (GetModuleEvents("sale", "OnSaleCancelOrder", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $val, $description));
}
if ($val == "Y") {
CTimeZone::Disable();
$arOrder = CSaleOrder::GetByID($ID);
CTimeZone::Enable();
$userEmail = "";
$dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $ID, "PROP_IS_EMAIL" => "Y"));
if ($arOrderProp = $dbOrderProp->Fetch()) {
$userEmail = $arOrderProp["VALUE"];
}
if (strlen($userEmail) <= 0) {
$dbUser = CUser::GetByID($arOrder["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
$userEmail = $arUser["EMAIL"];
}
}
$event = new CEvent();
$arFields = array("ORDER_ID" => $ID, "ORDER_DATE" => $arOrder["DATE_INSERT_FORMAT"], "EMAIL" => $userEmail, "ORDER_CANCEL_DESCRIPTION" => $description, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]));
$eventName = "SALE_ORDER_CANCEL";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderCancelSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
if ($bSend) {
$event = new CEvent();
$event->Send($eventName, $arOrder["LID"], $arFields, "N");
}
if (CModule::IncludeModule("statistic")) {
CStatEvent::AddByEvents("eStore", "order_cancel", $ID, "", $arOrder["STAT_GID"]);
}
}
if ($val == "Y") {
if ($arOrder["DEDUCTED"] == "Y") {
$rs = CSaleOrder::DeductOrder($ID, "N");
if (!$rs) {
return false;
}
}
if ($arOrder["RESERVED"] == "Y") {
if (!CSaleOrder::ReserveOrder($ID, "N")) {
}
return false;
}
} else {
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O" && $arOrder["RESERVED"] != "Y") {
if (!CSaleOrder::ReserveOrder($ID, "Y")) {
}
return false;
//.........这里部分代码省略.........
示例4: PayUserAccountDeliveryOrderCallback
function PayUserAccountDeliveryOrderCallback($productID, $userID, $bPaid, $orderID, $quantity = 1)
{
global $DB;
$productID = IntVal($productID);
$userID = IntVal($userID);
$bPaid = $bPaid ? True : False;
$orderID = IntVal($orderID);
if ($userID <= 0) {
return False;
}
if ($orderID <= 0) {
return False;
}
if (!($arOrder = CSaleOrder::GetByID($orderID))) {
return False;
}
$baseLangCurrency = CSaleLang::GetLangCurrency($arOrder["LID"]);
$arAmount = unserialize(COption::GetOptionString("sale", "pay_amount", 'a:4:{i:1;a:2:{s:6:"AMOUNT";s:2:"10";s:8:"CURRENCY";s:3:"EUR";}i:2;a:2:{s:6:"AMOUNT";s:2:"20";s:8:"CURRENCY";s:3:"EUR";}i:3;a:2:{s:6:"AMOUNT";s:2:"30";s:8:"CURRENCY";s:3:"EUR";}i:4;a:2:{s:6:"AMOUNT";s:2:"40";s:8:"CURRENCY";s:3:"EUR";}}'));
if (!array_key_exists($productID, $arAmount)) {
return False;
}
$currentPrice = $arAmount[$productID]["AMOUNT"] * $quantity;
$currentCurrency = $arAmount[$productID]["CURRENCY"];
if ($arAmount[$productID]["CURRENCY"] != $baseLangCurrency) {
$currentPrice = CCurrencyRates::ConvertCurrency($arAmount[$productID]["AMOUNT"], $arAmount[$productID]["CURRENCY"], $baseLangCurrency) * $quantity;
$currentCurrency = $baseLangCurrency;
}
if (!CSaleUserAccount::UpdateAccount($userID, $bPaid ? $currentPrice : -$currentPrice, $currentCurrency, "MANUAL", $orderID, "Payment to user account")) {
return False;
}
return True;
}
示例5: CancelOrder
function CancelOrder($ID, $val, $description = "")
{
global $DB, $USER, $APPLICATION;
$isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
$ID = IntVal($ID);
$val = $val != "Y" ? "N" : "Y";
$description = Trim($description);
if ($ID <= 0) {
$APPLICATION->ThrowException(Loc::getMessage("SKGO_NO_ORDER_ID1"), "NO_ORDER_ID");
return false;
}
$arOrder = CSaleOrder::GetByID($ID);
if (!$arOrder) {
$APPLICATION->ThrowException(str_replace("#ID#", $ID, Loc::getMessage("SKGO_NO_ORDER")), "NO_ORDER");
return false;
}
if ($arOrder["CANCELED"] == $val) {
$APPLICATION->ThrowException(str_replace("#ID#", $ID, Loc::getMessage("SKGO_DUB_CANCEL")), "ALREADY_FLAG");
return false;
}
if ($isOrderConverted == "Y") {
$r = \Bitrix\Sale\Compatible\OrderCompatibility::cancel($ID, $val, $description);
if ($r->isSuccess(true)) {
$res = true;
} else {
$errorMessage = "";
foreach ($r->getErrorMessages() as $error) {
$errorMessage .= " " . $error;
}
$APPLICATION->ThrowException(Loc::getMessage("SKGO_CANCEL_ERROR", array("#MESSAGE#" => $errorMessage)), "CANCEL_ERROR");
return false;
}
} else {
foreach (GetModuleEvents("sale", "OnSaleBeforeCancelOrder", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, $val)) === false) {
return false;
}
}
if ($val == "Y") {
if ($arOrder["DEDUCTED"] == "Y") {
if (!CSaleOrder::DeductOrder($ID, "N")) {
return false;
}
}
if ($arOrder["RESERVED"] == "Y") {
if (!CSaleOrder::ReserveOrder($ID, "N")) {
return false;
}
}
if ($arOrder["PAYED"] == "Y") {
if (!CSaleOrder::PayOrder($ID, "N", True, True)) {
return False;
}
} else {
$arOrder["SUM_PAID"] = DoubleVal($arOrder["SUM_PAID"]);
if ($arOrder["SUM_PAID"] > 0) {
if (!CSaleUserAccount::UpdateAccount($arOrder["USER_ID"], $arOrder["SUM_PAID"], $arOrder["CURRENCY"], "ORDER_CANCEL_PART", $ID)) {
return False;
}
CSaleOrder::Update($arOrder["ID"], array("SUM_PAID" => 0));
}
}
if ($arOrder["ALLOW_DELIVERY"] == "Y") {
if (!CSaleOrder::DeliverOrder($ID, "N")) {
return False;
}
}
} else {
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O" && $arOrder["RESERVED"] != "Y") {
if (!CSaleOrder::ReserveOrder($ID, "Y")) {
return false;
}
}
}
$arFields = array("CANCELED" => $val, "=DATE_CANCELED" => $DB->GetNowFunction(), "REASON_CANCELED" => strlen($description) > 0 ? $description : false, "EMP_CANCELED_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false);
$res = CSaleOrder::Update($ID, $arFields);
}
unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
if ($isOrderConverted != "Y") {
//this method is used only for catalogs without reservation and deduction support
CSaleBasket::OrderCanceled($ID, $val == "Y" ? True : False);
foreach (GetModuleEvents("sale", "OnSaleCancelOrder", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $val, $description));
}
}
if ($val == "Y") {
CTimeZone::Disable();
$arOrder = CSaleOrder::GetByID($ID);
CTimeZone::Enable();
$userEmail = "";
$dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $ID, "PROP_IS_EMAIL" => "Y"));
if ($arOrderProp = $dbOrderProp->Fetch()) {
$userEmail = $arOrderProp["VALUE"];
}
if (strlen($userEmail) <= 0) {
$dbUser = CUser::GetByID($arOrder["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
$userEmail = $arUser["EMAIL"];
}
}
//.........这里部分代码省略.........
示例6: PayAffiliate
function PayAffiliate($affiliate, $payType, &$paySum)
{
global $DB;
$arAffiliate = CSaleAffiliate::CheckAffiliateFunc($affiliate);
if (!$arAffiliate) {
return False;
}
$db_events = GetModuleEvents("sale", "OnBeforePayAffiliate");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arAffiliate, &$payType)) === false) {
return false;
}
}
$arPayTypes = array("U", "P");
if (StrLen($payType) <= 0 || !in_array($payType, $arPayTypes)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("ACGA1_BAD_FUNC1"), "ERROR_FUNCTION_CALL");
return False;
}
$arAffiliate["PENDING_SUM"] = str_replace(",", ".", $arAffiliate["PENDING_SUM"]);
$arAffiliate["PENDING_SUM"] = DoubleVal($arAffiliate["PENDING_SUM"]);
$paySum = $arAffiliate["PENDING_SUM"];
if ($arAffiliate["PENDING_SUM"] > 0) {
if (!array_key_exists("BASE_LANG_CURRENCIES", $GLOBALS)) {
$GLOBALS["BASE_LANG_CURRENCIES"] = array();
}
if (!array_key_exists($arAffiliate["SITE_ID"], $GLOBALS["BASE_LANG_CURRENCIES"])) {
$GLOBALS["BASE_LANG_CURRENCIES"][$arAffiliate["SITE_ID"]] = CSaleLang::GetLangCurrency($arAffiliate["SITE_ID"]);
}
if ($payType == "U") {
if (!CSaleUserAccount::UpdateAccount($arAffiliate["USER_ID"], $arAffiliate["PENDING_SUM"], $GLOBALS["BASE_LANG_CURRENCIES"][$arAffiliate["SITE_ID"]], "AFFILIATE")) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$GLOBALS["APPLICATION"]->ThrowException($ex->GetString(), "ACCT_UPDATE_ERROR");
} else {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("ACGA1_ERROR_TRANSF_MONEY"), "ACCT_UPDATE_ERROR");
}
return False;
}
//$arFields = array("PENDING_SUM" => 0);
}
//else
//{
// $arFields = array("=PAID_SUM" => "PAID_SUM + PENDING_SUM", "PENDING_SUM" => 0);
//}
$arFields = array("=PAID_SUM" => "PAID_SUM + PENDING_SUM", "PENDING_SUM" => 0);
if (!CSaleAffiliate::Update($arAffiliate["ID"], $arFields)) {
if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
$GLOBALS["APPLICATION"]->ThrowException($ex->GetString() . ($payType == "U" ? GetMessage("ACGA1_TRANSF_MONEY") : ""), "AF_UPDATE_ERROR");
} else {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("ACGA1_ERROR_UPDATE_SUM") . ($payType == "U" ? GetMessage("ACGA1_TRANSF_MONEY") : ""), "AF_UPDATE_ERROR");
}
return False;
}
$arFields = array("AFFILIATE_ID" => $arAffiliate["ID"], "TRANSACT_DATE" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID))), "AMOUNT" => $arAffiliate["PENDING_SUM"], "CURRENCY" => $GLOBALS["BASE_LANG_CURRENCIES"][$arAffiliate["SITE_ID"]], "DEBIT" => "Y", "DESCRIPTION" => "AFFILIATE_IN", "EMPLOYEE_ID" => $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : False);
CSaleAffiliateTransact::Add($arFields);
if ($payType == "U") {
$arFields = array("AFFILIATE_ID" => $arAffiliate["ID"], "TRANSACT_DATE" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID))), "AMOUNT" => $arAffiliate["PENDING_SUM"], "CURRENCY" => $GLOBALS["BASE_LANG_CURRENCIES"][$arAffiliate["SITE_ID"]], "DEBIT" => "N", "DESCRIPTION" => "AFFILIATE_ACCT", "EMPLOYEE_ID" => $GLOBALS["USER"]->IsAuthorized() ? $GLOBALS["USER"]->GetID() : False);
CSaleAffiliateTransact::Add($arFields);
}
}
$ID = $arAffiliate["ID"];
$events = GetModuleEvents("sale", "OnAfterPayAffiliate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID));
}
return True;
}
示例7: GetMessage
}
if (!strlen($arResult['ERROR']) && $arResult['FROM_ACCOUNT'][$arResult['REQUEST_ACCOUNT']]['CURRENT_BUDGET'] < $arResult['MONEY_OFF']) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_NOT_ENOUGH');
}
if (!strlen($arResult['ERROR']) && !($arUser = CUser::GetByLogin($arResult['REQUEST_USER'])->Fetch()) && !($arUser = CUser::GetByID($arResult['REQUEST_USER'])->Fetch())) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_USER_NOT_FOUND');
}
if (!strlen($arResult['ERROR']) && $arUser['ID'] == $USER->GetID()) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_CANNT_YOURSELF');
}
if (!strlen($arResult['ERROR'])) {
$arResult['TO_USER'] = $arUser;
if (strlen($_REQUEST['send_money_now'])) {
$arUserCurr = CUser::GetByID($USER->GetID())->Fetch();
CSaleUserAccount::UpdateAccount($USER->GetID(), -$arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], GetMessage('SPT_TRANSACT_DESC_FROM', $arUser), 0, $arResult['~REQUEST_COMMENT']);
CSaleUserAccount::UpdateAccount($arUser['ID'], $arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT'], GetMessage('SPT_TRANSACT_DESC_TO', $arUserCurr), 0, $arResult['~REQUEST_COMMENT']);
if ($arParams['NOTIFY_USER'] == 'Y' && CModule::IncludeModule('socialnetwork')) {
$letter = GetMessage('SPT_MESS_DESC_TO', array_merge($arUserCurr, array('SUM' => SaleFormatCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT']))));
if (strlen($arResult['~REQUEST_COMMENT'])) {
$letter .= ' (' . $arResult['~REQUEST_COMMENT'] . ')';
}
CSocNetMessages::Add(array('FROM_USER_ID' => $USER->GetID(), 'TO_USER_ID' => $arUser['ID'], 'MESSAGE' => $letter, '=DATE_CREATE' => 'now()', 'MESSAGE_TYPE' => 'S', 'FROM_DELETED' => 'N', 'TO_DELETED' => 'N', 'SEND_MAIL' => 'Y'));
}
LocalRedirect($APPLICATION->GetCurPageParam('success', array('success')));
}
}
}
if (!function_exists('asd_cmp_account')) {
function asd_cmp_account($a, $b)
{
if ($a['CURRENT_BUDGET'] == $b['CURRENT_BUDGET']) {
示例8: onUserBudgetSave
/**
* @param $userId
* @return Sale\Result
*/
public static function onUserBudgetSave($userId)
{
$result = new Sale\Result();
$pool = static::getUserBudgetPool($userId);
foreach ($pool->get() as $key => $budgetDat) {
$orderId = null;
$paymentId = null;
if (isset($budgetDat['ORDER']) && $budgetDat['ORDER'] instanceof Sale\OrderBase) {
$orderId = $budgetDat['ORDER']->getId();
}
if (isset($budgetDat['PAYMENT']) && $budgetDat['PAYMENT'] instanceof Sale\Payment) {
$paymentId = $budgetDat['PAYMENT']->getId();
}
// if ($budgetDat['TYPE'] == Internals\UserBudgetPool::BUDGET_TYPE_ORDER_PAY_PART
// || $budgetDat['TYPE'] == Internals\UserBudgetPool::BUDGET_TYPE_ORDER_PAY)
// {
// if (!\CSaleUserAccount::Pay($userId, ($budgetDat['SUM'] * -1), $budgetDat['CURRENCY'], $orderId, false, $paymentId))
// {
// $result->addError( new ResultError(Loc::getMessage("SALE_PROVIDER_USER_BUDGET_".$budgetDat['TYPE']."_ERROR"), "SALE_PROVIDER_USER_BUDGET_".$budgetDat['TYPE']."_ERROR") );
// }
// }
// else
// {
if (!\CSaleUserAccount::UpdateAccount($userId, $budgetDat['SUM'], $budgetDat['CURRENCY'], $budgetDat['TYPE'], $orderId, '', $paymentId)) {
$result->addError(new Sale\ResultError(Loc::getMessage("SALE_PROVIDER_USER_BUDGET_" . $budgetDat['TYPE'] . "_ERROR"), "SALE_PROVIDER_USER_BUDGET_" . $budgetDat['TYPE'] . "_ERROR"));
}
// }
$pool->delete($key);
}
return $result;
}
示例9: foreach
}
}
foreach ($arResult['FROM'] as $curr => &$arAcc) {
if (empty($arAcc)) {
$arAcc = array('CURRENT_BUDGET' => 0.0, 'CURRENCY' => $curr, 'FULL_NAME' => $arResult['CURRENCIES'][$curr]['FULL_NAME'], 'CURRENT_BUDGET_FORMATED' => SaleFormatCurrency(0, $curr));
}
}
if (strlen($_REQUEST['exchange_money']) && check_bitrix_sessid()) {
$arResult['MONEY_OFF'] = round($arResult['REQUEST_AMOUNT'] + $arResult['REQUEST_AMOUNT'] / 100 * $arParams['COMISSION'], 2);
if ($arResult['REQUEST_AMOUNT'] <= 0 || !strlen($arResult['REQUEST_FROM']) || !strlen($arResult['REQUEST_TO'])) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_REQUIRED_FIELDS');
}
if (!strlen($arResult['ERROR']) && $arResult['REQUEST_FROM'] == $arResult['REQUEST_TO']) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_CANNT_SAME_CURR');
}
if (!strlen($arResult['ERROR']) && (!isset($arResult['FROM'][$arResult['REQUEST_FROM']]) || !isset($arResult['TO'][$arResult['REQUEST_TO']]))) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_CURR');
}
if (!strlen($arResult['ERROR']) && $arResult['FROM'][$arResult['REQUEST_FROM']]['CURRENT_BUDGET'] < $arResult['MONEY_OFF']) {
$arResult['ERROR'] = GetMessage('SPT_ERROR_NOT_ENOUGH');
}
if ($arResult['ERROR'] == '') {
CSaleUserAccount::UpdateAccount($USER->GetID(), -$arResult['MONEY_OFF'], $arResult['REQUEST_FROM'], GetMessage('SPT_TRANSACT_DESC_FROM', array('#CURR#' => $arResult['CURRENCIES'][$arResult['REQUEST_TO']]['FULL_NAME'])), 0);
CSaleUserAccount::UpdateAccount($USER->GetID(), CCurrencyRates::ConvertCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_FROM'], $arResult['REQUEST_TO']), $arResult['REQUEST_TO'], GetMessage('SPT_TRANSACT_DESC_TO', array('#CURR#' => $arResult['CURRENCIES'][$arResult['REQUEST_FROM']]['FULL_NAME'])), 0);
LocalRedirect($APPLICATION->GetCurPageParam('success', array('success')));
}
}
if ($arParams['SET_TITLE'] == 'Y') {
$APPLICATION->SetTitle(GetMessage('SPT_TITLE'));
}
$this->IncludeComponentTemplate();
示例10: array
$dbResultList = CSaleUserAccount::GetList(array($by => $order), $arFilter, false, false, array("ID"));
while ($arAccountList = $dbResultList->Fetch()) {
$arID[] = $arAccountList['ID'];
}
}
foreach ($arID as $ID) {
if (strlen($ID) <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
@set_time_limit(0);
if ($saleModulePermissions >= "W") {
$DB->StartTransaction();
if ($arDelAccount = CSaleUserAccount::GetByID($ID)) {
if (CSaleUserAccount::UpdateAccount($arDelAccount["USER_ID"], -$arDelAccount["CURRENT_BUDGET"], $arDelAccount["CURRENCY"], "DEL_ACCOUNT", 0)) {
if (!CSaleUserAccount::Delete($ID)) {
$DB->Rollback();
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SAA_ERROR_DELETE")), $ID);
}
}
} else {
$DB->Rollback();
if ($ex = $APPLICATION->GetException()) {
$lAdmin->AddGroupError($ex->GetString(), $ID);
} else {
$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SAA_ERROR_MONEY")), $ID);
}
示例11: OnSaleStatusOrderHandler
function OnSaleStatusOrderHandler($ID, $val) {
if ($val == "F") {
$order = CSaleOrder::GetByID($ID);
$user = CUser::GetByID($order['USER_ID'])->Fetch();
CSaleUserAccount::UpdateAccount($user['ID'], $order['PRICE'] * 0.03, 'RUB', 'order', $ID);
}
}
示例12: DoubleVal
}
if (strlen($errorMessage) <= 0) {
$USER_ID = $arOldUserAccount["USER_ID"];
$CURRENCY = $arOldUserAccount["CURRENCY"];
$OLD_BUDGET = DoubleVal($arOldUserAccount["CURRENT_BUDGET"]);
}
}
$currentLocked = "";
if (strlen($errorMessage) <= 0) {
$dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $USER_ID, "CURRENCY" => $CURRENCY));
$arUserAccount = $dbUserAccount->Fetch();
$currentLocked = $arUserAccount["LOCKED"];
$CURRENT_BUDGET = str_replace(",", ".", $CURRENT_BUDGET);
$CURRENT_BUDGET = DoubleVal($CURRENT_BUDGET);
$updateSum = $CURRENT_BUDGET - $OLD_BUDGET;
if (!CSaleUserAccount::UpdateAccount($USER_ID, $updateSum, $CURRENCY, "MANUAL", 0, $CHANGE_REASON)) {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . ".<br>";
} else {
$errorMessage .= GetMessage("SAE_ERROR_SAVING") . ".<br>";
}
}
}
if (strlen($errorMessage) <= 0 and $currentLocked != "") {
if ($_POST["UNLOCK"] == "Y") {
CSaleUserAccount::UnLock($USER_ID, $CURRENCY);
}
if ($_POST["UNLOCK"] == "N" or $currentLocked == "Y" and !isset($_POST["UNLOCK"])) {
CSaleUserAccount::Lock($USER_ID, $CURRENCY);
}
}
示例13: Trim
$TRANSACT_DATE = Trim($TRANSACT_DATE);
if (strlen($TRANSACT_DATE) <= 0) {
$errorMessage .= GetMessage("STE_EMPTY_DATE") . ".<br>";
}
$AMOUNT = str_replace(",", ".", $AMOUNT);
$AMOUNT = DoubleVal($AMOUNT);
if ($AMOUNT <= 0) {
$errorMessage .= GetMessage("STE_EMPTY_SUM") . ".<br>";
}
$CURRENCY = Trim($CURRENCY);
if (strlen($CURRENCY) <= 0) {
$errorMessage .= GetMessage("STE_EMPTY_CURRENCY") . ".<br>";
}
$DEBIT = $DEBIT == "Y" ? "Y" : "N";
if (strlen($errorMessage) <= 0) {
if (!CSaleUserAccount::UpdateAccount($USER_ID, $DEBIT == "Y" ? $AMOUNT : -$AMOUNT, $CURRENCY, "MANUAL", IntVal($ORDER_ID), $NOTES)) {
if ($ex = $APPLICATION->GetException()) {
$errorMessage .= $ex->GetString() . ".<br>";
} else {
$errorMessage .= GetMessage("STE_ERROR_SAVE_ACCOUNT") . ".<br>";
}
}
}
if (strlen($errorMessage) <= 0) {
LocalRedirect("/bitrix/admin/sale_transact_admin.php?lang=" . LANG . GetFilterParams("filter_", false));
} else {
$bVarsFromForm = true;
}
}
if ($bVarsFromForm) {
$DB->InitTableVarsForEdit("b_sale_user_transact", "", "str_");