本文整理汇总了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;
}
示例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;
}