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


PHP CSaleOrder::CancelOrder方法代码示例

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


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

示例1: nodeHandler


//.........这里部分代码省略.........
                     $arFields = array();
                     if (!empty($v["items"][$arBasket["PRODUCT_XML_ID"]])) {
                         if ($arBasket["QUANTITY"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"]) {
                             $arFields["QUANTITY"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"];
                         }
                         if ($arBasket["PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"]) {
                             $arFields["PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"];
                         }
                         if ($arBasket["VAT_RATE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"]) {
                             $arFields["VAT_RATE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"];
                         }
                         if ($arBasket["DISCOUNT_PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"]) {
                             $arFields["DISCOUNT_PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"];
                         }
                         if (count($arFields) > 0) {
                             CSaleBasket::Update($arBasket["ID"], $arFields);
                         }
                         $v["items"][$arBasket["PRODUCT_XML_ID"]]["CHECKED"] = "Y";
                     } else {
                         CSaleBasket::Delete($arBasket["ID"]);
                     }
                 }
                 foreach ($v["items"] as $itemID => $arItem) {
                     if ($arItem["CHECKED"] != "Y") {
                         if ($arItem["TYPE"] == GetMessage("CC_BSC1_ITEM")) {
                             CModule::IncludeModule("iblock");
                             $dbIBlockElement = CIBlockElement::GetList(array(), array("XML_ID" => $itemID, "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"), false, false, array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL"));
                             if ($arIBlockElement = $dbIBlockElement->GetNext()) {
                                 $dbIBlock = CIBlock::GetList(array(), array("ID" => $arIBlockElement["IBLOCK_ID"]));
                                 if ($arIBlock = $dbIBlock->Fetch()) {
                                     $arProps[] = array("NAME" => "Catalog XML_ID", "CODE" => "CATALOG.XML_ID", "VALUE" => $arIBlock["XML_ID"]);
                                 }
                                 $arProps[] = array("NAME" => "Product XML_ID", "CODE" => "PRODUCT.XML_ID", "VALUE" => $arIBlockElement["XML_ID"]);
                                 $arProduct = CCatalogProduct::GetByID($arIBlockElement["ID"]);
                                 $arFields = array("ORDER_ID" => $orderId, "PRODUCT_ID" => $arIBlockElement["ID"], "PRICE" => $arItem["PRICE"], "CURRENCY" => $orderInfo["CURRENCY"], "WEIGHT" => $arProduct["WEIGHT"], "QUANTITY" => $arItem["QUANTITY"], "LID" => $orderInfo["LID"], "DELAY" => "N", "CAN_BUY" => "Y", "NAME" => $arIBlockElement["~NAME"], "CALLBACK_FUNC" => "CatalogBasketCallback", "MODULE" => "catalog", "NOTES" => $arProduct["CATALOG_GROUP_NAME"], "ORDER_CALLBACK_FUNC" => "CatalogBasketOrderCallback", "CANCEL_CALLBACK_FUNC" => "CatalogBasketCancelCallback", "PAY_CALLBACK_FUNC" => "CatalogPayOrderCallback", "DETAIL_PAGE_URL" => $arIBlockElement["DETAIL_PAGE_URL"], "CATALOG_XML_ID" => $arIBlock["XML_ID"], "PRODUCT_XML_ID" => $arIBlockElement["XML_ID"], "IGNORE_CALLBACK_FUNC" => "Y", "VAT_RATE" => $arItem["VAT_RATE"]);
                                 CSaleBasket::Add($arFields);
                             } else {
                                 $this->strError .= "\n" . GetMessage("CC_BSC1_PRODUCT_NOT_FOUND") . $orderId . " - [" . $itemID . "] " . $arItem["NAME"];
                             }
                         } elseif ($arItem["TYPE"] == GetMessage("CC_BSC1_SERVICE")) {
                             if (IntVal($arItem["PRICE"]) != IntVal($orderInfo["PRICE_DELIVERY"])) {
                                 CSaleOrder::Update($orderId, array("PRICE_DELIVERY" => $arItem["PRICE"]));
                             }
                         }
                     }
                 }
                 $arOrderFields = array();
                 if ($v["AMOUNT"] != $orderInfo["PRICE"]) {
                     $arOrderFields = array("PRICE" => $v["AMOUNT"]);
                 }
                 if (DoubleVal($orderInfo["DISCOUNT_VALUE"]) > 0) {
                     $arOrderFields["DISCOUNT_VALUE"] = 0;
                 }
                 $arOrderFields["UPDATED_1C"] = "Y";
                 if (!empty($arOrderFields)) {
                     CSaleOrder::Update($orderId, $arOrderFields);
                 }
             } else {
                 $this->strError .= "\n" . GetMessage("CC_BSC1_FINAL_NOT_EDIT", array("#ID#" => $orderId));
             }
             $arAditFields = array();
             if ($v["TRAITS"][GetMessage("CC_BSC1_CANCELED")] == "true") {
                 if ($orderInfo["CANCELED"] == "N") {
                     CSaleOrder::CancelOrder($orderId, "Y", $v["COMMENT"]);
                 }
                 $arAditFields["UPDATED_1C"] = "Y";
             } else {
                 if ($orderInfo["CANCELED"] == "Y") {
                     CSaleOrder::CancelOrder($orderId, "N", $v["COMMENT"]);
                 }
                 $arAditFields["UPDATED_1C"] = "Y";
                 if (strlen($v["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")]) > 1) {
                     if ($orderInfo["PAYED"] == "N") {
                         CSaleOrder::PayOrder($orderId, "Y");
                     }
                     $arAditFields["PAY_VOUCHER_DATE"] = CDatabase::FormatDate(str_replace("T", " ", $v["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")]), "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL", LANG));
                     if (strlen($v["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_NUM")]) > 0) {
                         $arAditFields["PAY_VOUCHER_NUM"] = $v["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_NUM")];
                     }
                     $arAditFields["UPDATED_1C"] = "Y";
                 }
                 if (strlen($v["TRAITS"][GetMessage("CC_BSC1_1C_DELIVERY_DATE")]) > 1) {
                     if ($orderInfo["ALLOW_DELIVERY"] == "N") {
                         CSaleOrder::DeliverOrder($orderId, "Y");
                     }
                     $arAditFields["DATE_ALLOW_DELIVERY"] = CDatabase::FormatDate(str_replace("T", " ", $v["TRAITS"][GetMessage("CC_BSC1_1C_DELIVERY_DATE")]), "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL", LANG));
                     if (strlen($arParams["FINAL_STATUS_ON_DELIVERY"]) > 0 && $orderInfo["STATUS_ID"] != "F" && $orderInfo["STATUS_ID"] != $arParams["FINAL_STATUS_ON_DELIVERY"]) {
                         CSaleOrder::StatusOrder($orderId, $arParams["FINAL_STATUS_ON_DELIVERY"]);
                     }
                     $arAditFields["UPDATED_1C"] = "Y";
                 }
             }
             if (count($arAditFields) > 0) {
                 CSaleOrder::Update($orderId, $arAditFields);
             }
         } else {
             $this->strError .= "\n" . GetMessage("CC_BSC1_ORDER_NOT_FOUND", array("#ID#" => $orderId));
         }
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:component.php

示例2: GetMessage

					if ($CANCELED != "Y")
						$CANCELED = "N";

					if ($arOldOrder["CANCELED"] != $CANCELED)
					{
						$bUserCanCancelOrder = CSaleOrder::CanUserCancelOrder($ID, $arUserGroups, $intUserID);

						$errorMessageTmp = "";

						if (!$bUserCanCancelOrder)
						{
							$errorMessageTmp .= GetMessage("SOD_NO_PERMS2CANCEL").". ";
						}
						else
						{
							if (!CSaleOrder::CancelOrder($ID, $CANCELED, $REASON_CANCELED))
							{
								if ($ex = $APPLICATION->GetException())
								{
									if ($ex->GetID() != "ALREADY_FLAG")
										$errorMessageTmp .= $ex->GetString();
								}
								else
									$errorMessageTmp .= GetMessage("ERROR_CANCEL_ORDER").". ";
							}
						}

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

示例3: IntVal

$ID = IntVal($arParams["ID"]);
$arParams["PATH_TO_LIST"] = Trim($arParams["PATH_TO_LIST"]);
if (strlen($arParams["PATH_TO_LIST"]) <= 0) {
    $arParams["PATH_TO_LIST"] = htmlspecialcharsbx($APPLICATION->GetCurPage());
}
$arParams["PATH_TO_DETAIL"] = Trim($arParams["PATH_TO_DETAIL"]);
if (strlen($arParams["PATH_TO_DETAIL"]) <= 0) {
    $arParams["PATH_TO_DETAIL"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . "ID=#ID#");
}
if ($arParams["SET_TITLE"] == 'Y') {
    $APPLICATION->SetTitle(str_replace("#ID#", $ID, GetMessage("SPOC_TITLE")));
}
if ($ID > 0 && $_REQUEST["CANCEL"] == "Y" && $_SERVER["REQUEST_METHOD"] == "POST" && strlen($_REQUEST["action"]) > 0 && check_bitrix_sessid()) {
    $dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID" => $ID, "USER_ID" => IntVal($USER->GetID())), false, false, array("ID"));
    if ($arOrder = $dbOrder->Fetch()) {
        CSaleOrder::CancelOrder($arOrder["ID"], "Y", $_REQUEST["REASON_CANCELED"]);
        LocalRedirect($arParams["PATH_TO_LIST"]);
    }
}
if ($ID <= 0 && $arParams["PATH_TO_LIST"] != htmlspecialcharsbx($APPLICATION->GetCurPage())) {
    LocalRedirect($arParams["PATH_TO_LIST"]);
}
$dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID" => $ID, "USER_ID" => IntVal($USER->GetID())), false, false, array("ID", "CANCELED", "STATUS_ID", "PAYED"));
if ($arOrder = $dbOrder->GetNext()) {
    if ($arOrder["CANCELED"] != "Y" && $arOrder["STATUS_ID"] != "F" && $arOrder["PAYED"] != "Y") {
        $arResult = array("ID" => $ID, "URL_TO_DETAIL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_DETAIL"], array("ID" => $arOrder["ID"])), "URL_TO_LIST" => $arParams["PATH_TO_LIST"]);
    } else {
        $arResult["ERROR_MESSAGE"] = GetMessage("SPOC_CANCEL_ORDER");
    }
} else {
    $arResult["ERROR_MESSAGE"] = str_replace("#ID#", $ID, GetMessage("SPOC_NO_ORDER"));
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例4: testBronClass

function testBronClass(){
    if(
        (CModule::IncludeModule("iblock"))
        &&
        (CModule::IncludeModule("catalog"))
        &&
        (CModule::IncludeModule("sale"))
    )
        $_SESSION['bron']="бронь начал работать";
    $arFilter = Array(
        "CANCELED"=>"N",
        "STATUS_ID"=>"B"
    );


    $order_id=array();
    $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
    while ($ar_sales = $db_sales->Fetch())
    {

        $order_id[]=$ar_sales['ID'];
    }
    $id_products=array();
    if($order_id){
        $dbBasketItems = CSaleBasket::GetList(
            array(
                "NAME" => "ASC",
                "ID" => "ASC"
            ),
            array(
                "LID" => SITE_ID,
                "ORDER_ID" => $order_id
            ),
            false,
            false,
            array("PRODUCT_ID","ORDER_ID")
        );

        while ($arItems = $dbBasketItems->Fetch())
        {
            $id_products[$arItems['ORDER_ID']]=$arItems['PRODUCT_ID'];

        }
    }
    if($id_products){
        $date_comparing = date('d.m.Y',time() + 48 * 60 * 60);
        //echo $date_comparing;
        $stmp_comparing = MakeTimeStamp($date_comparing, "DD.MM.YYYY HH:MI:SS");
        $arSelect = Array("ID", "IBLOCK_ID", "NAME", "PROPERTY_DEPARTURE");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше
        $arFilter = Array("ID"=>$id_products);
        $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
        while($ob = $res->GetNext()){
            $stmp_tickets = MakeTimeStamp($ob['PROPERTY_DEPARTURE_VALUE'], "DD.MM.YYYY HH:MI:SS");
            if($stmp_comparing>=$stmp_tickets){
                foreach($id_products as $key_id_order=>$item_id_product){
                    if($item_id_product==$ob['ID']){
                        CSaleOrder::CancelOrder($key_id_order, "Y", "Время брони истекло");
                    }
                }

            }
        }
    }
    return testBronClass();
}
开发者ID:ASDAFF,项目名称:gpbitrix,代码行数:65,代码来源:class.php

示例5: elseif

            $arFields['PRICE'] -= $order['discount'];
        }

        if(!empty($arFields)) {
            CSaleOrder::Update($order['externalId'], $arFields);
        }

        if(isset($order['status']) && $order['status']) {
            if(isset($optionsPayStatuses[$order['status']]) && $optionsPayStatuses[$order['status']]) {
                // set STATUS_ID
                CSaleOrder::StatusOrder($order['externalId'], $optionsPayStatuses[$order['status']]);

                if($wasCanaceled && $optionsPayStatuses[ $order['status'] ] != 'YY') {
                    CSaleOrder::CancelOrder($order['externalId'], "N", $order['statusComment']);
                } elseif ($optionsPayStatuses[ $order['status'] ] == 'YY') {
                    CSaleOrder::CancelOrder($order['externalId'], "Y", $order['statusComment']);
                }
            }
        }

        // set PAYED
        if(isset($order['paymentStatus']) && $order['paymentStatus'] && $optionsPayment[$order['paymentStatus']]) {
            CSaleOrder::PayOrder($order['externalId'], $optionsPayment[$order['paymentStatus']]);
        }

        if(function_exists('intarocrm_order_post_persist')) {
            intarocrm_order_post_persist($order);
        }
    }
    $GLOBALS['INTARO_CRM_FROM_HISTORY'] = false;
}
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:31,代码来源:history.php

示例6: __MakeOrder

			elseif($key == "PHONE")
				$arProp["VALUE"] = "8 495 2312121";
			elseif($key == "ZIP")
				$arProp["VALUE"] = "101000";
			elseif($key == "LOCATION")
				$arProp["VALUE"] = $location;
			elseif($key == "CITY")
				$arProp["VALUE"] = $shopLocation;
			$arData["PROPS"][] = $arProp;
		}
		$orderID = __MakeOrder(3, $arData);
		CSaleOrder::DeliverOrder($orderID, "Y");
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "F");
		$orderID = __MakeOrder(4, $arData);
		CSaleOrder::DeliverOrder($orderID, "Y");
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "F");
		$orderID = __MakeOrder(2, $arData);
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "P");
		$orderID = __MakeOrder(1, $arData);
		$orderID = __MakeOrder(3, $arData);
		CSaleOrder::CancelOrder($orderID, "Y");
		CAgent::RemoveAgent("CSaleProduct::RefreshProductList();", "sale");
		CAgent::AddAgent("CSaleProduct::RefreshProductList();", "sale", "N", 60*60*24*4, "", "Y");
	}

}
return true;
?>
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:step1.php

示例7: GetMessage

     for ($i = 0; $i < count($arIDs); $i++) {
         if (IntVal($arIDs[$i]) > 0 && strlen($STATUS_ID) > 0 && $arOrder["STATUS_ID"] != $STATUS_ID) {
             if (!CSaleOrder::StatusOrder($arIDs[$i], $STATUS_ID)) {
                 if ($ex = $APPLICATION->GetException()) {
                     $errorMessage .= $ex->GetString();
                 } else {
                     $errorMessage .= GetMessage("SOE_ERROR_STATUS_EDIT") . ". ";
                 }
             }
         }
     }
 }
 if (StrLen($errorMessage) <= 0) {
     for ($i = 0; $i < count($arIDs); $i++) {
         if (IntVal($arIDs[$i]) > 0 && $bUserCanCancelOrder && $arOrder["CANCELED"] != $CANCELED) {
             if (!CSaleOrder::CancelOrder($arIDs[$i], $CANCELED, $REASON_CANCELED)) {
                 if ($ex = $APPLICATION->GetException()) {
                     $errorMessage .= $ex->GetString();
                 } else {
                     $errorMessage .= GetMessage("SOE_ERROR_CANCEL_EDIT") . ". ";
                 }
             }
         }
     }
 }
 if (StrLen($errorMessage) <= 0) {
     for ($i = 0; $i < count($arIDs); $i++) {
         if (IntVal($arIDs[$i]) > 0 && $bUserCanDeliverOrder && $arOrder["ALLOW_DELIVERY"] != $ALLOW_DELIVERY) {
             $arAdditionalFields = array("DELIVERY_DOC_NUM" => strlen($DELIVERY_DOC_NUM) > 0 ? $DELIVERY_DOC_NUM : False, "DELIVERY_DOC_DATE" => strlen($DELIVERY_DOC_DATE) > 0 ? $DELIVERY_DOC_DATE : False);
             if (!CSaleOrder::DeliverOrder($arIDs[$i], $ALLOW_DELIVERY, 0, $arAdditionalFields)) {
                 if ($ex = $APPLICATION->GetException()) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:order_edit.php

示例8: nodeHandler


//.........这里部分代码省略.........
												if (IntVal($arItem["PRICE"]) != IntVal($orderInfo["PRICE_DELIVERY"]))
													$arOrderFields["PRICE_DELIVERY"] = $arItem["PRICE"];
											}
										}
									}
								}

								if($bNeedUpdate)
								{
									$arErrors = array();
									CSaleBasket::DoSaveOrderBasket($orderId, $orderInfo["LID"], $orderInfo["USER_ID"], $arShoppingCart, $arErrors);
								}

								if(DoubleVal($arOrder["AMOUNT"]) > 0 && $arOrder["AMOUNT"] != $orderInfo["PRICE"])
									$arOrderFields["PRICE"] = $arOrder["AMOUNT"];
								if(DoubleVal($orderInfo["DISCOUNT_VALUE"]) > 0)
									$arOrderFields["DISCOUNT_VALUE"] = 0;
								if(strlen($arOrder["COMMENT"]) > 0 && $arOrder["COMMENT"] != $orderInfo["COMMENTS"])
									$arOrderFields["COMMENTS"] = $arOrder["COMMENT"];
								$arOrderFields["UPDATED_1C"] = "Y";
								if(!empty($arOrderFields))
									CSaleOrder::Update($orderId, $arOrderFields);
							}
							else
							{
								$this->strError .= "\n".GetMessage("CC_BSC1_FINAL_NOT_EDIT", Array("#ID#" => $orderId));
							}
						}

						$arAditFields = Array();
						if($arOrder["TRAITS"][GetMessage("CC_BSC1_CANCELED")] == "true")
						{
							if($orderInfo["CANCELED"] == "N")
								CSaleOrder::CancelOrder($orderInfo["ID"], "Y", $arOrder["COMMENT"]);
							$arAditFields["UPDATED_1C"] = "Y";
						}
						else
						{
							if(strlen($arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")])>1)
							{
								if($orderInfo["PAYED"]=="N")
									CSaleOrder::PayOrder($orderInfo["ID"], "Y");
								$arAditFields["PAY_VOUCHER_DATE"] = CDatabase::FormatDate(str_replace("T", " ", $arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_DATE")]), "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL", LANG));
								if(strlen($arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_NUM")])>0)
									$arAditFields["PAY_VOUCHER_NUM"] = $arOrder["TRAITS"][GetMessage("CC_BSC1_1C_PAYED_NUM")];
								$arAditFields["UPDATED_1C"] = "Y";
							}

							if(strlen($arOrder["TRAITS"][GetMessage("CC_BSC1_1C_DELIVERY_DATE")])>1)
							{
								if($orderInfo["ALLOW_DELIVERY"]=="N")
									CSaleOrder::DeliverOrder($orderInfo["ID"], "Y");
								$arAditFields["DATE_ALLOW_DELIVERY"] = CDatabase::FormatDate(str_replace("T", " ", $arOrder["TRAITS"][GetMessage("CC_BSC1_1C_DELIVERY_DATE")]), "YYYY-MM-DD HH:MI:SS", CLang::GetDateFormat("FULL", LANG));
								if(strlen($this->arParams["FINAL_STATUS_ON_DELIVERY"])>0 && $orderInfo["STATUS_ID"] != "F" && $orderInfo["STATUS_ID"] != $this->arParams["FINAL_STATUS_ON_DELIVERY"])
									CSaleOrder::StatusOrder($orderInfo["ID"], $this->arParams["FINAL_STATUS_ON_DELIVERY"]);
								$arAditFields["UPDATED_1C"] = "Y";
							}
						}

						if(count($arAditFields)>0)
							CSaleOrder::Update($orderInfo["ID"], $arAditFields);
					}
					else
						$this->strError .= "\n".GetMessage("CC_BSC1_ORDER_NOT_FOUND", Array("#ID#" => $arOrder["ID"]));
				}
				elseif($this->arParams["IMPORT_NEW_ORDERS"] == "Y") // create new order (ofline 1C)
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:67,代码来源:order_loader.php

示例9: GetMessage

						else
						{
							$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_PERMS_CANCEL_GROUP")), $ID);
						}
					}
					else
					{
						$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_PERMS_CANCEL_GROUP_CANCEL")), $ID);
					}
				break;
				case "cancel_n":
					if($arAffectedOrders[$ID]["CANCELED"] == "Y")
					{
						if (CSaleOrder::CanUserCancelOrder($ID, $arUserGroups, $intUserID))
						{
							if (!CSaleOrder::CancelOrder($ID, "N"))
							{
								if ($ex = $APPLICATION->GetException())
									$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_ERROR_CANCEL_GROUP")).": ".$ex->GetString(), $ID);
								else
									$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_ERROR_CANCEL_GROUP")), $ID);
							}
						}
						else
						{
							$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_PERMS_CANCEL_GROUP")), $ID);
						}
					}
					else
					{
						$lAdmin->AddGroupError(str_replace("#ID#", $ID, GetMessage("SOA_PERMS_CANCEL_GROUP_CANCEL_N")), $ID);
开发者ID:akniyev,项目名称:arteva.ru,代码行数:31,代码来源:order.php

示例10: 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

示例11: isset

     if (!CSaleOrder::CanUserChangeOrderStatus($id, $status_id, $GLOBALS["USER"]->GetUserGroupArray())) {
         break;
     }
     $result = CSaleOrder::StatusOrder($id, $status_id);
     break;
 case "order_cancel":
     $bUserCanCancelOrder = CSaleOrder::CanUserCancelOrder($id, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID());
     if (!$bUserCanCancelOrder || CSaleOrder::IsLocked($id, $lockedBY, $dateLock)) {
         break;
     }
     $cancel = isset($_REQUEST['cancel']) ? trim($_REQUEST['cancel']) : 'N';
     $comment = isset($_REQUEST['comment']) ? trim($_REQUEST['comment']) : '';
     if (strlen($comment) > 0) {
         $comment = $APPLICATION->ConvertCharset($comment, 'utf-8', SITE_CHARSET);
     }
     $result = CSaleOrder::CancelOrder($id, $cancel, $comment);
     break;
 case "get_order_html":
     $arOrder = CSaleMobileOrderUtils::getOrderInfoDetail($id);
     $result = CSaleMobileOrderUtils::makeDetailClassFromOrder($arOrder);
     break;
 case "delivery_allow":
     $bUserCanDeliverOrder = CSaleOrder::CanUserChangeOrderFlag($id, "PERM_DELIVERY", $GLOBALS["USER"]->GetUserGroupArray());
     if (!$bUserCanDeliverOrder) {
         break;
     }
     $arAdditionalFields = array();
     if ($status_id && CSaleOrder::CanUserChangeOrderStatus($id, $status_id, $GLOBALS["USER"]->GetUserGroupArray())) {
         $arAdditionalFields = array("STATUS_ID" => $status_id);
     }
     $deliver = isset($_REQUEST['deliver']) ? trim($_REQUEST['deliver']) : '';
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:ajax.php

示例12: SetStatus

 public function SetStatus($ID, $statusID, $statusParams = false, $options = array())
 {
     global $USER;
     if (!CModule::IncludeModule('sale')) {
         return false;
     }
     $currentUserId = 0;
     if (isset($USER) && (get_class($USER) === 'CUser' || $USER instanceof CUser)) {
         $currentUserId = $USER->GetID();
     }
     $result = true;
     if (!self::$INVOICE_STATUSES) {
         self::$INVOICE_STATUSES = CCrmStatus::GetStatus('INVOICE_STATUS');
     }
     if (!is_array(self::$INVOICE_STATUSES) || count(self::$INVOICE_STATUSES) <= 2 || !array_key_exists('P', self::$INVOICE_STATUSES) || !array_key_exists('D', self::$INVOICE_STATUSES) || self::$INVOICE_STATUSES['P']['SORT'] >= self::$INVOICE_STATUSES['D']['SORT']) {
         $result = false;
     }
     if ($result) {
         $CSaleOrder = new CSaleOrder();
         // get current state
         if (!($arOrder = CSaleOrder::GetByID($ID))) {
             $result = false;
         }
         if ($result) {
             $curPay = $arOrder['PAYED'];
             $curCancel = $arOrder['CANCELED'];
             $curMarked = $arOrder['MARKED'];
             $curStatusID = $arOrder['STATUS_ID'];
             $pay = $cancel = 'N';
             $marked = isset($statusParams['REASON_MARKED']) || isset($statusParams['DATE_MARKED']) ? 'Y' : 'N';
             if (self::$INVOICE_STATUSES[$statusID]['SORT'] >= self::$INVOICE_STATUSES['P']['SORT']) {
                 $pay = 'Y';
             }
             if (self::$INVOICE_STATUSES[$statusID]['SORT'] >= self::$INVOICE_STATUSES['D']['SORT']) {
                 $pay = 'N';
                 $cancel = 'Y';
             }
             if ($curPay != $pay) {
                 $result = $CSaleOrder->PayOrder($ID, $pay, true, true, 0, array('NOT_CHANGE_STATUS' => 'Y'));
             }
             if ($result && $curCancel != $cancel) {
                 $result = $CSaleOrder->CancelOrder($ID, $cancel);
             }
             if ($result && $marked === 'Y') {
                 $result = $CSaleOrder->SetMark($ID, isset($statusParams['REASON_MARKED']) ? $statusParams['REASON_MARKED'] : '', $currentUserId);
             }
             if ($result) {
                 $arUpdate = array();
                 if (isset($statusParams['DATE_MARKED'])) {
                     $arUpdate['DATE_MARKED'] = $statusParams['DATE_MARKED'];
                 }
                 if ($pay === 'Y') {
                     if (isset($statusParams['PAY_VOUCHER_NUM'])) {
                         $arUpdate['PAY_VOUCHER_NUM'] = $statusParams['PAY_VOUCHER_NUM'];
                     }
                     if (isset($statusParams['PAY_VOUCHER_DATE'])) {
                         $arUpdate['PAY_VOUCHER_DATE'] = $statusParams['PAY_VOUCHER_DATE'];
                     }
                 }
                 if (count($arUpdate) > 0) {
                     $result = self::Update($ID, $arUpdate);
                 }
                 unset($arUpdate);
             }
             if ($result && $curStatusID != $statusID) {
                 $result = $CSaleOrder->StatusOrder($ID, $statusID) === $ID;
             }
         }
     }
     if ($result && is_array($options) && isset($options['SYNCHRONIZE_LIVE_FEED']) && $options['SYNCHRONIZE_LIVE_FEED']) {
         self::SynchronizeLiveFeedEvent($ID, array('PROCESS_PARENTS' => false, 'REFRESH_DATE' => true));
     }
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:74,代码来源:crm_invoice.php

示例13: orderHistory


//.........这里部分代码省略.........
                     if (isset($item['quantity']) && $item['quantity']) {
                         $arProduct['QUANTITY'] = $item['quantity'];
                     }
                     if (isset($item['offer']['name']) && $item['offer']['name']) {
                         $arProduct['NAME'] = self::fromJSON($item['offer']['name']);
                     }
                     if (isset($item['created']) && $item['created'] == true) {
                         $iBlocks = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_CATALOG_IBLOCKS, 0));
                         $iBlock = array_shift($iBlocks);
                         $newSection = new CIBlockSection();
                         $newSectionFields = array("ACTIVE" => 'N', "IBLOCK_ID" => $iBlock, "NAME" => 'RetailCRM', "CODE" => 'RetailCRM');
                         $resSection = $newSection->Add($newSectionFields);
                         if (!$resSection) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'CIBlockSection::Add', 'Error castom section add');
                             continue;
                         }
                         $arLoadProductArray = array("IBLOCK_SECTION_ID" => $resSection, "IBLOCK_ID" => $iBlock, "NAME" => $item['offer']['name'] ? $item['offer']['name'] : 'RetailCrmElement', "CODE" => 'RetailCrmElement', "ACTIVE" => 'Y');
                         $el = new CIBlockElement();
                         $PRODUCT_ID = $el->Add($arLoadProductArray, false, false, true);
                         if (!$PRODUCT_ID) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'CIBlockElement::Add', 'Error castom element add');
                             continue;
                         }
                         if (!CCatalogProduct::Add(array("ID" => $PRODUCT_ID))) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'CCatalogProduct::Add', 'Error product add');
                             continue;
                         }
                         $arFields = array("PRODUCT_ID" => $PRODUCT_ID, "CATALOG_GROUP_ID" => COption::GetOptionString(self::$MODULE_ID, self::$CRM_CATALOG_BASE_PRICE, 0), "PRICE" => $item['initialPrice'] ? $item['initialPrice'] : 1, "CURRENCY" => CCurrency::GetBaseCurrency());
                         if (!CPrice::Add($arFields)) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'CPrice::Add', 'Error price add');
                             continue;
                         }
                         $Params = array(array('NAME' => 'id', 'CODE' => 'ID', 'VALUE' => $item['offer']['externalId']));
                         if (!Add2BasketByProductID($PRODUCT_ID, $item['quantity'], $arProduct, $Params)) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'Add2BasketByProductID', 'Error add to basket');
                             continue;
                         }
                         if (!CIBlockSection::Delete($resSection)) {
                             self::eventLog('ICrmOrderActions::orderHistory', 'CIBlockSection::Delete', 'Error delete section');
                             continue;
                         }
                         continue;
                     }
                     $prp = CSaleBasket::GetPropsList(array(), array("ORDER_ID" => $order['externalId'], "CODE" => 'ID', "VALUE" => $item['offer']['externalId']))->Fetch();
                     CSaleBasket::Update($prp['BASKET_ID'], $arProduct);
                 }
             }
             if (isset($order['delivery']) === false || isset($order['delivery']['cost']) === false) {
                 $order['delivery']['cost'] = $arFields['PRICE_DELIVERY'];
             }
             if (isset($order['summ']) === false || $order['summ'] <= 0) {
                 $order['summ'] = $arFields['PRICE'] - $arFields['PRICE_DELIVERY'];
             }
             $wasCanaceled = $arFields['CANCELED'] == 'Y' ? true : false;
             if (isset($optionsDelivTypes[$order['delivery']['code']])) {
                 $resultDeliveryTypeId = $optionsDelivTypes[$order['delivery']['code']];
             } else {
                 $resultDeliveryTypeId = isset($order['delivery']['service']) && isset($order['delivery']['service']['code']) ? reset(explode(":", $arFields['DELIVERY_ID'], 1)) : $arFields['DELIVERY_ID'];
             }
             if (isset($order['delivery']['service']) && isset($order['delivery']['service']['code'])) {
                 $deliveryHandler = reset(CSaleDeliveryHandler::GetBySID($resultDeliveryTypeId)->arResult);
                 if (count($deliveryHandler) > 0 && array_key_exists($order['delivery']['service']['code'], $deliveryHandler['PROFILES'])) {
                     $resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $order['delivery']['service']['code'];
                 }
             }
             // orderUpdate
             $arFields = self::clearArr(array('PRICE_DELIVERY' => $order['delivery']['cost'], 'PRICE' => $order['summ'] + (double) $order['delivery']['cost'], 'DATE_MARKED' => $order['markDatetime'], 'USER_ID' => $userId, 'PAY_SYSTEM_ID' => $optionsPayTypes[$order['paymentType']], 'DELIVERY_ID' => $resultDeliveryTypeId, 'STATUS_ID' => $optionsPayStatuses[$order['status']], 'REASON_CANCELED' => self::fromJSON($order['statusComment']), 'USER_DESCRIPTION' => self::fromJSON($order['customerComment']), 'COMMENTS' => self::fromJSON($order['managerComment'])));
             if (isset($order['discount'])) {
                 $arFields['DISCOUNT_VALUE'] = $order['discount'];
                 $arFields['PRICE'] -= $order['discount'];
             }
             if (!empty($arFields)) {
                 CSaleOrder::Update($order['externalId'], $arFields);
             }
             if (isset($order['status']) && $order['status']) {
                 if (isset($optionsPayStatuses[$order['status']]) && $optionsPayStatuses[$order['status']]) {
                     // set STATUS_ID
                     CSaleOrder::StatusOrder($order['externalId'], $optionsPayStatuses[$order['status']]);
                     if ($wasCanaceled && $optionsPayStatuses[$order['status']] != 'YY') {
                         CSaleOrder::CancelOrder($order['externalId'], "N", $order['statusComment']);
                     } elseif ($optionsPayStatuses[$order['status']] == 'YY') {
                         CSaleOrder::CancelOrder($order['externalId'], "Y", $order['statusComment']);
                     }
                 }
             }
             // set PAYED
             if (isset($order['paymentStatus']) && $order['paymentStatus'] && $optionsPayment[$order['paymentStatus']]) {
                 CSaleOrder::PayOrder($order['externalId'], $optionsPayment[$order['paymentStatus']]);
             }
             if (function_exists('intarocrm_order_post_persist')) {
                 intarocrm_order_post_persist($order);
             }
         }
     }
     if (count($orderHistory) > 0) {
         COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_HISTORY_DATE, $dateFinish->format('Y-m-d H:i:s'));
     }
     $GLOBALS['INTARO_CRM_FROM_HISTORY'] = false;
     return true;
 }
开发者ID:Ksenobyte,项目名称:bitrix-module,代码行数:101,代码来源:ICrmOrderActions.php


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