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