private void setAttributesFromDB(Sale sale, Sale saleFromDB) { sale.setStatus(saleFromDB.getStatus()); sale.setRecalculatedTotal(saleFromDB.getRecalculatedTotal()); sale.setTotalBeforeTax(saleFromDB.getTotalBeforeTax()); sale.setTotalAfterTax(saleFromDB.getTotalAfterTax()); sale.setTotalNoTax(saleFromDB.getTotalNoTax()); }
private Sale checkIfQuote(Sale sale) { if (sale.getSaleQuoteId() != null) { Sale saleQuote = saleDAO.findById(Long.parseLong(sale.getSaleQuoteId())); if (saleQuote != null && saleQuote.isQuote()) { saleQuote.setSaleQuoteId( sale.getStatus() == FinancialStatusSale._0_draft ? "_draft_" + sale.getId() : sale.getId() + ""); saleQuote.setStatus(FinancialStatusSale._2_quote_transformed); } else { sale.setSaleQuoteId(null); } saleDAO.merge(saleQuote); return saleQuote; } return null; }