From: <va...@us...> - 2007-09-21 01:58:16
|
Revision: 41 http://opaloerp.svn.sourceforge.net/opaloerp/?rev=41&view=rev Author: vacax Date: 2007-09-20 18:58:18 -0700 (Thu, 20 Sep 2007) Log Message: ----------- Cambios realizados por ustedes ayer. PAX Modified Paths: -------------- OpaloERP/nbproject/genfiles.properties OpaloERP/src/frontend/cliente/DgCrearPais.java OpaloERP/src/frontend/proveedor/DgCrearProveedor.java OpaloERP/src/mensaje_objetos/cliente/Direccion.java OpaloERP/src/modelo_objetos/cliente/ModeloCiudad.java OpaloERP/src/modelo_objetos/cliente/ModeloProvincia.java Modified: OpaloERP/nbproject/genfiles.properties =================================================================== --- OpaloERP/nbproject/genfiles.properties 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/nbproject/genfiles.properties 2007-09-21 01:58:18 UTC (rev 41) @@ -5,4 +5,4 @@ # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=628e4a6e nbproject/build-impl.xml.script.CRC32=84be6d16 -nbproject/build-impl.xml.stylesheet.CRC32=20b9345e +nbproject/build-impl.xml.stylesheet.CRC32=65d7ca21 Modified: OpaloERP/src/frontend/cliente/DgCrearPais.java =================================================================== --- OpaloERP/src/frontend/cliente/DgCrearPais.java 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/src/frontend/cliente/DgCrearPais.java 2007-09-21 01:58:18 UTC (rev 41) @@ -263,7 +263,7 @@ if(clase==ModeloPais.class){ if(mensaje.equals("addPais")){ limpiarCampos(); - Secuencia sec=modelo.getSecuencia(); + //Secuencia sec=modelo.getSecuencia(); paisNuevo=new Pais(); txtCodigo.requestFocus(); @@ -293,7 +293,7 @@ accion=PaisEvent.NUEVO; paisNuevo=new Pais(); setEnabled(true); - Secuencia sec=modelo.getSecuencia(); + // Secuencia sec=modelo.getSecuencia(); txtCodigo.requestFocus(); } Modified: OpaloERP/src/frontend/proveedor/DgCrearProveedor.java =================================================================== --- OpaloERP/src/frontend/proveedor/DgCrearProveedor.java 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/src/frontend/proveedor/DgCrearProveedor.java 2007-09-21 01:58:18 UTC (rev 41) @@ -510,7 +510,12 @@ } else { - direcciones.set(0, dirPrincipal); + if(direcciones.isEmpty()){ + direcciones.add(dirPrincipal); + }else{ + direcciones.set(0, dirPrincipal); + } + } } @@ -531,8 +536,13 @@ p.setContactos(contactos); contactos.add(0, conPrincipal); } - else - contactos.set(0, conPrincipal); + else{ + if(contactos.isEmpty()){ + contactos.add(conPrincipal); + }else{ + contactos.set(0, conPrincipal); + } + } } public void fireDireccion(DireccionEvent direccion) Modified: OpaloERP/src/mensaje_objetos/cliente/Direccion.java =================================================================== --- OpaloERP/src/mensaje_objetos/cliente/Direccion.java 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/src/mensaje_objetos/cliente/Direccion.java 2007-09-21 01:58:18 UTC (rev 41) @@ -45,7 +45,7 @@ this.descripcion = descripcion; } - @OneToOne() + @OneToOne(cascade=CascadeType.PERSIST) @JoinColumn(name="codigo_ciudad") public Ciudad getCiudad() { return ciudad; @@ -55,7 +55,7 @@ this.ciudad = ciudad; } - @OneToOne() + @OneToOne(cascade=CascadeType.PERSIST) @JoinColumn(name="codigo_provincia") public Provincia getProvincia() { return provincia; @@ -65,7 +65,7 @@ this.provincia = provincia; } - @OneToOne() + @OneToOne(cascade=CascadeType.PERSIST) @JoinColumn(name="codigo_pais") public Pais getPais() { return pais; @@ -75,7 +75,7 @@ this.pais = pais; } - @OneToOne() + @OneToOne(cascade=CascadeType.PERSIST) @JoinColumn(name="codigo_region") public Region getRegion() { return region; Modified: OpaloERP/src/modelo_objetos/cliente/ModeloCiudad.java =================================================================== --- OpaloERP/src/modelo_objetos/cliente/ModeloCiudad.java 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/src/modelo_objetos/cliente/ModeloCiudad.java 2007-09-21 01:58:18 UTC (rev 41) @@ -87,7 +87,7 @@ public void addCiudad(Ciudad ciudad){ Session sl=conn.getSession(); Transaction tx=sl.beginTransaction(); - if(!existCiudad(ciudad)){ + if(!existCiudadSession(ciudad,sl)){ sl.save(ciudad); tx.commit(); getSubjectAdd().notify(ModeloCiudad.class,ciudad,"addCiudad"); @@ -107,6 +107,21 @@ } /**Metodo para saber si un grupo esta registrado*/ + private boolean existCiudadSession(Ciudad ciudad,Session ss){ + + String hql="From Ciudad P WHERE P.codigo=?"; + Query q=ss.createQuery(hql); + q.setString(0,ciudad.getCodigo()); + List<Ciudad> lista=q.list(); + if(lista.size()==0){ + return false; + }else{ + return true; + } + + } + + /**Metodo para saber si un grupo esta registrado*/ private boolean existCiudad(Ciudad ciudad){ Session ss=conn.getSession(); String hql="From Ciudad P WHERE P.codigo=?"; Modified: OpaloERP/src/modelo_objetos/cliente/ModeloProvincia.java =================================================================== --- OpaloERP/src/modelo_objetos/cliente/ModeloProvincia.java 2007-09-18 20:46:23 UTC (rev 40) +++ OpaloERP/src/modelo_objetos/cliente/ModeloProvincia.java 2007-09-21 01:58:18 UTC (rev 41) @@ -82,7 +82,7 @@ public void addProvincia(Provincia provincia){ Session sl=conn.getSession(); Transaction tx=sl.beginTransaction(); - if(!existProvincia(provincia)){ + if(!existProvinciaSession(provincia,sl)){ sl.save(provincia); tx.commit(); sl.close(); @@ -117,6 +117,21 @@ } + /**Metodo para saber si un grupo esta registrado*/ + private boolean existProvinciaSession(Provincia provincia,Session ss){ + + String hql="From Provincia P WHERE P.codigo=?"; + Query q=ss.createQuery(hql); + q.setString(0,provincia.getCodigo()); + List<Provincia> lista=q.list(); + if(lista.size()==0){ + return false; + }else{ + return true; + } + + } + /**Metodo para actualizar un grupo*/ public void updateProvincia(Provincia provincia){ Session ss=conn.getSession(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |