diff --git a/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar b/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar index 75d53c91..48dae296 100644 Binary files a/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar and b/liferay-plugins-sdk-6.2/dist/portos-bo-shared-6.2.0.1.jar differ diff --git a/liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar b/liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar index c8633201..120eec49 100644 Binary files a/liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar and b/liferay-plugins-sdk-6.2/dist/portos-kaleo-shared-6.2.0.1.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar index fdad23ea..9696745c 100644 Binary files a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar and b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar index 84db7712..48dae296 100644 Binary files a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar and b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar index 15a2e3b2..120eec49 100644 Binary files a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar and b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-kaleo-shared.jar differ 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 5023e244..7b647154 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 @@ -2,27 +2,44 @@ package it.nextmind.liferay.portos.advanced.operation.portlet; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.json.JSONArray; +import com.liferay.portal.kernel.json.JSONFactoryUtil; +import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; +import com.liferay.portal.kernel.search.Indexer; +import com.liferay.portal.kernel.search.IndexerRegistryUtil; +import com.liferay.portal.kernel.search.SearchException; import com.liferay.portal.kernel.servlet.SessionErrors; import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.WebKeys; import com.liferay.portal.kernel.workflow.WorkflowConstants; +import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import com.liferay.util.bridges.mvc.MVCPortlet; import it.nextmind.liferay.portos.advanced.operation.util.AdvancedOperationUtil; +import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DocPratica; import it.tref.liferay.portos.bo.model.IntPratica; +import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.util.WorkflowUtil; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; +import javax.portlet.PortletException; +import javax.portlet.RenderRequest; +import javax.portlet.RenderResponse; +import javax.portlet.ResourceRequest; +import javax.portlet.ResourceResponse; public class AdvancedOperationPortlet extends MVCPortlet { private static class Privati { @@ -42,6 +59,27 @@ public class AdvancedOperationPortlet extends MVCPortlet { } } + + @Override + public void serveResource(ResourceRequest resourceRequest, + ResourceResponse resourceResponse) throws IOException, + PortletException { + + String id = resourceRequest.getResourceID(); + if ("brokenUO".equals(id)) { + List brokenUOList = AdvancedOperationUtil.getBrokenUOList(); + + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + for(IntPratica intPratica : brokenUOList){ + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("id", intPratica.getIntPraticaId()); + jsonObject.put("UO", intPratica.getUnitaOperativa()); + jsonObject.put("destUO", AdvancedOperationUtil.getDestinationUO(intPratica)); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); + } + } public void fixStatusPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ @@ -55,6 +93,40 @@ public class AdvancedOperationPortlet extends MVCPortlet { } else { SessionErrors.add(actionRequest, "operazione-impossibile"); } + actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); + } + + public void fixUO(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ + + Privati.checkIfUserIsCompanyAdmin(actionRequest); + + long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L); + IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); + int destinationUO = AdvancedOperationUtil.getDestinationUO(intPratica); + + if (AdvancedOperationUtil.evalUO(intPratica)) { + _setUO(intPratica, destinationUO); + } + + actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); + } + + private void _setUO(IntPratica intPratica, int uo) throws SystemException, SearchException{ + intPratica.setUnitaOperativa(uo); + IntPraticaLocalServiceUtil.updateIntPratica(intPratica); + + Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class); + intPraticaIndexer.reindex(intPratica); + + Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class); + List controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()); + if(!controlloPraticas.isEmpty()){ + for(ControlloPratica controlloPratica : controlloPraticas){ + if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){ + controlloPraticaIndexer.reindex(intPratica); + } + } + } } public void ripristinaPraticaVidimata(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ @@ -66,6 +138,7 @@ public class AdvancedOperationPortlet extends MVCPortlet { if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){ Privati.ripristinaPratica(intPratica, WorkflowConstants.STATUS_DRAFT); + actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); } else { SessionErrors.add(actionRequest, "operazione-impossibile"); throw new Exception("This Pratica is not in status=5, action RIPRISTINA is not available"); @@ -81,6 +154,7 @@ public class AdvancedOperationPortlet extends MVCPortlet { if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){ Privati.ripristinaPratica(intPratica, WorkflowConstants.STATUS_APPROVED); + actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); } else { SessionErrors.add(actionRequest, "operazione-impossibile"); throw new Exception("This Pratica is not in status=5, action RIPRISTINA is not available"); @@ -97,6 +171,7 @@ public class AdvancedOperationPortlet extends MVCPortlet { for(DocPratica docPratica : docPraticaOrfani){ DocPraticaLocalServiceUtil.deleteDocPratica(docPratica); } + actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); } public void findIntPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ 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 4c6e13c6..ab8d1d0a 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 @@ -1,5 +1,6 @@ package it.nextmind.liferay.portos.advanced.operation.util; +import com.liferay.portal.kernel.concurrent.ConcurrentHashSet; import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; @@ -9,9 +10,13 @@ import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; +import com.liferay.portal.model.User; import com.liferay.portal.model.WorkflowInstanceLink; +import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; +import it.mwg.sismica.bo.shared.util.UnitaOperativeUtil; +import it.mwg.sismica.bo.shared.util.UserUtil; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.DocPratica; @@ -21,9 +26,11 @@ import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; +import it.tref.liferay.portos.bo.util.WorkflowUtil; import java.util.ArrayList; import java.util.List; +import java.util.SortedSet; public class AdvancedOperationUtil { private static class P_ { @@ -184,6 +191,97 @@ public class AdvancedOperationUtil { } } + public static long getCurrentAssignee(IntPratica intPratica){ + long currentAssignee = 0; + WorkflowTask lastTask = getLastTask(intPratica); + if(Validator.isNotNull(lastTask)){ + if(it.mwg.sismica.bo.shared.util.WorkflowConstants.WORKFLOW_TASKNAME_ESITO.equalsIgnoreCase(lastTask.getName())){ + currentAssignee = lastTask.getAssigneeUserId(); + } + } + return currentAssignee; + } + + public static WorkflowTask getLastTask(IntPratica intPratica){ + if(Validator.isNotNull(intPratica)){ + try { + List controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId()); + if(!controlloPraticas.isEmpty()){ + for(ControlloPratica controlloPratica : controlloPraticas){ + if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){ + return WorkflowUtil.getLastTask(controlloPratica.getCompanyId(), + controlloPratica.getGroupId(), null, controlloPratica); + } + } + } + }catch (SystemException | PortalException e){ + _log.error(e,e); + } + } + return null; + } + + public static List getBrokenUOList(){ + List brokenUoList = new ArrayList(); + try { + List intPraticasList = IntPraticaLocalServiceUtil.getIntPraticas(QueryUtil.ALL_POS, QueryUtil.ALL_POS); + + for(IntPratica intPratica : intPraticasList){ + if(evalUO(intPratica)){ + brokenUoList.add(intPratica); + } + } + } catch (SystemException e) { + _log.error(e,e); + } + return brokenUoList; + } + + public static boolean evalCurrentAssignee(IntPratica intPratica, User tecnico){ + WorkflowTask lastTask = getLastTask(intPratica); + if(Validator.isNotNull(lastTask) && lastTask.getName().equalsIgnoreCase("Esito")){ + return tecnico.getUserId() != lastTask.getAssigneeUserId() || lastTask.getAssigneeUserId() == 0; + } + return false; + } + + public static boolean evalUO(IntPratica intPratica){ + int uo = intPratica.getUnitaOperativa(); + SortedSet istruttoreUOs = getIstruttoreUOs(intPratica); + if(Validator.isNotNull(istruttoreUOs)){ + return getDestinationUO(intPratica) != uo; + } + return false; + } + + public static int getDestinationUO(IntPratica intPratica){ + int destination = 0; + SortedSet istruttoreUOs = getIstruttoreUOs(intPratica); + if(Validator.isNotNull(istruttoreUOs)){ + for(int uo : istruttoreUOs){ + if (uo > destination) { + destination = uo; + } + } + } + return destination; + } + + public static SortedSet getIstruttoreUOs(IntPratica intPratica){ + WorkflowTask lastTask = getLastTask(intPratica); + if(Validator.isNotNull(lastTask)){ + long assigneeUserId = lastTask.getAssigneeUserId(); + try { + User assignee = UserLocalServiceUtil.getUser(assigneeUserId); + return UserUtil.getUnitaOperative(assignee); + } catch (SystemException | PortalException e){ + _log.error("AOP ==> Error while analyzing IntPratica: " + intPratica.getIntPraticaId()); + _log.error(e,e); + } + } + return null; + } + private static final Log _log = LogFactoryUtil.getLog(AdvancedOperationUtil.class); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/azione_correttiva.jsp b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/azione_correttiva.jsp index d0c0f521..db771b64 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/azione_correttiva.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/azione_correttiva.jsp @@ -1,8 +1,9 @@ +<%@page import="com.liferay.portal.kernel.util.ParamUtil"%> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@include file="/html/init.jsp"%> <% - + long intPraticaId = ParamUtil.getLong(request, "intPraticaId"); %> <%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%> <%@page import="it.tref.liferay.portos.bo.model.DettPratica"%> <%@page import="com.liferay.portal.model.User"%> @@ -33,11 +34,15 @@ <% long intPraticaId = ParamUtil.getLong(request, "intPraticaId"); String numeroProgetto = ParamUtil.getString(request, "numeroProgetto", StringPool.BLANK); + boolean isBrokenUO = ParamUtil.getBoolean(request, "brokenUO", false); + List brokenUOList = null; + if(isBrokenUO){ + brokenUOList = AdvancedOperationUtil.getBrokenUOList(); + } IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId); %> - @@ -77,9 +82,50 @@ + + + + + + + + + + +

+ Numero IntPratica con problemi di Unità Operativa: + <%= brokenUOList.size() %> +

+
+ + + + + <%= scIntPratica.getIntPraticaId() %> + + + <%= scIntPratica.getUnitaOperativa() %> + + + <%= AdvancedOperationUtil.getDestinationUO(scIntPratica) %> + + + + +
+
+
+
+ <% if(Validator.isNotNull(intPratica)){ %> @@ -123,7 +169,10 @@ -

Status: <%= intPratica.getStatus() %>

+

Status: + + (<%= intPratica.getStatus() %>) +

@@ -153,6 +202,30 @@ <% } %> + <% if(AdvancedOperationUtil.evalUO(intPratica)){ %> + + + + + + <% + String functionfixUO = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"fixUO','Sei sicuro di voler cambiare l unita operativa di questa pratica?')"; + %> + + + + + + <% } %> + <% if(AdvancedOperationUtil.isPraticaAnnullata(intPratica)){ %> + <% if(AdvancedOperationUtil.evalUO(intPratica)){ %> +
+ + + +

UO pratica <%= intPratica.getUnitaOperativa() %>

+
+ +

UO istruttore: <%= AdvancedOperationUtil.getDestinationUO(intPratica) %>

+
+
+ + + + + + <% + String functionfixUO = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"fixUO','Sei sicuro di voler cambiare l unita operativa di questa pratica?')"; + %> + + + + + +
+
+ <% } %>
@@ -455,11 +563,54 @@
- + + + +<%-- --%>
+/* +var getBrokenUO = function (url) { + A.io.request(url, { + on: { + success: function () { + var responseData = this.get('responseData'); + var brokenUOList = JSON.parse(responseData); + var brokenUOnum = Object.keys(intPraticaList).length; + A.one('#brokenUOnum').text(brokenUOnum); + + if(0 < brokenUOnum){ + $each(brokenUOList, function(i, value){ + var rowId = createRow(A.one('#brokenUOList'), value.id); + createCol(rowId, 'UO', value.UO); + createCol(rowId, 'UO', value.UO); + createCol(rowId, 'destUO', value.destUO); + }); + }; + }, + }, + }); +}; + +var createRow = function(container, UOid){ + var id = 'brokenUO-'+ UOid ; + container.append(''); + return id; +}; + +var createCol = function(container, colName, colVal){ + container.append('' + + '

'+ colName +': '+ colVal +'

' + + '
'); +}; +A.one('#brokenUOBtn').on('click', function(){ + this.preventDefault(); + var url = this.attr('href'); +// getBrokenUO(url); +}); +*/ <% if(Validator.isNotNull(intPratica)){ %> A.one('#impersonaSoggettiBtn').on('click', function(){ var soggettoDiv = A.one('#sc-soggetti-da-impersonare'); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar index dd6196c4..9696745c 100644 Binary files a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar and b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar differ diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java index a54d7717..2f9cbdc3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalService.java @@ -416,6 +416,9 @@ public interface ControlloPraticaLocalService extends BaseLocalService, long intPraticaId) throws com.liferay.portal.kernel.exception.SystemException; + public int countByIntPratica(long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException; + public java.lang.Long calculateDateAvvioProcedimento( long controlloPraticaId) throws com.liferay.portal.kernel.exception.PortalException, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java index 5ce0c533..04cf39dd 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceClp.java @@ -222,17 +222,21 @@ public class ControlloPraticaLocalServiceClp _methodParameterTypes40 = new String[] { "long" }; - _methodName41 = "calculateDateAvvioProcedimento"; + _methodName41 = "countByIntPratica"; _methodParameterTypes41 = new String[] { "long" }; - _methodName42 = "getOrganizationByControlloPraticaId"; + _methodName42 = "calculateDateAvvioProcedimento"; _methodParameterTypes42 = new String[] { "long" }; - _methodName43 = "getCarichiLavoro"; + _methodName43 = "getOrganizationByControlloPraticaId"; - _methodParameterTypes43 = new String[] { "long", "int" }; + _methodParameterTypes43 = new String[] { "long" }; + + _methodName44 = "getCarichiLavoro"; + + _methodParameterTypes44 = new String[] { "long", "int" }; } @Override @@ -1606,6 +1610,34 @@ public class ControlloPraticaLocalServiceClp return (java.util.List)ClpSerializer.translateOutput(returnObj); } + @Override + public int countByIntPratica(long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { + Object returnObj = null; + + try { + returnObj = _invokableLocalService.invokeMethod(_methodName41, + _methodParameterTypes41, new Object[] { intPraticaId }); + } + catch (Throwable t) { + t = ClpSerializer.translateThrowable(t); + + if (t instanceof com.liferay.portal.kernel.exception.SystemException) { + throw (com.liferay.portal.kernel.exception.SystemException)t; + } + + if (t instanceof RuntimeException) { + throw (RuntimeException)t; + } + else { + throw new RuntimeException(t.getClass().getName() + + " is not a valid exception"); + } + } + + return ((Integer)returnObj).intValue(); + } + @Override public java.lang.Long calculateDateAvvioProcedimento( long controlloPraticaId) @@ -1614,8 +1646,8 @@ public class ControlloPraticaLocalServiceClp Object returnObj = null; try { - returnObj = _invokableLocalService.invokeMethod(_methodName41, - _methodParameterTypes41, new Object[] { controlloPraticaId }); + returnObj = _invokableLocalService.invokeMethod(_methodName42, + _methodParameterTypes42, new Object[] { controlloPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); @@ -1648,8 +1680,8 @@ public class ControlloPraticaLocalServiceClp Object returnObj = null; try { - returnObj = _invokableLocalService.invokeMethod(_methodName42, - _methodParameterTypes42, new Object[] { controlloPraticaId }); + returnObj = _invokableLocalService.invokeMethod(_methodName43, + _methodParameterTypes43, new Object[] { controlloPraticaId }); } catch (Throwable t) { t = ClpSerializer.translateThrowable(t); @@ -1682,8 +1714,8 @@ public class ControlloPraticaLocalServiceClp Object returnObj = null; try { - returnObj = _invokableLocalService.invokeMethod(_methodName43, - _methodParameterTypes43, + returnObj = _invokableLocalService.invokeMethod(_methodName44, + _methodParameterTypes44, new Object[] { controlloPraticaId, giorni }); } catch (Throwable t) { @@ -1796,4 +1828,6 @@ public class ControlloPraticaLocalServiceClp private String[] _methodParameterTypes42; private String _methodName43; private String[] _methodParameterTypes43; + private String _methodName44; + private String[] _methodParameterTypes44; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java index 0082fe81..d0969ec0 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceUtil.java @@ -493,6 +493,11 @@ public class ControlloPraticaLocalServiceUtil { return getService().findByIntPratica(intPraticaId); } + public static int countByIntPratica(long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { + return getService().countByIntPratica(intPraticaId); + } + public static java.lang.Long calculateDateAvvioProcedimento( long controlloPraticaId) throws com.liferay.portal.kernel.exception.PortalException, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java index 90caf44e..345a296d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/service/ControlloPraticaLocalServiceWrapper.java @@ -524,6 +524,12 @@ public class ControlloPraticaLocalServiceWrapper return _controlloPraticaLocalService.findByIntPratica(intPraticaId); } + @Override + public int countByIntPratica(long intPraticaId) + throws com.liferay.portal.kernel.exception.SystemException { + return _controlloPraticaLocalService.countByIntPratica(intPraticaId); + } + @Override public java.lang.Long calculateDateAvvioProcedimento( long controlloPraticaId) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Portal.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Portal.properties index 83733ec6..fa719d4d 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Portal.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/content/Portal.properties @@ -1390,3 +1390,5 @@ note-assegnatore = Note dell'assegnatore note-approvatore = Note dell'approvatore pratica-ospedali = P.R. Ospedaliera +upload = Carica +attach = Allega diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java index a334c4ca..aebac9fd 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/base/ControlloPraticaLocalServiceClpInvoker.java @@ -230,17 +230,21 @@ public class ControlloPraticaLocalServiceClpInvoker { _methodParameterTypes227 = new String[] { "long" }; - _methodName228 = "calculateDateAvvioProcedimento"; + _methodName228 = "countByIntPratica"; _methodParameterTypes228 = new String[] { "long" }; - _methodName229 = "getOrganizationByControlloPraticaId"; + _methodName229 = "calculateDateAvvioProcedimento"; _methodParameterTypes229 = new String[] { "long" }; - _methodName230 = "getCarichiLavoro"; + _methodName230 = "getOrganizationByControlloPraticaId"; - _methodParameterTypes230 = new String[] { "long", "int" }; + _methodParameterTypes230 = new String[] { "long" }; + + _methodName231 = "getCarichiLavoro"; + + _methodParameterTypes231 = new String[] { "long", "int" }; } public Object invokeMethod(String name, String[] parameterTypes, @@ -506,16 +510,21 @@ public class ControlloPraticaLocalServiceClpInvoker { if (_methodName228.equals(name) && Arrays.deepEquals(_methodParameterTypes228, parameterTypes)) { - return ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(((Long)arguments[0]).longValue()); + return ControlloPraticaLocalServiceUtil.countByIntPratica(((Long)arguments[0]).longValue()); } if (_methodName229.equals(name) && Arrays.deepEquals(_methodParameterTypes229, parameterTypes)) { - return ControlloPraticaLocalServiceUtil.getOrganizationByControlloPraticaId(((Long)arguments[0]).longValue()); + return ControlloPraticaLocalServiceUtil.calculateDateAvvioProcedimento(((Long)arguments[0]).longValue()); } if (_methodName230.equals(name) && Arrays.deepEquals(_methodParameterTypes230, parameterTypes)) { + return ControlloPraticaLocalServiceUtil.getOrganizationByControlloPraticaId(((Long)arguments[0]).longValue()); + } + + if (_methodName231.equals(name) && + Arrays.deepEquals(_methodParameterTypes231, parameterTypes)) { return ControlloPraticaLocalServiceUtil.getCarichiLavoro(((Long)arguments[0]).longValue(), ((Integer)arguments[1]).intValue()); } @@ -613,4 +622,6 @@ public class ControlloPraticaLocalServiceClpInvoker { private String[] _methodParameterTypes229; private String _methodName230; private String[] _methodParameterTypes230; + private String _methodName231; + private String[] _methodParameterTypes231; } \ No newline at end of file diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java index c492bd86..a43b4126 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/ControlloPraticaLocalServiceImpl.java @@ -688,6 +688,12 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi return controlloPraticaPersistence.findByIntPraticaId(intPraticaId); } + + @Override + public int countByIntPratica(long intPraticaId) throws SystemException { + + return controlloPraticaPersistence.countByIntPraticaId(intPraticaId); + } @Override public Long calculateDateAvvioProcedimento(long controlloPraticaId) throws SystemException, PortalException { diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java index 367eccee..e7baee7e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/IntPraticaLocalServiceImpl.java @@ -941,42 +941,45 @@ public class IntPraticaLocalServiceImpl extends IntPraticaLocalServiceBaseImpl { SystemException { ControlloPratica controlloPratica = controlloPraticaLocalService.getControlloPratica(controlloPraticaId); - IntPratica intPratica = getIntPratica(intPraticaId); - intPratica.setStatusByUserId(istruttoreId); - intPratica.setStatusDate(new Date()); - User istruttore = userLocalService.getUser(istruttoreId); - intPratica.setUnitaOperativa(UserUtil.getUnitaOperative(istruttore).last()); - intPratica = updateIntPratica(intPratica); - DettPratica dettPratica = dettPraticaLocalService.getLastCompletedByIntPratica(intPraticaId); - User user = PermissionThreadLocal.getPermissionChecker().getUser(); - ServiceContext serviceContext = new ServiceContext(); - serviceContext.setUserId(user.getUserId()); - serviceContext.setScopeGroupId(controlloPratica.getGroupId()); - serviceContext.setCompanyId(controlloPratica.getCompanyId()); - String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( - StatoPraticaConstants.CAMBIO_ISTRUTTORE); - long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), - propertiesTemplate); - avvisoLocalService.addAvviso(intPraticaId, StringPool.BLANK, new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, - StatoPraticaConstants.CAMBIO_ISTRUTTORE, fileEntryIdTemplate, dettPratica.getDettPraticaId(), - DettPratica.class.getName(), StringPool.BLANK, 0L, 0L, StringPool.BLANK, controlloPraticaId, - serviceContext); WorkflowTask lastTask = WorkflowUtil.getLastTask(controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null, controlloPratica); - if (lastTask != null && lastTask.getName().equalsIgnoreCase("Esito")) { - WorkflowUtil.assegnaUltimoTask(controlloPratica.getCompanyId(), controlloPratica.getGroupId(), - istruttoreId, user.getUserId(), controlloPratica); - } - String jsonFormParameters = null; - Map parametri = new HashMap(); - parametri.put("istruttore", String.valueOf(istruttoreId)); - JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); - jsonFormParameters = jsonSerializer.serialize(parametri); - try { - FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0L, "cambio-istruttore", - jsonFormParameters, serviceContext); - } catch (Exception e) { - _log.error(e, e); + if(lastTask.getName().equalsIgnoreCase("assegnazione")){ + + IntPratica intPratica = getIntPratica(intPraticaId); + intPratica.setStatusByUserId(istruttoreId); + intPratica.setStatusDate(new Date()); + User istruttore = userLocalService.getUser(istruttoreId); + intPratica.setUnitaOperativa(UserUtil.getUnitaOperative(istruttore).last()); + intPratica = updateIntPratica(intPratica); + DettPratica dettPratica = dettPraticaLocalService.getLastCompletedByIntPratica(intPraticaId); + User user = PermissionThreadLocal.getPermissionChecker().getUser(); + ServiceContext serviceContext = new ServiceContext(); + serviceContext.setUserId(user.getUserId()); + serviceContext.setScopeGroupId(controlloPratica.getGroupId()); + serviceContext.setCompanyId(controlloPratica.getCompanyId()); + String propertiesTemplate = AvvisoUtil.getAllTipoDocumentoFileTemplateProps().get( + StatoPraticaConstants.CAMBIO_ISTRUTTORE); + long fileEntryIdTemplate = configurazioneLocalService.findByC_ChiaveLong(serviceContext.getCompanyId(), + propertiesTemplate); + avvisoLocalService.addAvviso(intPraticaId, StringPool.BLANK, new Date(), AvvisoUtil.TIPO_AVVISO_DIRETTO, + StatoPraticaConstants.CAMBIO_ISTRUTTORE, fileEntryIdTemplate, dettPratica.getDettPraticaId(), + DettPratica.class.getName(), StringPool.BLANK, 0L, 0L, StringPool.BLANK, controlloPraticaId, + serviceContext); + if (lastTask != null && lastTask.getName().equalsIgnoreCase("Esito")) { + WorkflowUtil.assegnaUltimoTask(controlloPratica.getCompanyId(), controlloPratica.getGroupId(), + istruttoreId, user.getUserId(), controlloPratica); + } + String jsonFormParameters = null; + Map parametri = new HashMap(); + parametri.put("istruttore", String.valueOf(istruttoreId)); + JSONSerializer jsonSerializer = JSONFactoryUtil.createJSONSerializer(); + jsonFormParameters = jsonSerializer.serialize(parametri); + try { + FormLogLocalServiceUtil.addFormLog(lastTask.getWorkflowInstanceId(), 0L, "cambio-istruttore", + jsonFormParameters, serviceContext); + } catch (Exception e) { + _log.error(e, e); + } } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index 65c29336..131803d2 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=3665 - build.date=1683533611843 + build.number=3666 + build.date=1684145442317 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp index 8552a3b0..ec1459aa 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/action_button.jsp @@ -98,22 +98,24 @@ long territorioGroupId = territorio.getGroupId(); } %> - - - - - - - -
- -
+ + + + + + + + +
+ +
+