|
|
|
|
@ -8,17 +8,15 @@ package planosactuacao;
|
|
|
|
|
import com.evolute.utils.error.ErrorLogger;
|
|
|
|
|
import com.evolute.utils.strings.StringPlainer;
|
|
|
|
|
import com.sun.rave.web.ui.appbase.AbstractPageBean;
|
|
|
|
|
|
|
|
|
|
import com.sun.webui.jsf.component.Button;
|
|
|
|
|
|
|
|
|
|
import com.sun.webui.jsf.component.Checkbox;
|
|
|
|
|
import com.sun.webui.jsf.component.DropDown;
|
|
|
|
|
import com.sun.webui.jsf.component.PanelGroup;
|
|
|
|
|
import com.sun.webui.jsf.component.StaticText;
|
|
|
|
|
import com.sun.webui.jsf.component.TextArea;
|
|
|
|
|
import com.sun.webui.jsf.component.TextField;
|
|
|
|
|
|
|
|
|
|
import com.sun.webui.jsf.model.Option;
|
|
|
|
|
|
|
|
|
|
import db.entidades.Area;
|
|
|
|
|
import db.entidades.EstadoMedida;
|
|
|
|
|
import db.entidades.Medida;
|
|
|
|
|
@ -32,12 +30,14 @@ import db.providers.RiscoLogic;
|
|
|
|
|
import db.providers.UtilizadoresDataProvider;
|
|
|
|
|
import db.providers.UtilizadoresLogic;
|
|
|
|
|
import utils.Global;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.ListIterator;
|
|
|
|
|
|
|
|
|
|
import javax.el.MethodExpression;
|
|
|
|
|
import javax.faces.FacesException;
|
|
|
|
|
import javax.faces.component.html.HtmlInputHidden;
|
|
|
|
|
@ -46,10 +46,13 @@ import javax.faces.context.FacesContext;
|
|
|
|
|
import javax.faces.event.ActionEvent;
|
|
|
|
|
import javax.faces.event.MethodExpressionActionListener;
|
|
|
|
|
import javax.faces.event.ValueChangeEvent;
|
|
|
|
|
|
|
|
|
|
import mail.Mail;
|
|
|
|
|
import mail.MailNextPhase;
|
|
|
|
|
import mail.MailNextPhase.RESPONSAVEL_SEGURANCA_TO_DIRECTOR_LOJA;
|
|
|
|
|
|
|
|
|
|
import org.richfaces.component.html.HtmlCalendar;
|
|
|
|
|
|
|
|
|
|
import pagination.Pagina;
|
|
|
|
|
import pagination.Pagination;
|
|
|
|
|
import pagination.PaginationNormais;
|
|
|
|
|
@ -1854,7 +1857,13 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
|
public String butEnviar_action()
|
|
|
|
|
{
|
|
|
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( !checkPermission( p.getFase( ), getSessionBean1().getCurrentUser( ) ) )
|
|
|
|
|
{
|
|
|
|
|
getSessionBean1().setMsg( "N\u00e3o tem permiss\u00e3o para mudar a fase deste plano de atua\u00e7\u00e3o" );
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( planoValidationOk( p ) )
|
|
|
|
|
{
|
|
|
|
|
Risco curValor = getSessionBean1().getCurrentRisco();
|
|
|
|
|
@ -1898,6 +1907,37 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean checkPermission( Integer fase, Utilizador currentUser )
|
|
|
|
|
{
|
|
|
|
|
boolean result = false;
|
|
|
|
|
switch( fase )
|
|
|
|
|
{
|
|
|
|
|
case Global.FASE_SEGURANCA_PREENCHIMENTO: //TODO: OK
|
|
|
|
|
result = currentUser != null &&
|
|
|
|
|
Global.RESPONSAVEL_SEGURANCA == currentUser.getTipo( ) &&
|
|
|
|
|
"y".equals( currentUser.getResponsavel_loja( ) );
|
|
|
|
|
break;
|
|
|
|
|
case Global.FASE_DIR_LOJA_VALIDACAO: //TODO: OK
|
|
|
|
|
result = currentUser != null &&
|
|
|
|
|
Global.DIRECTOR_LOJA == currentUser.getTipo( ) &&
|
|
|
|
|
"y".equals( currentUser.getResponsavel_loja( ) );
|
|
|
|
|
break;
|
|
|
|
|
case Global.FASE_DNS_PARECER: //TODO: OK
|
|
|
|
|
result = currentUser != null &&
|
|
|
|
|
Global.DIRECTOR_NACIONAL_SEGURANCA == currentUser.getTipo( );
|
|
|
|
|
break;
|
|
|
|
|
case Global.FASE_SIPRP_CONCLUSAO: //TODO: OK
|
|
|
|
|
result = currentUser != null &&
|
|
|
|
|
Global.TECNICO_HS == currentUser.getTipo( );
|
|
|
|
|
break;
|
|
|
|
|
case Global.FASE_SIPRP_EMISSAO: //TODO: OK
|
|
|
|
|
result = currentUser != null &&
|
|
|
|
|
Global.TECNICO_HS == currentUser.getTipo( );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean planoValidationOk( PlanoActuacao p )
|
|
|
|
|
{
|
|
|
|
|
boolean ok = true;
|
|
|
|
|
|