|  |  | @ -181,25 +181,31 @@ 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 = ""; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if( tipo != null && ( tipo.intValue() == Global.TIPO_UTILIZADOR_RH || tipo.intValue() == Global.TIPO_UTILIZADOR_SEGURANCA ) ) |  |  |  | 		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; |  |  |  |             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"))); | 
			
		
	
		
		
			
				
					
					|  |  |  |             u.setLogin(rs.getString("login")); |  |  |  |             u.setLogin(rs.getString("login")); | 
			
		
	
	
		
		
			
				
					|  |  | @ -217,8 +223,9 @@ public class UtilizadoresDataProvider { | 
			
		
	
		
		
			
				
					
					|  |  |  |             u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id")));  |  |  |  |             u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id")));  | 
			
		
	
		
		
			
				
					
					|  |  |  |             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; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |      | 
			
		
	
	
		
		
			
				
					|  |  | 
 |