fixed bug #7984
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@61939 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
804d51da7e
commit
93abef2f6c
|
@ -27,11 +27,13 @@ import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa;
|
|||
import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.MensajeUsuario;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.MensajeEmpresaService;
|
||||
import com.rjconsultores.ventaboletos.service.MensajePuntaVentaService;
|
||||
import com.rjconsultores.ventaboletos.service.MensajeService;
|
||||
import com.rjconsultores.ventaboletos.service.MensajeUsuarioService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMensajeEmpresa;
|
||||
|
@ -52,6 +54,8 @@ public class EditarMensajeController extends MyGenericForwardComposer {
|
|||
private MensajeUsuarioService mensajeUsuarioService;
|
||||
@Autowired
|
||||
private MensajeService mensajeService;
|
||||
@Autowired
|
||||
private EmpresaService empresaService;
|
||||
|
||||
private Mensaje mensaje;
|
||||
private Datebox txtDataInicial;
|
||||
|
@ -75,10 +79,11 @@ public class EditarMensajeController extends MyGenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
|
||||
busquedaMensajeController = (BusquedaMensajeController) Executions.getCurrent().getArg().get("busquedaMensajeController");
|
||||
|
||||
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
lsEmpresa.add(getEmpresaTodas());
|
||||
|
||||
mensajeEmpresaToUpdate = new ArrayList<MensajeEmpresa>();
|
||||
mensajePuntoVentasToUpdate = new ArrayList<MensajePuntoVenta>();
|
||||
|
||||
|
@ -111,6 +116,10 @@ public class EditarMensajeController extends MyGenericForwardComposer {
|
|||
puntoVentaList.setData(lsAddPuntoVenta);
|
||||
}
|
||||
|
||||
private Empresa getEmpresaTodas() {
|
||||
return empresaService.obtenerID(-1);
|
||||
}
|
||||
|
||||
public void onClick$btnSalvar(Event ev) throws InterruptedException, ParseException {
|
||||
txtDataFinal.getValue();
|
||||
txtDataInicial.getValue();
|
||||
|
@ -119,6 +128,8 @@ public class EditarMensajeController extends MyGenericForwardComposer {
|
|||
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
|
||||
Date dataAtual = format.parse(format.format(new Date()));
|
||||
|
||||
validarListaTodos();
|
||||
|
||||
if (mensaje.getMensajeId() == null &&
|
||||
mensaje.getFecFin().before(dataAtual)) {
|
||||
Messagebox.show(
|
||||
|
@ -186,6 +197,35 @@ public class EditarMensajeController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
|
||||
private void validarListaTodos() {
|
||||
MensajeEmpresa empresaTodas = null;
|
||||
|
||||
for (MensajeEmpresa empresa : lsAddEmpresa) {
|
||||
if (empresa.getEmpresa().getEmpresaId().equals(-1)) {
|
||||
empresaTodas = empresa;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empresaTodas != null) {
|
||||
lsAddEmpresa.clear();
|
||||
lsAddEmpresa.add(empresaTodas);
|
||||
}
|
||||
|
||||
MensajePuntoVenta puntoVentaTodas = null;
|
||||
|
||||
for(MensajePuntoVenta puntoVenta : lsAddPuntoVenta){
|
||||
if(puntoVenta.getPuntoVenda().getPuntoventaId().equals(-1)){
|
||||
puntoVentaTodas = puntoVenta;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(puntoVentaTodas != null){
|
||||
lsAddPuntoVenta.clear();
|
||||
lsAddPuntoVenta.add(puntoVentaTodas);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick$btnApagar(Event ev) throws InterruptedException {
|
||||
try {
|
||||
int opcao = Messagebox.show(
|
||||
|
|
Loading…
Reference in New Issue