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-87c2c4800839
master
leonardo 2014-05-02 16:41:42 +00:00
parent ba5480ba94
commit 5a4182e360
1 changed files with 11 additions and 9 deletions

View File

@ -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"),