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


PHP CSaleDeliveryHandler::executeAction方法代码示例

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


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

示例1: execHandlerAction

 public static function execHandlerAction($orderId, $actionId)
 {
     global $DB, $USER;
     $arResult = array();
     $arOrder = CSaleOrder::GetById($orderId);
     $handlerActions = CSaleDeliveryHandler::getActionsList($arOrder["DELIVERY_ID"]);
     if (!array_key_exists($actionId, $handlerActions)) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_HAS_NO_ACTION"));
     }
     $dt = new \Bitrix\Main\Type\DateTime();
     $depList = \Bitrix\Sale\Internals\OrderDeliveryReqTable::getList(array('filter' => array('=ORDER_ID' => $orderId)));
     $dep = $depList->fetch();
     if ($dep && !is_null($dep["DATE_REQUEST"])) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_REQUEST_ALREADY_SENT"));
     }
     if (empty($arResult)) {
         $arUserGroups = $USER->GetUserGroupArray();
         $arOrder["ITEMS"] = array();
         $dbItemsList = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $orderId));
         while ($arItem = $dbItemsList->GetNext()) {
             $arItem["DIMENSIONS"] = unserialize($arItem["~DIMENSIONS"]);
             unset($arItem["~DIMENSIONS"]);
             $arOrder["ITEMS"][] = $arItem;
         }
         $arResult = CSaleDeliveryHandler::executeAction($arOrder["DELIVERY_ID"], $actionId, $arOrder);
         if ($actionId == "REQUEST_SELF" && isset($arResult["TRACKING_NUMBER"])) {
             $bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($orderId, $arUserGroups);
             if ($bUserCanEditOrder) {
                 if ($dep) {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::update($dep["ID"], array("DATE_REQUEST" => $dt));
                 } else {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::add(array("ORDER_ID" => $orderId, "DATE_REQUEST" => $dt));
                 }
                 $fields = array();
                 if (isset($arResult["TRACKING_NUMBER"])) {
                     $fields["TRACKING_NUMBER"] = $arResult["TRACKING_NUMBER"];
                 }
                 if (isset($arResult["DELIVERY_DOC_NUM"])) {
                     $fields["DELIVERY_DOC_NUM"] = $arResult["DELIVERY_DOC_NUM"];
                     $fields["DELIVERY_DOC_DATE"] = Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $arOrder["LID"])));
                 }
                 CSaleOrder::Update($orderId, $fields);
             }
         }
         CSaleOrderChange::AddRecord($orderId, "ORDER_DELIVERY_REQUEST_SENT", $arResult);
     }
     return $arResult;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:48,代码来源:delivery_helper.php

示例2: processAdditionalInfoShipmentEdit

 public function processAdditionalInfoShipmentEdit(Shipment $shipment, array $requestData)
 {
     if (empty($requestData['REQUEST_SELF']) || $requestData['REQUEST_SELF'] != 'Y') {
         return null;
     }
     $shipmentId = $shipment->getId();
     if (intval($shipmentId) <= 0) {
         return null;
     }
     $dt = new \Bitrix\Main\Type\DateTime();
     $arResult = CSaleDeliveryHandler::executeAction(\CSaleDelivery::getCodeById($shipment->getDeliveryId()), 'REQUEST_SELF', \CAllSaleDelivery::convertOrderNewToOld($shipment));
     if (!$arResult) {
         return null;
     }
     $res = \Bitrix\Sale\Internals\OrderDeliveryReqTable::add(array("SHIPMENT_ID" => $shipmentId, "ORDER_ID" => $shipment->getCollection()->getOrder()->getId(), "DATE_REQUEST" => $dt, "PARAMS" => array("TYPE" => "REQUEST_SELF", "RESULT" => $arResult)));
     if (!$res->isSuccess()) {
         return null;
     }
     if (isset($arResult["TRACKING_NUMBER"])) {
         $shipment->setField("TRACKING_NUMBER", $arResult["TRACKING_NUMBER"]);
     }
     if (isset($arResult["DELIVERY_DOC_NUM"])) {
         $shipment->setField("DELIVERY_DOC_NUM", $arResult["DELIVERY_DOC_NUM"]);
         $shipment->setField("DELIVERY_DOC_DATE", $dt);
     }
     return $shipment;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:27,代码来源:delivery_pecom.php


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