/** * Unlock order. * * @param int $id Order id. * @return Entity\UpdateResult|Result * @throws Main\ArgumentNullException * @throws \Exception */ public static function unlock($id) { global $USER; $result = new Result(); $id = (int) $id; if ($id <= 0) { $result->addError(new ResultError(Loc::getMessage('SALE_ORDER_WRONG_ID'), 'SALE_ORDER_WRONG_ID')); return $result; } if (!($order = Order::load($id))) { $result->addError(new ResultError(Loc::getMessage('SALE_ORDER_ENTITY_NOT_FOUND'), 'SALE_ORDER_ENTITY_NOT_FOUND')); return $result; } $userRights = \CMain::getUserRight("sale", $USER->getUserGroupArray(), "Y", "Y"); if ($userRights >= "W" || $order->getField("LOCKED_BY") == $USER->getID()) { return Internals\OrderTable::update($id, array('DATE_LOCK' => null, 'LOCKED_BY' => null)); } return $result; }