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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 11 years ago
parent b9fcc57b3a
commit dd4632f40a

@ -11,7 +11,9 @@ import com.evolute.utils.sql.Expression;
import com.evolute.utils.sql.Field;
import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import db.data.siprp.outer.EmpresasData;
import db.data.siprp.outer.EstabelecimentosData;
import db.data.siprp.outer.UtilizadoresData;
import db.entidades.Utilizador;
import utils.Global;
@ -107,12 +109,28 @@ public class UtilizadoresDataProvider extends GenericDataProvider
public List< Utilizador > getUtilizadoresListByTipo( Integer tipo, String responsavel_loja, Integer estabelecimento_id )
throws Exception
{
Select selectEmpresa =
new Select2( EstabelecimentosData.TABLENAME,
new Field( EstabelecimentosData.ID_FULL ).isEqual( estabelecimento_id ), EstabelecimentosData.EMPRESA_ID_FULL );
Virtual2DArray array = getExecuter().executeQuery( selectEmpresa );
Integer empresaIds[];
if( array.rowCount() > 0 && array.get( 0, 0 ) != null )
{
empresaIds = new Integer[]{ ( Integer ) array.get( 0, 0 ), Global.SIPRP };
}
else
{
empresaIds = new Integer[]{ Global.SIPRP };
}
List< Utilizador > list = new LinkedList< Utilizador >();
int type = tipo;
Expression where = new Field( UtilizadoresData.ACTIVO_FULL ).isEqual( "y" );
where = where.and( new Field( UtilizadoresData.APAGADO_FULL ).isEqual( "n" ) );
where = where.and( new Field( UtilizadoresData.TIPO_FULL ).isEqual( type ) );
where = where.and( new Field( UtilizadoresData.EMPRESA_ID_FULL ).in( empresaIds ) );
if ( type == Global.RESPONSAVEL_SEGURANCA || type == Global.DIRECTOR_LOJA )
{
where = where.and( new Field( UtilizadoresData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento_id ) );

@ -67,4 +67,5 @@ public class Global
public static final String VALOR_INDETERMINADO = "IND";
public static final int AUCHAN = 32;
public static final int SIPRP = 1;
}

Loading…
Cancel
Save