Ejemplo n.º 1
0
  @Override
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public Boolean remove(Long id) throws IabakoActionForbiddenException {

    saleDAO.deleteAttachedObjects(id);

    Sale sale = saleDAO.findById(id);
    if (sale == null) {
      log.warn("No sale found with id :" + id);
      return false;
    }

    stockRollBack(sale);

    Client client = sale.getClient();

    boolean result = super.remove(id);

    if (client != null) {
      clientService.calculateStatus(client);
    }

    trackingService.addTrackingToUserSession(TrackingType.saleDelete, sale);

    return result;
  }
Ejemplo n.º 2
0
 @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
 public Sale calculateStatusAndSave(Sale sale, boolean isDraft) {
   sale.calculateStatus(isDraft);
   sale = (Sale) super.save(sale);
   if (!isDraft) {
     clientService.calculateStatus(sale.getClient());
   }
   return sale;
 }