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 pagestate.AnaliseAcidenteTrabalhoState;
import pdf.PdfGenerator;
import shst.companydataloaders.SIPRPPropertiesLoader;
import utils.Utils;
/**
@ -11189,9 +11190,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
{
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() )
{
@ -11240,11 +11242,10 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
}
else // edit analise
{
if ( validateDataOcorrencia() )
if ( validateDataOcorrencia( analise ) )
{
if ( fieldsLenOk() )
{
AnaliseAcidente a = fillAnaliseFields();
Acidentado ac = null;
ArrayList recs = null;
@ -12826,9 +12827,9 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
return a;
}
private boolean validateDataOcorrencia()
private boolean validateDataOcorrencia( AnaliseAcidente analise )
{
Date d = getCalDataOcorrencia();
Date d = analise == null ? getCalDataOcorrencia() : analise.getData_acidente();
if ( d == null )
{
getSessionBean1().setMsg( "Falta data da ocorrência!" );
@ -13213,22 +13214,22 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
return false;
}
AnaliseAcidente analise = getSessionBean1().getCurrentAnalise();
int estado = 0;
int estado_assinatura = 0;
if ( getSessionBean1().getCurrentAnalise() == null )
if ( analise == null )
{
estado = Global.ESTADO_SEG;
}
else
{
AnaliseAcidente a = getSessionBean1().getCurrentAnalise();
estado = a.getEstado().intValue();
estado_assinatura = a.getEstado_assinatura().intValue();
estado = analise.getEstado().intValue();
estado_assinatura = analise.getEstado_assinatura().intValue();
}
if ( estado == Global.ESTADO_SEG )
{
if ( ! validateDataOcorrencia() )
if ( ! validateDataOcorrencia( analise ) )
{
return false;
}
@ -15231,11 +15232,15 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
// t.close();
// System.out.println("Email Enviado !!!!" );
// }
private void sendEmailWithPdf( AnaliseAcidente a, String emailTo, String emailFrom, String assunto, String texto_email )
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( "\temailFrom : " + emailFrom );
System.out.println( "\tAnaliseAcidente : " + ( a == null ? "null" : a.getId() ) );
@ -15246,7 +15251,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
Utilizador ut = udp.getUtilizador( a.getTecnico_saude_id() );
Utilizador um = udp.getUtilizador( a.getMedico_id() );
// AnalisesDataProvider adp = new AnalisesDataProvider();
// AnalisesDataProvider adp = new AnalisesDataProvider();
AnalisesDataProvider adp = AnalisesDataProvider.getInstance();
Acidentado ac = adp.getAcidentado( a.getAcidentado_id() );
@ -15289,8 +15294,8 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
props.put( "mail.smtp.user", mail_username );
props.put( "mail.smtp.password", mail_password );
// Authenticator auth = new SMTPAuthenticator();
// Session session = Session.getDefaultInstance(props, auth);
// Authenticator auth = new SMTPAuthenticator();
// Session session = Session.getDefaultInstance(props, auth);
Session session = Session.getDefaultInstance( props );
Message msg = new MimeMessage( session );
@ -15335,6 +15340,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
t.close();
System.out.println( "Email Pdf Enviado !!!! " + emailTo );
}
}
public String butImprimir_action()
{

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