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

lxbfYeaa
Diogo Neves 15 years ago
parent eac7fb071d
commit 036775c1a3

@ -9366,7 +9366,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
pg.getChildren().add(st); pg.getChildren().add(st);
} }
@ -9390,7 +9390,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
pg.getChildren().add(st); pg.getChildren().add(st);
} }
@ -9424,7 +9424,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
pg.getChildren().add(st); pg.getChildren().add(st);
st = new StaticText(); st = new StaticText();
@ -9443,7 +9443,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean {
} }
catch(Exception ex) catch(Exception ex)
{ {
ErrorLogger.logException( ex ); // ErrorLogger.logException( ex );
} }
pg.getChildren().add(st); pg.getChildren().add(st);

@ -181,24 +181,30 @@ public class UtilizadoresDataProvider {
{ {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
Statement st = createStatement(); Statement st = createStatement();
String sql = ""; String sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo;
String estabelecimento_constraint = ""; String estabelecimento_constraint = "";
if( tipo != null && ( tipo.intValue() == Global.TIPO_UTILIZADOR_RH || tipo.intValue() == Global.TIPO_UTILIZADOR_SEGURANCA ) ) if( tipo != null && ( tipo.intValue() == Global.TIPO_UTILIZADOR_RH || tipo.intValue() == Global.TIPO_UTILIZADOR_SEGURANCA ) )
{ {
estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id; estabelecimento_constraint = " AND estabelecimento_id = " + estabelecimento_id;
} }
if(responsavel_loja.matches("y")) sql += estabelecimento_constraint;
{
sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint; if ( "y".equals( responsavel_loja ) )
}
else
{ {
sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint; sql += " AND responsavel_loja = 'y'";
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND responsavel_loja = 'y' AND tipo = " + tipo + estabelecimento_constraint;
} }
// else
// {
// sql = "SELECT * FROM utilizadores WHERE activo = 'y' AND apagado = 'n' AND tipo = " + tipo + estabelecimento_constraint;
// }
ResultSet rs = st.executeQuery( sql ); ResultSet rs = st.executeQuery( sql );
rs.first(); // rs.first();
do // do
// {
while ( rs != null && rs.next() )
{ {
Utilizador u = new Utilizador(); Utilizador u = new Utilizador();
u.setId(new Integer(rs.getInt("id"))); u.setId(new Integer(rs.getInt("id")));
@ -218,7 +224,8 @@ public class UtilizadoresDataProvider {
u.setActivo(rs.getString("activo")); u.setActivo(rs.getString("activo"));
u.setResponsavel_loja(rs.getString("responsavel_loja")); u.setResponsavel_loja(rs.getString("responsavel_loja"));
list.add( u ); list.add( u );
}while(rs.next()); }
// }while(rs.next());
return list; return list;
} }

Loading…
Cancel
Save