当前位置: 首页>>代码示例>>PHP>>正文


PHP CSaleOrder::DeductOrder方法代码示例

本文整理汇总了PHP中CSaleOrder::DeductOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::DeductOrder方法的具体用法?PHP CSaleOrder::DeductOrder怎么用?PHP CSaleOrder::DeductOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSaleOrder的用法示例。


在下文中一共展示了CSaleOrder::DeductOrder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetMessage

									if ($arBasketRecord["STORES"] == $arStoreRecord)
									{
										$arNewStoreBarcodeOrderFormData[$arBasketRecord["ID"]] = $arStoreRecord;
										break;
									}
								}
							}
							else
							{
								$arNewStoreBarcodeOrderFormData[$key] = $arStoreRecord;
							}
						}

						if ($errorMessageTmp == "")
						{
							if (!CSaleOrder::DeductOrder($ID, $DEDUCTED, $REASON_UNDO_DEDUCTED, false, $arNewStoreBarcodeOrderFormData))
							{
								if ($ex = $APPLICATION->GetException())
								{
									if ($ex->GetID() != "ALREADY_FLAG")
										$errorMessageTmp .= $ex->GetString();
								}
								else
									$errorMessageTmp .= GetMessage("ERROR_DEDUCT_ORDER").". ";
							}
						}

						if ($errorMessageTmp != "")
							$arErrors[] = $errorMessageTmp;
					}
					else
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:order_new.php

示例2: 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;
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:order.php

示例3: GetMessage

			$errorMessageTmp .= GetMessage("SOD_NO_PERMS2UNDO_DEDUCT").". ";

		if (strlen($errorMessageTmp) <= 0)
		{
			$UNDO_DEDUCT = (trim($_REQUEST["UNDO_DEDUCT"]) == "Y") ? "N" : "Y"; //reversed logic here
			$REASON_UNDO_DEDUCTED = trim($_REQUEST["REASON_UNDO_DEDUCTED"]);
			if ($UNDO_DEDUCT != "Y")
				$UNDO_DEDUCT = "N";

			if ($UNDO_DEDUCT != "Y" && $UNDO_DEDUCT != "N")
				$errorMessageTmp .= GetMessage("SOD_WRONG_DEDUCT_FLAG").". ";
		}

		if (strlen($errorMessageTmp) <= 0 && !CSaleOrder::IsLocked($ID, $lockedBY, $dateLock))
		{
			if (!CSaleOrder::DeductOrder($ID, $UNDO_DEDUCT, $REASON_UNDO_DEDUCTED, false))
			{
				if ($ex = $APPLICATION->GetException())
				{
					if ($ex->GetID() == "RESERVATION_ERROR")
					{
						$errorMessageReserve = $ex->GetString();
					}
					else if ($ex->GetID() != "ALREADY_FLAG")
					{
						$errorMessageTmp .= $ex->GetString();
					}
				}
				else
					$errorMessageTmp .= GetMessage("ERROR_UNDO_DEDUCT_ORDER").". ";
			}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:order_detail.php

示例4: 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"];
             }
         }
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:order.php

示例5: mapYandexStatusToOrder

 protected function mapYandexStatusToOrder($order, $yandexStatus, $cancelReason = "")
 {
     global $APPLICATION;
     if (!is_array($order) || !isset($order["ID"]) || strlen($yandexStatus) <= 0) {
         return false;
     }
     $settings = $this->getSettingsBySiteId($order["LID"]);
     if (!isset($settings["STATUS_IN"][$yandexStatus]) || strlen($settings["STATUS_IN"][$yandexStatus]) <= 0) {
         return false;
     }
     $result = false;
     $bitrixStatus = $settings["STATUS_IN"][$yandexStatus];
     switch ($bitrixStatus) {
         /* flags */
         case "CANCELED":
             $errorMessageTmp = "";
             $result = CSaleOrder::CancelOrder($order["ID"], "Y", $cancelReason);
             if (!$result) {
                 if ($ex = $APPLICATION->GetException()) {
                     if ($ex->GetID() != "ALREADY_FLAG") {
                         $errorMessageTmp .= $ex->GetString();
                     }
                 } else {
                     $errorMessageTmp .= GetMessage("ERROR_CANCEL_ORDER") . ". ";
                 }
             }
             if ($errorMessageTmp != "") {
                 $this->log(self::LOG_LEVEL_ERROR, "YMARKET_INCOMING_ORDER_STATUS", $order["XML_ID"], $errorMessageTmp);
             } else {
                 $this->log(self::LOG_LEVEL_INFO, "YMARKET_INCOMING_ORDER_STATUS", $order["XML_ID"], GetMessage("SALE_YMH_INCOMING_ORDER_STATUS_CANCELED") . ": " . $order["ID"]);
             }
             break;
         case "ALLOW_DELIVERY":
             $result = CSaleOrder::DeliverOrder($order["ID"], "Y");
             break;
         case "PAYED":
             $result = CSaleOrder::PayOrder($order["ID"], "Y");
             break;
         case "DEDUCTED":
             $result = CSaleOrder::DeductOrder($order["ID"], "Y");
             break;
             /* statuses */
         /* statuses */
         default:
             if (CSaleStatus::GetByID($bitrixStatus)) {
                 $result = CSaleOrder::StatusOrder($order["ID"], $bitrixStatus);
             }
             break;
     }
     $this->log($result ? self::LOG_LEVEL_INFO : self::LOG_LEVEL_ERROR, "YMARKET_ORDER_STATUS_CHANGE", $order["ID"], ($result ? GetMessage("SALE_YMH_LOG_TYPE_ORDER_STATUS_CHANGE_OK") : GetMessage("SALE_YMH_LOG_TYPE_ORDER_STATUS_CHANGE_ERROR")) . " (" . $bitrixStatus . ")");
     return $result;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:52,代码来源:ym_handler.php

示例6: GetMessage

                        $arResult["ERROR"] = $ex->GetString();
                        break;
                    }
                }
                //check if barcodes are valid for deduction
                if (!CSaleOrderHelper::checkBarcodes($arProducts)) {
                    if ($ex = $APPLICATION->GetException()) {
                        $arResult["ERROR"] = $ex->GetString();
                        break;
                    }
                }
            }
            if (strlen($undoReason) > 0) {
                $undoReason = $APPLICATION->ConvertCharset($undoReason, 'utf-8', SITE_CHARSET);
            }
            if (!CSaleOrder::DeductOrder($orderId, $deducted, $undoReason, false, $arStoreInfo)) {
                if ($ex = $APPLICATION->GetException()) {
                    if ($ex->GetID() != "ALREADY_FLAG") {
                        $arResult["ERROR"] = $ex->GetString();
                    }
                } else {
                    $arResult["ERROR"] = GetMessage("SMODE_ERROR_DEDUCT_ORDER");
                }
            }
            break;
    }
} else {
    $arResult["ERROR"] = "Access denied!";
}
if (isset($arResult["ERROR"])) {
    $arResult["RESULT"] = "ERROR";
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:ajax.php

示例7: NextPayment


//.........这里部分代码省略.........
						if (ExecuteModuleEventEx($arEvent, Array($newOrderID, &$eventName, &$arFields))===false)
							$bSend = false;
					}

					if($bSend)
					{
						$event = new CEvent;
						$event->Send($eventName, $arOrder["LID"], $arFields, "N");
					}
				}

				if ($bSuccess)
					$DB->Commit();
				else
					$DB->Rollback();
			}
		}
		else
		{
			$totalOrderPrice = $arOrder["PRICE"];
			$baseSiteCurrency = $arOrder["CURRENCY"];
		}

		$res = False;
		if ($bSuccess)
		{
			$res = CSaleUserAccount::Pay($arOrder["USER_ID"], $totalOrderPrice, $baseSiteCurrency, $newOrderID, True);
			if ($res)
			{
				if ($arProduct["WITHOUT_ORDER"] == "N")
				{
					CSaleOrder::PayOrder($newOrderID, "Y", False, False, $arRecur["ID"]);
					CSaleOrder::DeliverOrder($newOrderID, "Y", $arRecur["ID"]);
					CSaleOrder::DeductOrder($newOrderID, "Y", "", true, array(), $arRecur["ID"]);
				}
				else
				{
					/** @var $productProvider IBXSaleProductProvider */
					if ($productProvider = CSaleBasket::GetProductProvider($arProduct))
					{
						$r = $productProvider::DeliverProduct(array(
							"PRODUCT_ID" => $arProduct["PRODUCT_ID"],
							"USER_ID"    => $arOrder["USER_ID"],
							"PAID"       => true
						));
					}
					else
					{
						$r = CSaleBasket::ExecuteCallbackFunction(
							$arProduct["PAY_CALLBACK_FUNC"],
							$arRecur["MODULE"],
							$arProduct["PRODUCT_ID"],
							$arOrder["USER_ID"],
							true
						);
					}
				}

				$arFields = array(
					"ORDER_ID" => $newOrderID,
					"PRODUCT_NAME" => $arProduct["PRODUCT_NAME"],
					"PRODUCT_URL" => $arProduct["PRODUCT_URL"],
					"PRICE_TYPE" => $arProduct["PRICE_TYPE"],
					"RECUR_SCHEME_TYPE" => $arProduct["RECUR_SCHEME_TYPE"],
					"RECUR_SCHEME_LENGTH" => $arProduct["RECUR_SCHEME_LENGTH"],
					"WITHOUT_ORDER" => $arProduct["WITHOUT_ORDER"],
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:recurring.php


注:本文中的CSaleOrder::DeductOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。