|
|
|
|
@ -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() ) );
|
|
|
|
|
@ -15335,6 +15340,7 @@ public class AnaliseAcidenteTrabalho extends AbstractPageBean
|
|
|
|
|
t.close();
|
|
|
|
|
System.out.println( "Email Pdf Enviado !!!! " + emailTo );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String butImprimir_action()
|
|
|
|
|
{
|
|
|
|
|
|