public static MOrder completeOrder(Properties ctx, MOrder order) throws BPartnerOverCreditLimitException, OperationException { if (order.isSOTrx() == true) { CreditCheckBean crBean = OrderManager.checkBPartnerCreditLimit( ctx, order.getC_BPartner_ID(), order.get_ID(), order.get_TrxName()); if (crBean.getValid() == false) throw new BPartnerOverCreditLimitException(crBean.getMsg()); } PoManager.processIt(order, DocumentEngine.ACTION_Complete); return order; }
/** * Deletes all the orderlines from the order * * @param ctx * @param order the order * @param trxName * @throws OperationException */ public static void deleteOrderlines(Properties ctx, MOrder order, String trxName) throws OperationException { boolean isEmpty = OrderManager.isOrderEmpty(ctx, order.get_ID(), trxName); if (isEmpty) { return; } // checks the status of the order if (order.isProcessed()) { throw new OperationException("Cannot delete order that is already processed"); } String sql = "DELETE FROM C_ORDERLINE WHERE C_ORDER_ID = " + order.get_ID(); int no = DB.executeUpdate(sql, trxName); if (no == -1) { throw new OperationException("Could not delete order lines"); } } // deleteOrderlines