fixed data ocorrencia verification

git-svn-id: https://svn.coded.pt/svn/SIPRP@1738 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 14 years ago
parent 32528071e8
commit 2501ef1b93

@ -76,6 +76,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.validator.EmailValidator; import org.apache.commons.validator.EmailValidator;
import pagestate.AnaliseAcidenteTrabalhoState; import pagestate.AnaliseAcidenteTrabalhoState;
import pdf.PdfGenerator; import pdf.PdfGenerator;
import shst.companydataloaders.SIPRPPropertiesLoader;
import utils.Utils; import utils.Utils;
/** /**
@ -11189,9 +11190,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
{ {
System.out.println( "BUT GRAVAR" ); System.out.println( "BUT GRAVAR" );
if ( getSessionBean1().getCurrentAnalise() == null ) //new analise AnaliseAcidente analise = getSessionBean1().getCurrentAnalise();
if ( analise == null ) //new analise
{ {
if ( validateDataOcorrencia() ) if ( validateDataOcorrencia( analise ) )
{ {
if ( validationDepartmentSectionOk() ) if ( validationDepartmentSectionOk() )
{ {
@ -11240,11 +11242,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
} }
else // edit analise else // edit analise
{ {
if ( validateDataOcorrencia() ) if ( validateDataOcorrencia( analise ) )
{ {
if ( fieldsLenOk() ) if ( fieldsLenOk() )
{ {
AnaliseAcidente a = fillAnaliseFields(); AnaliseAcidente a = fillAnaliseFields();
Acidentado ac = null; Acidentado ac = null;
ArrayList recs = null; ArrayList recs = null;
@ -12826,9 +12827,9 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
return a; return a;
} }
private boolean validateDataOcorrencia() private boolean validateDataOcorrencia( AnaliseAcidente analise )
{ {
Date d = getCalDataOcorrencia(); Date d = analise == null ? getCalDataOcorrencia() : analise.getData_acidente();
if ( d == null ) if ( d == null )
{ {
getSessionBean1().setMsg( "Falta data da ocorrência!" ); getSessionBean1().setMsg( "Falta data da ocorrência!" );
@ -13213,22 +13214,22 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
return false; return false;
} }
AnaliseAcidente analise = getSessionBean1().getCurrentAnalise();
int estado = 0; int estado = 0;
int estado_assinatura = 0; int estado_assinatura = 0;
if ( getSessionBean1().getCurrentAnalise() == null ) if ( analise == null )
{ {
estado = Global.ESTADO_SEG; estado = Global.ESTADO_SEG;
} }
else else
{ {
AnaliseAcidente a = getSessionBean1().getCurrentAnalise(); estado = analise.getEstado().intValue();
estado = a.getEstado().intValue(); estado_assinatura = analise.getEstado_assinatura().intValue();
estado_assinatura = a.getEstado_assinatura().intValue();
} }
if ( estado == Global.ESTADO_SEG ) if ( estado == Global.ESTADO_SEG )
{ {
if ( ! validateDataOcorrencia() ) if ( ! validateDataOcorrencia( analise ) )
{ {
return false; return false;
} }
@ -15231,11 +15232,15 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
// t.close(); // t.close();
// System.out.println("Email Enviado !!!!" ); // System.out.println("Email Enviado !!!!" );
// } // }
private void sendEmailWithPdf( AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email ) private void sendEmailWithPdf( AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email )
throws Exception throws Exception
{ {
System.out.println( "\nSEND EMAIL WITH PDF" ); boolean isDebug = SIPRPPropertiesLoader.getInstance().findProperty( "debug", false );
System.out.println( "\nAnaliseAcidenteTrabalho . sendEmailWithPdf() : debug ? " + isDebug );
if ( ! isDebug )
{
System.out.println( "\temailTo : " + emailTo ); System.out.println( "\temailTo : " + emailTo );
System.out.println( "\temailFrom : " + emailFrom ); System.out.println( "\temailFrom : " + emailFrom );
System.out.println( "\tAnaliseAcidente : " + ( a == null ? "null" : a.getId() ) ); System.out.println( "\tAnaliseAcidente : " + ( a == null ? "null" : a.getId() ) );
@ -15335,6 +15340,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
t.close(); t.close();
System.out.println( "Email Pdf Enviado !!!! " + emailTo ); System.out.println( "Email Pdf Enviado !!!! " + emailTo );
} }
}
public String butImprimir_action() public String butImprimir_action()
{ {

@ -12,6 +12,8 @@ database.siprp_local = siprp_local_3
username.siprp_local = postgres username.siprp_local = postgres
#password.siprp_local = #password.siprp_local =
debug = false
# tests localhost # tests localhost
#server.siprp = localhost #server.siprp = localhost
@ -25,6 +27,8 @@ username.siprp_local = postgres
#database.siprp_local = siprp_local_3 #database.siprp_local = siprp_local_3
#username.siprp_local = postgres #username.siprp_local = postgres
#password.siprp_local = Typein #password.siprp_local = Typein
#
#debug = true
# tests ws2 # tests ws2
@ -39,3 +43,5 @@ username.siprp_local = postgres
#database.siprp_local = siprp_local_3 #database.siprp_local = siprp_local_3
#username.siprp_local = postgres #username.siprp_local = postgres
#password.siprp_local = Typein #password.siprp_local = Typein
#
#debug = true
Loading…
Cancel
Save