git-svn-id: https://svn.coded.pt/svn/SIPRP@1459 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Diogo Neves 15 years ago
parent 62965fc541
commit 4f719699e6

@ -7653,12 +7653,12 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
//stDataNascimento.setText(a.getData_nascimento()); //stDataNascimento.setText(a.getData_nascimento());
try try
{ {
java.util.Date ddate = new java.util.Date(a.getData_nascimento().getTime()); java.util.Date ddate = new java.util.Date( a.getData_nascimento().getTime() );
stDataNascimento.setText(utils.Utils.dateToYYYYMMDD(ddate)); stDataNascimento.setText( utils.Utils.dateToYYYYMMDD( ddate ) );
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
stBI.setText(a.getBilhete_identidade()); stBI.setText(a.getBilhete_identidade());
stMorada.setText(a.getMorada()); stMorada.setText(a.getMorada());
@ -7691,15 +7691,17 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
stCodPostal.setText(cod_postal); stCodPostal.setText(cod_postal);
stContactoTelefonico.setText(a.getContacto_telefonico()); stContactoTelefonico.setText(a.getContacto_telefonico());
//stDataAdmissao1.setText(a.getData_admissao()); //stDataAdmissao1.setText(a.getData_admissao());
try try
{ {
java.util.Date ddate = new java.util.Date(a.getData_admissao().getTime()); java.util.Date ddate = new java.util.Date( a.getData_admissao().getTime() );
stDataAdmissao1.setText(utils.Utils.dateToYYYYMMDD(ddate)); stDataAdmissao1.setText( utils.Utils.dateToYYYYMMDD( ddate ) );
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
stFuncao1.setText(a.getFuncao()); stFuncao1.setText(a.getFuncao());
String turno_str = ""; String turno_str = "";
if(a.getTurno() != null) if(a.getTurno() != null)
@ -7744,7 +7746,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
if(a.getData_acidente() != null) if(a.getData_acidente() != null)
{ {
java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime()); java.util.Date ddate = new java.util.Date(a.getData_acidente().getTime());
calDataOcorrencia.setValue(ddate); calDataOcorrencia.setValue( ddate );
} }
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();

@ -669,7 +669,8 @@ public class FichaUtilizador extends AbstractPageBean {
* values submitted with this request. Instead, they represent the * values submitted with this request. Instead, they represent the
* property values that were saved for this view when it was rendered.</p> * property values that were saved for this view when it was rendered.</p>
*/ */
public void init() { public void init()
{
// Perform initializations inherited from our superclass // Perform initializations inherited from our superclass
super.init(); super.init();
// Perform application initialization that must complete // Perform application initialization that must complete
@ -683,34 +684,38 @@ public class FichaUtilizador extends AbstractPageBean {
_init(); _init();
} catch (Exception e) { } catch (Exception e) {
log("FichaUtilizador Initialization Failure", e); log("FichaUtilizador Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e); throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
} }
// </editor-fold> // </editor-fold>
// Perform application initialization that must complete // Perform application initialization that must complete
// *after* managed components are initialized // *after* managed components are initialized
// TODO - add your own initialization code here // TODO - add your own initialization code here
if (!getSessionBean1().isLoggedIn()) { if ( ! getSessionBean1().isLoggedIn() )
try { {
try
{
getExternalContext().redirect("Login.jsp"); getExternalContext().redirect("Login.jsp");
} catch(Exception e) { }
catch (Exception e)
{
// . . . handle exception . . . // . . . handle exception . . .
} }
} }
else else
{ {
FacesContext fc = getFacesContext(); FacesContext fc = getFacesContext();
System.out.println("REQUEST PARAMETERS : " + JSFUtils.requestHasParameters(fc)); System.out.println( "REQUEST PARAMETERS : " + JSFUtils.requestHasParameters( fc ) );
isFromPlanos = false; isFromPlanos = false;
if(JSFUtils.requestHasParameters(fc))
if ( JSFUtils.requestHasParameters( fc ) )
{ {
isFromPlanos = true; isFromPlanos = true;
String user_id = JSFUtils.getRequestParameter(fc, "user"); String user_id = JSFUtils.getRequestParameter(fc, "user");
String mode = JSFUtils.getRequestParameter(fc, "mode"); String mode = JSFUtils.getRequestParameter(fc, "mode");
if(mode != null) if (mode != null)
{ {
if(mode.matches("edit")) if (mode.matches("edit"))
{ {
System.out.println("MODE PARAMETER : " + mode); System.out.println("MODE PARAMETER : " + mode);
getSessionBean1().setModoEdicaoUtilizador("edit"); getSessionBean1().setModoEdicaoUtilizador("edit");
@ -718,100 +723,92 @@ public class FichaUtilizador extends AbstractPageBean {
} }
Utilizador u = null; Utilizador u = null;
try if (user_id != null )
{ {
Integer userId = new Integer(Integer.parseInt(user_id));
System.out.println("USER ID FROM PLANOS : " + user_id);
try try
{ {
Integer userId = new Integer( Integer.parseInt( user_id ) );
System.out.println( "USER ID FROM PLANOS : " + user_id );
UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
//udp.checkConnection(); //udp.checkConnection();
u = udp.getUtilizador(userId); u = udp.getUtilizador( userId );
getSessionBean1().setCurrentUser(u); getSessionBean1().setCurrentUser( u );
}
catch(Exception ex1)
{
ErrorLogger.logException( ex1 );
}
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
} }
}
if ( getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH
if(
getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH
|| getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP ) || getSessionBean1().getCurrentUser().getTipo().intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP )
{ {
lnkGerirUtilizadores.setDisabled(false); lnkGerirUtilizadores.setDisabled( false );
} }
else else
{ {
lnkGerirUtilizadores.setDisabled(true); lnkGerirUtilizadores.setDisabled( true );
} }
HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest(); HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest();
String referer = request.getRequestURI(); String referer = request.getRequestURI();
String pageFrom = Utils.getPageFrom(referer); String pageFrom = Utils.getPageFrom(referer);
if(isFromPlanos) if ( isFromPlanos )
{ {
isPostData = false; isPostData = false;
} }
else else
{ {
if(pageFrom.matches("FichaUtilizador.jsp")) if ( pageFrom.matches( "FichaUtilizador.jsp" ) )
{ {
isPostData = true; isPostData = true;
System.out.println("IS POSTDATA : " + isPostData); System.out.println( "IS POSTDATA : " + isPostData );
} }
} }
if(!isPostData) if ( ! isPostData )
{ {
lblUser.setText(getSessionBean1().getCurrentUser().getLogin());
lblUser.setText( getSessionBean1().getCurrentUser().getLogin() );
UtilizadoresDataProvider udp = new UtilizadoresDataProvider(); UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
AnalisesDataProvider adp = new AnalisesDataProvider(); AnalisesDataProvider adp = new AnalisesDataProvider();
try try
{ {
Integer permissao = udp.getPermissionCode( getSessionBean1().getCurrentUser().getId() ); Integer permissao = udp.getPermissionCode( getSessionBean1().getCurrentUser().getId() );
getSessionBean1().setTiposOptions(adp.getTiposList(permissao)); getSessionBean1().setTiposOptions( adp.getTiposList( permissao ) );
drpTipo.setSelected(new Integer(0)); drpTipo.setSelected( new Integer( 0 ) );
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
} }
try try
{ {
getSessionBean1().setEstabelecimentosOptions(adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false) )); getSessionBean1().setEstabelecimentosOptions(adp.getEstabelecimentosList(getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false)));
System.out.println("ESTABELECIMENTOS OPTIONS : " + getSessionBean1().getEstabelecimentosOptions().length); System.out.println("ESTABELECIMENTOS OPTIONS : " + getSessionBean1().getEstabelecimentosOptions().length);
drpEstabelecimentos.setSelected(new Integer(-1)); drpEstabelecimentos.setSelected(new Integer(-1));
} }
catch(Exception ex) catch (Exception ex)
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException(ex);
} }
} }
else //postData else //postData
{ {
String del_user = (String)getExternalContext().getRequestParameterMap().get("del_user"); String del_user = (String) getExternalContext().getRequestParameterMap().get("del_user");
if(del_user != null) if (del_user != null)
{ {
if(del_user.matches("yes")) if (del_user.matches("yes"))
{ {
hidConfDelUser.setValue(""); hidConfDelUser.setValue("");
try try
{ {
deleteUser(); deleteUser();
} }
catch(Exception ex) catch ( Exception ex )
{ {
ErrorLogger.logException( ex ); ErrorLogger.logException( ex );
getSessionBean1().setMsg("Erro na elimina&ccedil;&atilde;o do utilizador!"); getSessionBean1().setMsg("Erro na elimina&ccedil;&atilde;o do utilizador!");
@ -829,7 +826,7 @@ public class FichaUtilizador extends AbstractPageBean {
// } // }
} }
else if(del_user.matches("no")) else if ( del_user.matches( "no" ) )
{ {
hidConfDelUser.setValue(""); hidConfDelUser.setValue("");
showUser(); showUser();
@ -839,9 +836,6 @@ public class FichaUtilizador extends AbstractPageBean {
} }
} }
} }
/** /**

@ -1148,11 +1148,11 @@ public class UtilizadorFields extends AbstractPageBean {
} }
else else
{ {
UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
try try
{ {
Utilizador u = udp.getUtilizador(login); UtilizadoresDataProvider udp = new UtilizadoresDataProvider();
if(u.getLogin().equals(login)) Utilizador u = udp.getUtilizador( login );
if ( u != null && login.equals( u.getLogin() ) )
{ {
getSessionBean1().setMsg("O utilizador " + login + " já existe!"); getSessionBean1().setMsg("O utilizador " + login + " já existe!");
return false; return false;

@ -1631,17 +1631,21 @@ public class AnalisesDataProvider {
public String getEstabelecimentoNome(Integer estabelecimento_id) throws Exception public String getEstabelecimentoNome( Integer estabelecimento_id ) throws Exception
{ {
Dblocal dblocal = new Dblocal(); Dblocal dblocal = new Dblocal();
dblocal.connect(); dblocal.connect();
Statement stlocal = dblocal.createStatement(); Statement stlocal = dblocal.createStatement();
String sql ="SELECT nome FROM estabelecimentos WHERE id = " + estabelecimento_id; String sql = "SELECT nome FROM estabelecimentos WHERE id = " + estabelecimento_id;
ResultSet rslocal = stlocal.executeQuery(sql); ResultSet rslocal = stlocal.executeQuery( sql );
rslocal.first();
String nome = rslocal.getString("nome"); String nome = "";
if ( rslocal.first() )
{
nome = rslocal.getString( "nome" );
dblocal.close(); dblocal.close();
return Utils.unicodeToHTML(nome); }
return Utils.unicodeToHTML( nome );
} }
public String getMedicoNome(Integer medico_id) throws Exception public String getMedicoNome(Integer medico_id) throws Exception

Loading…
Cancel
Save