fixes bug#0012813
dev: fabricio qua: bruno Correção efetuada. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@87459 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d085d3e02f
commit
bd84ee8cec
|
@ -56,6 +56,7 @@ import com.rjconsultores.ventaboletos.service.UsuarioUbicacionService;
|
|||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.segurida.PerfilJerarquia;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MensagensUtils;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderUbicacion;
|
||||
|
@ -69,6 +70,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderUsuarioEmpresa;
|
|||
@Scope("prototype")
|
||||
public class EditarUsuarioController extends MyGenericForwardComposer {
|
||||
|
||||
private static final String TITULO_CONTROLER = "editarUsuarioController.window.title";
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static Logger log = Logger.getLogger(EditarUsuarioController.class);
|
||||
|
||||
|
@ -370,7 +372,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
} else {
|
||||
|
||||
|
@ -398,7 +400,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
txtNombMaterno.setDisabled(false);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.existeEmpleado", new Object[] { txtCveEmpleado.getValue() }),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
}
|
||||
|
@ -410,15 +412,15 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
|
||||
public void onClick$btnRemoverEmpresa(Event ev) {
|
||||
UsuarioEmpresa ue = (UsuarioEmpresa) empresaList.getSelected();
|
||||
if (ue != null) {
|
||||
ue.setActivo(Boolean.FALSE);
|
||||
ue.setFecmodif(Calendar.getInstance().getTime());
|
||||
ue.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
lsUsuarioEmpresa.remove(ue);
|
||||
empresaList.setData(lsUsuarioEmpresa);
|
||||
for (UsuarioEmpresa usuarioEmpresa : usuario.getUsuarioEmpresaList()) {
|
||||
if (usuarioEmpresa.equals(ue)) {
|
||||
usuarioEmpresa.setActivo(Boolean.FALSE);
|
||||
usuarioEmpresa.setFecmodif(Calendar.getInstance().getTime());
|
||||
usuarioEmpresa.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
lsUsuarioEmpresa.remove(ue);
|
||||
empresaList.setData(lsUsuarioEmpresa);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void onClick$btnAdicionarEmpresa(Event ev) throws InterruptedException {
|
||||
|
@ -438,29 +440,28 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
});
|
||||
|
||||
if (existeEmpresa) {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.Registro.Existe"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
return;
|
||||
MensagensUtils.showMessageExclamation("MSG.Registro.Existe", TITULO_CONTROLER);
|
||||
} else {
|
||||
|
||||
UsuarioEmpresa ue = new UsuarioEmpresa();
|
||||
ue.setActivo(Boolean.TRUE);
|
||||
ue.setFecmodif(Calendar.getInstance().getTime());
|
||||
ue.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
ue.setUsuarioLog(usuario);
|
||||
ue.setEmpresa(empresa);
|
||||
ue.setIndValidaPreimpreso(radioSim.isChecked());
|
||||
|
||||
UsuarioEmpresa ue = inicializaUsuarioEmpresa(empresa);
|
||||
lsUsuarioEmpresa.add(ue);
|
||||
usuario.setUsuarioEmpresaList(lsUsuarioEmpresa);
|
||||
empresaList.setData(lsUsuarioEmpresa);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private UsuarioEmpresa inicializaUsuarioEmpresa(final Empresa empresa) {
|
||||
UsuarioEmpresa usuarioEmpresa = new UsuarioEmpresa();
|
||||
usuarioEmpresa.setActivo(Boolean.TRUE);
|
||||
usuarioEmpresa.setFecmodif(Calendar.getInstance().getTime());
|
||||
usuarioEmpresa.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
usuarioEmpresa.setUsuarioLog(usuario);
|
||||
usuarioEmpresa.setEmpresa(empresa);
|
||||
usuarioEmpresa.setIndValidaPreimpreso(radioSim.isChecked());
|
||||
return usuarioEmpresa;
|
||||
}
|
||||
|
||||
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||
boolean hayCambioContrasena = false;
|
||||
txtSenha.setConstraint("no empty");
|
||||
|
@ -492,7 +493,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
if (!senha.equals(confirmSenha)) {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.configmSenha"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
return;
|
||||
|
@ -500,17 +501,11 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
|
||||
if (lsUsuarioUbicacion.isEmpty()) {
|
||||
tabUbicacion.setSelected(Boolean.TRUE);
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.necessitaUbicacion"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
MensagensUtils.showMessageExclamation("editarUsuarioController.MSG.necessitaUbicacion", TITULO_CONTROLER);
|
||||
return;
|
||||
}
|
||||
|
||||
Perfil perfil = (Perfil) cmbPerfil.getSelectedItem().getValue();
|
||||
usuario.setUsuarioEmpresaList(lsUsuarioEmpresa);
|
||||
usuario.setUsuarioUbicacionList(lsUsuarioUbicacion);
|
||||
senha = hayCambioContrasena ? senha : null;
|
||||
usuarioService.suscribirActualizar(usuario, senha, perfil);
|
||||
|
||||
|
@ -520,7 +515,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
closeWindow();
|
||||
|
@ -529,7 +524,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
log.info(ex.getLocalizedMessage());
|
||||
Clients.alert(
|
||||
ex.getLocalizedMessage(),
|
||||
Labels.getLabel("editarUsuarioController.window.title"), Messagebox.INFORMATION);
|
||||
Labels.getLabel(TITULO_CONTROLER), Messagebox.INFORMATION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,7 +532,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
try {
|
||||
int resp = Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.borrarPergunta"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
|
||||
if (resp == Messagebox.YES) {
|
||||
|
@ -545,7 +540,7 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarUsuarioController.MSG.borrarOK"),
|
||||
Labels.getLabel("editarUsuarioController.window.title"),
|
||||
Labels.getLabel(TITULO_CONTROLER),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
if (usrAdmin) {
|
||||
|
@ -582,30 +577,36 @@ public class EditarUsuarioController extends MyGenericForwardComposer {
|
|||
Parada parada = (Parada) cbiParada.getValue();
|
||||
PuntoVenta puntoVenta = (PuntoVenta) cbiPuntoVenta.getValue();
|
||||
|
||||
UsuarioUbicacion uu = new UsuarioUbicacion();
|
||||
uu.setActivo(Boolean.TRUE);
|
||||
uu.setFecmodif(Calendar.getInstance().getTime());
|
||||
uu.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
uu.setParada(parada);
|
||||
uu.setPuntoVenta(puntoVenta);
|
||||
uu.setUsuario(usuario);
|
||||
|
||||
UsuarioUbicacion uu = inicializaUsuarioUbicacion(parada, puntoVenta);
|
||||
lsUsuarioUbicacion.add(uu);
|
||||
usuario.getUsuarioUbicacionList().add(uu);
|
||||
ubicacionList.setData(lsUsuarioUbicacion);
|
||||
|
||||
enableAddUbicacion();
|
||||
}
|
||||
}
|
||||
|
||||
protected UsuarioUbicacion inicializaUsuarioUbicacion(Parada parada, PuntoVenta puntoVenta) {
|
||||
UsuarioUbicacion uu = new UsuarioUbicacion();
|
||||
uu.setActivo(Boolean.TRUE);
|
||||
uu.setFecmodif(Calendar.getInstance().getTime());
|
||||
uu.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
uu.setParada(parada);
|
||||
uu.setPuntoVenta(puntoVenta);
|
||||
uu.setUsuario(usuario);
|
||||
return uu;
|
||||
}
|
||||
|
||||
public void onClick$btnRemoverUbicacion(Event ev) {
|
||||
UsuarioUbicacion uu = (UsuarioUbicacion) ubicacionList.getSelected();
|
||||
if (uu != null) {
|
||||
uu.setActivo(Boolean.FALSE);
|
||||
uu.setFecmodif(Calendar.getInstance().getTime());
|
||||
uu.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
lsUsuarioUbicacion.remove(uu);
|
||||
ubicacionList.setData(lsUsuarioUbicacion);
|
||||
for (UsuarioUbicacion usuarioUbicacion : usuario.getUsuarioUbicacionActivoList()) {
|
||||
if (usuarioUbicacion.equals(uu)) {
|
||||
usuarioUbicacion.setActivo(Boolean.FALSE);
|
||||
usuarioUbicacion.setFecmodif(Calendar.getInstance().getTime());
|
||||
usuarioUbicacion.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
lsUsuarioUbicacion.remove(uu);
|
||||
ubicacionList.setData(lsUsuarioUbicacion);
|
||||
}
|
||||
}
|
||||
|
||||
enableAddUbicacion();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class RenderUsuario implements ListitemRenderer {
|
|||
lc = new Listcell(empresasBuilder.toString());
|
||||
lc.setParent(lstm);
|
||||
|
||||
List<UsuarioUbicacion> usuarioUbicacionList = usuario.getUsuarioUbicacionList();
|
||||
List<UsuarioUbicacion> usuarioUbicacionList = usuario.getUsuarioUbicacionActivoList();
|
||||
StringBuilder ubicacionsBuilder = new StringBuilder();
|
||||
if(!usuarioUbicacionList.isEmpty()){
|
||||
|
||||
|
|
Loading…
Reference in New Issue