diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java index d6ae00a78..b8f5049d8 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarEmpresaController.java @@ -732,20 +732,27 @@ public class EditarEmpresaController extends MyGenericForwardComposer { } } - public void onClick$btnAdicionarComissaoCategoria(Event ev) throws InterruptedException { +public void onClick$btnAdicionarComissaoCategoria(Event ev) throws InterruptedException { try { - + Categoria categoria = (Categoria) cmbCategorias.getSelectedItem().getValue(); if(categoria != null) { + for (ComEmpCategoria c : empresa.getComEmpCategorias()) { + if (c.getCategoria().getCategoriaId().equals(categoria.getCategoriaId())) { + return; + } + } + ComEmpCategoria comEmpCategoria = new ComEmpCategoria(); comEmpCategoria.setCategoria(categoria); comEmpCategoria.setEmpresa(getEmpresa()); comEmpCategoria = empresaService.adicionarComissaoCategoria(comEmpCategoria); - + comEmpCategoriaList.updateItem(comEmpCategoria); + empresa.getComEmpCategorias().add(comEmpCategoria); Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoCategoria"), Labels.getLabel("editarEmpresaController.window.title"), @@ -773,6 +780,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { ComEmpCategoria comEmpCategoria = (ComEmpCategoria) comEmpCategoriaList.getSelected(); empresaService.removerComissaoCategoria(comEmpCategoria); comEmpCategoriaList.removeItem(comEmpCategoria); + empresa.getComEmpCategorias().remove(comEmpCategoria); Messagebox.show(Labels.getLabel("editarEmpresaController.msg.removerComissaoCategoria"), Labels.getLabel("editarEmpresaController.window.title"), @@ -795,6 +803,12 @@ public class EditarEmpresaController extends MyGenericForwardComposer { if(formapago != null) { + for(ComEmpFormapago f : empresa.getComEmpFormapagos()){ + if(f.getFormaPago().getFormapagoId().equals(formapago.getFormapagoId())){ + return; + } + } + ComEmpFormapago comEmpFormapago = new ComEmpFormapago(); comEmpFormapago.setFormaPago(formapago); comEmpFormapago.setEmpresa(getEmpresa()); @@ -802,6 +816,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { comEmpFormapago = empresaService.adicionarComissaoFormapago(comEmpFormapago); comEmpFormapagoList.updateItem(comEmpFormapago); + empresa.getComEmpFormapagos().add(comEmpFormapago); Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoFormapago"), Labels.getLabel("editarEmpresaController.window.title"), @@ -829,6 +844,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { ComEmpFormapago comEmpFormapago = (ComEmpFormapago) comEmpFormapagoList.getSelected(); empresaService.removerComissaoFormapago(comEmpFormapago); comEmpFormapagoList.removeItem(comEmpFormapago); + empresa.getComEmpFormapagos().remove(comEmpFormapago); Messagebox.show(Labels.getLabel("editarEmpresaController.msg.removerComissaoFormapago"), Labels.getLabel("editarEmpresaController.window.title"), @@ -855,6 +871,12 @@ public class EditarEmpresaController extends MyGenericForwardComposer { TipoEventoExtra tipoEventoExtra = (TipoEventoExtra) selectedItem.getValue(); if(tipoEventoExtra != null) { + + for(ComEmpTipoEventoExtra e : empresa.getComEmpTipoEventoExtras()){ + if(e.getTipoEventoExtra().getTipoeventoextraId().equals(tipoEventoExtra.getTipoeventoextraId())){ + return; + } + } ComEmpTipoEventoExtra comEmpTipoEventoExtra = new ComEmpTipoEventoExtra(); comEmpTipoEventoExtra.setTipoEventoExtra(tipoEventoExtra); @@ -863,6 +885,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { comEmpTipoEventoExtra = empresaService.adicionarComissaoTipoEventoExtra(comEmpTipoEventoExtra); comEmpTipoEventoExtraList.updateItem(comEmpTipoEventoExtra); + empresa.getComEmpTipoEventoExtras().add(comEmpTipoEventoExtra); Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoTipoEventoExtra"), Labels.getLabel("editarEmpresaController.window.title"), @@ -888,6 +911,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer { if (resp == Messagebox.YES) { ComEmpTipoEventoExtra comEmpTipoEventoExtra = (ComEmpTipoEventoExtra) comEmpTipoEventoExtraList.getSelected(); + empresa.getComEmpTipoEventoExtras().remove(comEmpTipoEventoExtra); empresaService.removerComissaoTipoEventoExtra(comEmpTipoEventoExtra); comEmpTipoEventoExtraList.removeItem(comEmpTipoEventoExtra); @@ -904,7 +928,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer { Messagebox.OK,Messagebox.ERROR); } } - public Combobox getCmbEstadoInscEstadual() { return cmbEstadoInscEstadual; }