} $ID = intval($_REQUEST["ID"]); $intLockUserID = 0; $strLockTime = ''; if (isset($_REQUEST['dontsave']) && $_REQUEST['dontsave'] == 'Y') { if (!\Bitrix\Sale\Order::isLocked($ID)) { \Bitrix\Sale\Order::unlock($ID); } \Bitrix\Sale\DiscountCouponsManager::clearByOrder($ID); LocalRedirect("sale_order.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/lib/helpers/admin/orderedit.php"; //load order $boolLocked = \Bitrix\Sale\Order::isLocked($ID); if ($boolLocked) { $r = \Bitrix\Sale\Order::getLockedStatus($ID); if ($r->isSuccess()) { $lockResult = $r->getData(); if (array_key_exists('LOCKED_BY', $lockResult) && intval($lockResult['LOCKED_BY']) > 0) { $intLockUserID = intval($lockResult['LOCKED_BY']); } if (array_key_exists('DATE_LOCK', $lockResult) && $lockResult['DATE_LOCK'] instanceof \Bitrix\Main\Type\DateTime) { $strLockTime = $lockResult['DATE_LOCK']->toString(); } } $strLockUser = $intLockUserID; $strLockUserInfo = $intLockUserID; $userIterator = \Bitrix\Main\UserTable::getList(array('select' => array('ID', 'LOGIN', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'EMAIL'), 'filter' => array('=ID' => $intLockUserID))); if ($arOneUser = $userIterator->fetch()) { $strLockUser = CUser::FormatName($strNameFormat, $arOneUser); $strLockUserInfo = '<a href="/bitrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $intLockUserID . '">' . $strLockUser . '</a>';
$boolLocked = false; if ($saleModulePermissions == "D") { $APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED")); } /** @var \Bitrix\Sale\Order $order */ if (!isset($_REQUEST["ID"]) || intval($_REQUEST["ID"]) <= 0) { LocalRedirect("/bitrix/admin/sale_order.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } $ID = intval($_REQUEST["ID"]); $boolLocked = \Bitrix\Sale\Order::isLocked($ID); if ($boolLocked) { LocalRedirect("sale_order_view.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } //Unlocking if we leave this page if (isset($_REQUEST['unlock']) && 'Y' == $_REQUEST['unlock']) { $lockStatusRes = \Bitrix\Sale\Order::getLockedStatus($ID); if ($lockStatusRes->isSuccess()) { $lockStatusData = $lockStatusRes->getData(); } if (isset($lockStatusData['LOCK_STATUS']) && ($lockStatusData['LOCK_STATUS'] != \Bitrix\Sale\Order::SALE_ORDER_LOCK_STATUS_RED || !isset($_REQUEST['target']))) { $res = \Bitrix\Sale\Order::unlock($ID); if ($res->isSuccess()) { \Bitrix\Sale\DiscountCouponsManager::clearByOrder($ID); } } if (isset($_REQUEST['target']) && 'list' == $_REQUEST['target']) { LocalRedirect("sale_order.php?lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } else { LocalRedirect("sale_order_edit.php?ID=" . $ID . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_", false)); } }