本文整理匯總了PHP中CSaleBasket::OrderDeduction方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleBasket::OrderDeduction方法的具體用法?PHP CSaleBasket::OrderDeduction怎麽用?PHP CSaleBasket::OrderDeduction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::OrderDeduction方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DeductOrder
function DeductOrder($ID, $val, $description = "", $bAutoDeduction = true, $arStoreBarcodeOrderFormData = array(), $recurringID = 0)
{
global $DB, $USER;
$ID = IntVal($ID);
$val = $val != "Y" ? "N" : "Y";
$description = Trim($description);
$recurringID = IntVal($recurringID);
if ($ID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_NO_ORDER_ID"), "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["DEDUCTED"] == $val) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGO_DUB_DEDUCTION")), "ALREADY_FLAG");
return false;
}
foreach (GetModuleEvents("sale", "OnSaleBeforeDeductOrder", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, $val, $description, $bAutoDeduction, $arStoreBarcodeOrderFormData, $recurringID)) === false) {
return false;
}
}
unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
if ($recurringID <= 0) {
if (IntVal($arOrder["RECURRING_ID"]) > 0) {
$recurringID = IntVal($arOrder["RECURRING_ID"]);
}
}
$arDeductResult = CSaleBasket::OrderDeduction($ID, $val == "N" ? true : false, $recurringID, $bAutoDeduction, $arStoreBarcodeOrderFormData);
if (array_key_exists("ERROR", $arDeductResult)) {
CSaleOrder::SetMark($ID, GetMessage("SKGB_DEDUCT_ERROR", array("#MESSAGE#" => $arDeductResult["ERROR"]["MESSAGE"])));
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGB_DEDUCT_ERROR", array("#MESSAGE#" => $arDeductResult["ERROR"]["MESSAGE"])), "DEDUCTION_ERROR");
return false;
} else {
CSaleOrder::UnsetMark($ID);
}
if ($arDeductResult["RESULT"]) {
if ($val == "Y") {
$arFields = array("DEDUCTED" => "Y", "EMP_DEDUCTED_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false, "=DATE_DEDUCTED" => $DB->GetNowFunction());
} else {
$arFields = array("DEDUCTED" => "N", "EMP_DEDUCTED_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false, "=DATE_DEDUCTED" => $DB->GetNowFunction());
if (strlen($description) > 0) {
$arFields["REASON_UNDO_DEDUCTED"] = $description;
}
}
$res = CSaleOrder::Update($ID, $arFields);
} else {
$res = false;
}
foreach (GetModuleEvents("sale", "OnSaleDeductOrder", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $val));
}
if ($res) {
return $res;
} else {
return false;
}
}