From 40fcb1e8523d5bd7e631501a622779bb6ad8b1ef Mon Sep 17 00:00:00 2001 From: Carlos Roque Date: Mon, 16 Feb 2015 17:03:18 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@2039 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../FormDirGerRh.java | 18 ++++++++++++---- .../FormDirSiprp.java | 18 ++++++++++++---- .../analiseacidentestrabalho/FormGestor.java | 18 ++++++++++++---- .../src/analiseacidentestrabalho/FormHS.java | 21 ++++++++++++++----- .../providers/EstatisticasDataProvider.java | 5 ++--- .../src/global/Global.java | 3 +-- .../src/utils/Utils.java | 19 ----------------- 7 files changed, 61 insertions(+), 41 deletions(-) diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirGerRh.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirGerRh.java index 24e7376f..2dec6f56 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirGerRh.java +++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirGerRh.java @@ -1306,11 +1306,21 @@ public class FormDirGerRh extends AbstractPageBean fillCurrentYearDrop(); Utils.fillEmpresas( dropEmpresaConc, dropEmpresaSeg ); - Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), - dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); - dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); - dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + if( !siprp ) + { + dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), + dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); + } + else + { + dropEmpresaSeg.setSelected( Global.AUCHAN ); + dropEmpresaConc.setSelected( Global.AUCHAN ); + Utils.fillEstabelecimentos( Global.AUCHAN, dropEstabelecimentosConcluidos, + dropEstabelecimentosSeguimento ); + } fillInitialForm(); diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirSiprp.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirSiprp.java index b89b80de..7f78b01d 100755 --- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirSiprp.java +++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormDirSiprp.java @@ -1231,11 +1231,21 @@ public class FormDirSiprp extends AbstractPageBean fillCurrentYearDrop(); Utils.fillEmpresas( dropEmpresaConc, dropEmpresaSeg ); - Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), - dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); - dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); - dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + if( !siprp ) + { + dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), + dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); + } + else + { + dropEmpresaSeg.setSelected( Global.AUCHAN ); + dropEmpresaConc.setSelected( Global.AUCHAN ); + Utils.fillEstabelecimentos( Global.AUCHAN, dropEstabelecimentosConcluidos, + dropEstabelecimentosSeguimento ); + } fillInitialForm(); diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormGestor.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormGestor.java index 04b39fa5..39bb78f6 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormGestor.java +++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormGestor.java @@ -1259,11 +1259,21 @@ public class FormGestor extends AbstractPageBean fillCurrentYearDrop(); Utils.fillEmpresas( dropEmpresaConc, dropEmpresaSeg ); - Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), - dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); - dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); - dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + if( !siprp ) + { + dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), + dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); + } + else + { + dropEmpresaSeg.setSelected( Global.AUCHAN ); + dropEmpresaConc.setSelected( Global.AUCHAN ); + Utils.fillEstabelecimentos( Global.AUCHAN, dropEstabelecimentosConcluidos, + dropEstabelecimentosSeguimento ); + } fillInitialForm(); fillAnoDropDown(); diff --git a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormHS.java b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormHS.java index 76bb528c..748e28e4 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormHS.java +++ b/trunk/AnaliseAcidentesTrabalho/src/analiseacidentestrabalho/FormHS.java @@ -1524,12 +1524,23 @@ public class FormHS extends AbstractPageBean fillCurrentYearDrop(); Utils.fillEmpresas( dropEmpresaConc, dropEmpresasActuais, dropEmpresaSeg ); - Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), - dropEstabelecimentosConcluidos, dropEstabelecimentosActuais, dropEstabelecimentosSeguimento ); - dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); - dropEmpresasActuais.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); - dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + if( !siprp ) + { + dropEmpresasActuais.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); + Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), + dropEstabelecimentosConcluidos, dropEstabelecimentosActuais, dropEstabelecimentosSeguimento ); + } + else + { + dropEmpresasActuais.setSelected( Global.AUCHAN ); + dropEmpresaSeg.setSelected( Global.AUCHAN ); + dropEmpresaConc.setSelected( Global.AUCHAN ); + Utils.fillEstabelecimentos( Global.AUCHAN, + dropEstabelecimentosConcluidos, dropEstabelecimentosActuais, dropEstabelecimentosSeguimento ); + } fillInitialForm(); fillAnoDropDown(); diff --git a/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java b/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java index 2c1dd200..189db3b0 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java +++ b/trunk/AnaliseAcidentesTrabalho/src/db/providers/EstatisticasDataProvider.java @@ -329,13 +329,12 @@ public class EstatisticasDataProvider extends GenericDataProvider Virtual2DArray array = getLocalExecuter().executeQuery( query ); if ( array != null ) { - options = new Option[ array.rowCount() + 1 ]; - options[ 0 ] = new Option( "", "" ); + options = new Option[ array.rowCount() ]; for ( int i = 0; i < array.rowCount(); i++ ) { Integer empresaID = array.get( i, 0 ); String empresaNome = array.get( i, 1 ); - options[ ( i + 1 ) ] = new Option( empresaID, empresaNome ); + options[i] = new Option( empresaID, empresaNome ); } } return options; diff --git a/trunk/AnaliseAcidentesTrabalho/src/global/Global.java b/trunk/AnaliseAcidentesTrabalho/src/global/Global.java index bd443815..518a9def 100755 --- a/trunk/AnaliseAcidentesTrabalho/src/global/Global.java +++ b/trunk/AnaliseAcidentesTrabalho/src/global/Global.java @@ -58,8 +58,7 @@ public class Global public final static int TIPO_UTILIZADOR_DIRECTOR_LOJA = 9; public final static int TIPO_UTILIZADOR_DIRECTOR_NACIONAL_SEGURANCA = 10; - public final static int AUCHAN = 32; - + public final static int AUCHAN = 32; public final static String ENDERECO_ENVIO = "acidentes.auchan@siprp.pt"; //public final static String ENDERECO_ENVIO = "lluis@evolute.pt"; //testes diff --git a/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java b/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java index e6cd6f74..24a38f17 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java +++ b/trunk/AnaliseAcidentesTrabalho/src/utils/Utils.java @@ -565,25 +565,6 @@ public class Utils { return opts; } - public static void fillEstabelecimentos( DropDown ... drops ) - { - try - { - Option[] estabelecimentos = EstatisticasDataProvider.getInstance().getEstabelecimentos( null ); - if ( estabelecimentos != null ) - { - for ( DropDown drop : drops ) - { - drop.setItems( estabelecimentos ); - } - } - } - catch ( Exception e ) - { - ErrorLogger.logException( e ); - } - } - public static void fillEstabelecimentos( Integer empresaId, DropDown ... drops ) { try