diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java index 0a3b365b..431eceb3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java @@ -44,7 +44,7 @@ public class AdvancedOperationPortlet extends MVCPortlet { long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L); if (intPraticaId != 0L) { List controlloPraticaList = - ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId); + ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId, WorkflowConstants.STATUS_APPROVED); for(ControlloPratica cp : controlloPraticaList){ _log.info("AdvancedOperationPortlet --- Deleting ControlloPratica " + cp.getControlloPraticaId() + " of IntPraticaId " + intPraticaId); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java index 76b58a90..b5abfedf 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java @@ -22,20 +22,32 @@ import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.shared.util.Constants; +import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; -import java.io.Console; import java.util.ArrayList; import java.util.Date; import java.util.List; public class AdvancedOperationUtil { + public static boolean isNotWorkflowManuallyStarted(IntPratica intPratica){ + switch (intPratica.getStatoPratica()) { + case StatoPraticaConstants.VIDIMATA : + case StatoPraticaConstants.AUTORIZZATA: + case StatoPraticaConstants.CONFORME: + return true; + default: + return false; + } + } + public static boolean hasControlloPratica_ProceduraC(IntPratica intPratica){ if(Constants.PROCEDURA_C.equalsIgnoreCase(intPratica.getTipoProcedura())){ try{ - long intPraticaId = intPratica.getIntPraticaId(); - List controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPraticaId); - return !controlloPraticas.isEmpty(); + long intPraticaId = intPratica.getIntPraticaId(); + List controlloPraticas = + ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPraticaId, WorkflowConstants.STATUS_APPROVED); + return !controlloPraticas.isEmpty(); } catch (SystemException e){ _log.error(e,e); return false; @@ -43,7 +55,7 @@ public class AdvancedOperationUtil { } return false; } - + public static List getListaTask(IntPratica intPratica) { if(Validator.isNull(intPratica)){ return null; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp index 61813f14..579a1c9f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp @@ -242,7 +242,8 @@ <% } %> - <% if(AdvancedOperationUtil.hasControlloPratica_ProceduraC(intPratica)){ %> + <% if(AdvancedOperationUtil.hasControlloPratica_ProceduraC(intPratica) && + AdvancedOperationUtil.isNotWorkflowManuallyStarted(intPratica)){ %>