B23 - Não permitir excluir uma empresa quando tiver cadastros associados a ela (fixed bug #5253)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@35239 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
ba5480ba94
commit
5a4182e360
|
@ -41,6 +41,7 @@ import com.rjconsultores.ventaboletos.service.EmpresaImpostoService;
|
|||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.EstadoService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -214,14 +215,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
|
||||
public void onClick$btnApagar(Event ev) throws InterruptedException {
|
||||
|
||||
if (!empresaService.puedeBorrar(empresa)){
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarEmpresaController.MSG.noPuedeBorrar"),
|
||||
Labels.getLabel("editarEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
int resp = Messagebox.show(
|
||||
Labels.getLabel("editarEmpresaController.MSG.borrarPergunta"),
|
||||
Labels.getLabel("editarEmpresaController.window.title"),
|
||||
|
@ -229,7 +222,16 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
|
|||
|
||||
if (resp == Messagebox.YES) {
|
||||
|
||||
empresaService.borrar(empresa);
|
||||
try {
|
||||
empresaService.borrar(empresa);
|
||||
} catch (RegistroConDependenciaException e) {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarEmpresaController.MSG.noPuedeBorrar"),
|
||||
Labels.getLabel("editarEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarEmpresaController.MSG.borrarOK"),
|
||||
|
|
Loading…
Reference in New Issue