diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java index 00ac19ba..20ab159f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/ValidazionePraticaUtil.java @@ -1281,6 +1281,10 @@ public class ValidazionePraticaUtil { || dettPratica.getNormLavoriNoDirettore()) { firme.remove(TipoSoggettoUtil.DIRETTORE_LAVORI); } + + if (intPratica.getTipoProcedura().equals(Constants.PROCEDURA_P9)) { + firme.remove(TipoSoggettoUtil.PROGETTISTA); + } if (intPratica.getTipoProcedura().equals(Constants.PROCEDURA_P10)) { firme.remove(TipoSoggettoUtil.PROGETTISTA); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java index 4465907d..d17b6452 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/mwg/sismica/bo/util/ManutenzioneDatabase.java @@ -45,6 +45,7 @@ import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; import it.tref.liferay.portos.bo.shared.util.UnitaOperativeUtil; import it.tref.liferay.portos.bo.util.AvvisoUtil; import it.tref.liferay.portos.bo.util.Constants; +import it.tref.liferay.portos.bo.util.WorkflowUtil; import it.tref.liferay.portos.mailmanager.model.Email; import it.tref.liferay.portos.mailmanager.model.EmailAttachment; import it.tref.liferay.portos.mailmanager.model.EmailConstants; @@ -65,6 +66,7 @@ import com.liferay.portal.kernel.cache.CacheRegistryUtil; import com.liferay.portal.kernel.cache.MultiVMPoolUtil; import com.liferay.portal.kernel.cache.SingleVMPoolUtil; import com.liferay.portal.kernel.dao.jdbc.DataAccess; +import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; @@ -76,6 +78,12 @@ import com.liferay.portal.kernel.util.StringUtil; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowInstance; import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; +import com.liferay.portal.kernel.workflow.WorkflowLog; +import com.liferay.portal.kernel.workflow.WorkflowLogManager; +import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil; +import com.liferay.portal.kernel.workflow.WorkflowTask; +import com.liferay.portal.kernel.workflow.WorkflowTaskManager; +import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; import com.liferay.portal.model.Company; import com.liferay.portal.model.Contact; import com.liferay.portal.model.EmailAddress; @@ -92,6 +100,7 @@ import com.liferay.portal.model.RoleConstants; import com.liferay.portal.model.SystemEvent; import com.liferay.portal.model.User; import com.liferay.portal.model.UserPersonalSite; +import com.liferay.portal.model.WorkflowInstanceLink; import com.liferay.portal.service.CompanyLocalServiceUtil; import com.liferay.portal.service.ContactLocalServiceUtil; import com.liferay.portal.service.EmailAddressLocalServiceUtil; @@ -106,6 +115,9 @@ import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.SystemEventLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; +import com.liferay.portal.workflow.kaleo.model.KaleoInstance; +import com.liferay.portal.workflow.kaleo.service.KaleoInstanceLocalServiceUtil; import com.liferay.portlet.asset.model.AssetEntry; import com.liferay.portlet.asset.model.AssetTag; import com.liferay.portlet.asset.model.AssetVocabulary; @@ -211,23 +223,55 @@ public class ManutenzioneDatabase { pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); if (pratiche.size() > 0) { for (IntPratica pratica : pratiche) { - int destinazione = 0; - try { - User user = UserLocalServiceUtil.getUser(pratica.getStatusByUserId()); - List uos = UnitaOperativeUtil.getUnitaOperative(user); - for (int uo : uos) { - if (uo > destinazione) { - destinazione = uo; + List controlli = ControlloPraticaLocalServiceUtil + .findByIntPratica(pratica.getIntPraticaId()); + if (controlli.size() > 0) { + ControlloPratica controllo = controlli.get(controlli.size() - 1); + long companyId = controllo.getCompanyId(); + long groupId = controllo.getGroupId(); + List logs = null; + try { + WorkflowInstanceLink workflowInstancelink = WorkflowInstanceLinkLocalServiceUtil + .getWorkflowInstanceLink(companyId, groupId, + ControlloPratica.class.getName(), controllo.getPrimaryKey()); + long workflowInstanceId = workflowInstancelink.getWorkflowInstanceId(); + WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil + .getWorkflowInstance(controllo.getCompanyId(), workflowInstanceId); + List types = new ArrayList<>(); + types.add(WorkflowLog.TASK_ASSIGN); + logs = WorkflowLogManagerUtil.getWorkflowLogsByWorkflowInstance(companyId, + workflowInstanceId, types, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); + } catch (PortalException e) { + logs = new ArrayList<>(); + } + for (WorkflowLog log : logs) { + long userId = log.getUserId(); + if (0 != userId) { + int destinazione = 0; + try { + User user = UserLocalServiceUtil.getUser(userId); + if (Validator.isNotNull(user)) { + List uos = UnitaOperativeUtil.getUnitaOperative(user); + for (int uo : uos) { + if (uo > destinazione) { + destinazione = uo; + } + } + } + } catch (PortalException e) { + } + if ((0 != destinazione) && (destinazione != pratica.getUnitaOperativa())) { + esitoLog( + esito, + "Pratica " + pratica.getNumeroProgetto() + "/" + + pratica.getIntPraticaId() + ", " + + pratica.getUnitaOperativa() + " -> " + destinazione + + " (" + userId + ")"); + pratica.setUnitaOperativa(destinazione); + IntPraticaLocalServiceUtil.updateIntPratica(pratica); + } } } - } catch (PortalException e) { - } - if (destinazione != pratica.getUnitaOperativa()) { - esitoLog(esito, - "Pratica " + pratica.getIntPraticaId() + ", " + pratica.getUnitaOperativa() - + " -> " + destinazione); - pratica.setUnitaOperativa(destinazione); - IntPraticaLocalServiceUtil.updateIntPratica(pratica); } } start += pratiche.size(); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java index 82955e8b..c0982a99 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/service/impl/AsseverazioneLocalServiceImpl.java @@ -162,7 +162,7 @@ public class AsseverazioneLocalServiceImpl extends AsseverazioneLocalServiceBase file = "geologo"; break; case TipoSoggettoUtil.PROGETTISTA: - if (ambitoProfessione.equalsIgnoreCase("architettonico")) { + if (Validator.isNull(ambitoProfessione) || ambitoProfessione.equalsIgnoreCase("architettonico") || ambitoProfessione.equalsIgnoreCase("altro")) { file = "progettista_architettonico"; } else { file = "calcolista"; 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 f7ab63dd..7ba80866 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 @@ -39,11 +39,11 @@ import it.tref.liferay.portos.kaleo.service.FormLogLocalServiceUtil; import java.io.Serializable; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; +import java.util.Set; import java.util.TreeMap; - import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil; import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; @@ -69,7 +69,6 @@ import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil; import com.liferay.portal.kernel.workflow.WorkflowTask; import com.liferay.portal.model.ResourceConstants; -import com.liferay.portal.model.Role; import com.liferay.portal.model.User; import com.liferay.portal.model.UserGroupRole; import com.liferay.portal.service.RoleLocalServiceUtil; @@ -500,38 +499,43 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil .getControlloPratica(controlloPraticaId); - boolean preassegnazione = (0 == IntPraticaLocalServiceUtil.getIntPratica( - controlloPratica.getIntPraticaId()).getUnitaOperativa()); + int unitaOperativa = IntPraticaLocalServiceUtil.getIntPratica(controlloPratica.getIntPraticaId()) + .getUnitaOperativa(); + boolean preassegnazione = (0 == unitaOperativa); long companyId = controlloPratica.getCompanyId(); - long role = RoleLocalServiceUtil.getRole(companyId, + long roleId = RoleLocalServiceUtil.getRole(companyId, preassegnazione ? "portos_assegnatore" : "portos_istruttore").getRoleId(); List userGroupRoles = UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole( - controlloPratica.getGroupId(), role); + controlloPratica.getGroupId(), roleId); - _log.info("preassegnazione=" + preassegnazione + ", roleid=" + role); Map sorted = new TreeMap<>(); - for (UserGroupRole userGroupRole : userGroupRoles) { - User user = userGroupRole.getUser(); - long userId = user.getUserId(); - - if (preassegnazione) { - for (int uo : UnitaOperativeUtil.getUnitaOperative(user)) { - String label = ("U.O. " + uo + ": " + user.getFullName()).toUpperCase(); + if (preassegnazione) { + Set unitaOperative = new HashSet<>(); + for (UserGroupRole userGroupRole : userGroupRoles) { + User user = userGroupRole.getUser(); + unitaOperative.addAll(UnitaOperativeUtil.getUnitaOperative(user)); + } + for (Integer uo : unitaOperative) { + if (0 != uo) { + JSONObject unita = JSONFactoryUtil.createJSONObject(); + unita.put("label", "Unità operativa " + uo); + unita.put("value", "--UO--" + uo); + unita.put("default", false); + sorted.put(String.format("%6d", uo), unita); + } + } + } else { + for (UserGroupRole userGroupRole : userGroupRoles) { + User user = userGroupRole.getUser(); + if (UnitaOperativeUtil.getUnitaOperative(user).contains(unitaOperativa)) { JSONObject istruttore = JSONFactoryUtil.createJSONObject(); - istruttore.put("label", label); - istruttore.put("value", userId); + istruttore.put("label", user.getFullName().toUpperCase()); + istruttore.put("value", user.getUserId()); istruttore.put("default", false); - sorted.put(label, istruttore); + sorted.put((user.getLastName() + user.getFirstName()).toUpperCase(), istruttore); } - } else { - String label = user.getFullName().toUpperCase(); - JSONObject istruttore = JSONFactoryUtil.createJSONObject(); - istruttore.put("label", label); - istruttore.put("value", userId); - istruttore.put("default", false); - sorted.put(label, istruttore); } } @@ -643,15 +647,6 @@ public class ControlloPraticaLocalServiceImpl extends ControlloPraticaLocalServi controlloPratica.setModifiedDate(new Date()); ControlloPratica result = controlloPraticaPersistence.update(controlloPratica); - // Map - // wfContext=WorkflowUtil.getWorkflowContext(controlloPratica); - // wfContext.put("ingloba_variante","Varianti inglobate nel controllo"); - // long - // workflowInstanceId=WorkflowUtil.getWorkflowInstanceId(controlloPratica); - // ServiceContext serviceContext = - // (ServiceContext) wfContext.get("serviceContext"); - // WorkflowInstanceManagerUtil.updateWorkflowContext(controlloPratica.getCompanyId(), - // workflowInstanceId, wfContext); try { WorkflowTask lastTask = WorkflowUtil.getLastTask(controlloPratica.getCompanyId(), controlloPratica.getGroupId(), null, controlloPratica); 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 346b2335..9c1fee1b 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=2833 - build.date=1610446715034 + build.number=2836 + build.date=1610469830245 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp index 832dfe64..970d26a3 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/view.jsp @@ -231,19 +231,7 @@ String keywords = StringPool.BLANK; - - <% Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(intPraticaId); %> - - - - - - - - - - - + <%= intPratica.getTitle(locale,true) %> diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp index 6e3f5961..7986751a 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/view_fascicolo_dettagli.jsp @@ -1133,7 +1133,7 @@
- <%=LanguageUtil.get(pageContext, "geo-sostegno-pendio") %>: + <%=LanguageUtil.get(pageContext, "geo-opere-di-sostegno") %>:
<% String geoOpereDiSostegno = BeanPropertiesUtil.getString(dettPratica, "geoOpereDiSostegno"); %> @@ -1191,6 +1191,46 @@
+
+
+ <%=LanguageUtil.get(pageContext, "geo-rischio-geomorfologico") %>: +
+
+ <% String geoRischioGeomorfologicoPai = BeanPropertiesUtil.getString(dettPratica, "geoRischioGeomorfologicoPai"); %> + + <%= LanguageUtil.get(pageContext, "geo-rischio-geomorfologico-"+geoRischioGeomorfologicoPai) %> + +
+
+ <%=LanguageUtil.get(pageContext, "geo-pericolosita-idraulica-pai") %>: +
+
+ <% String geoPericolositaIdraulicaPai = BeanPropertiesUtil.getString(dettPratica, "geoPericolositaIdraulicaPai"); %> + + <%= LanguageUtil.get(pageContext, "geo-pericolosita-idraulica-pai-"+geoPericolositaIdraulicaPai) %> + +
+
+
+
+ <%=LanguageUtil.get(pageContext, "geo-rischio-idraulico-pai") %>: +
+
+ <% String geoRischioIdraulicoPai = BeanPropertiesUtil.getString(dettPratica, "geoRischioIdraulicoPai"); %> + + <%= LanguageUtil.get(pageContext, "geo-rischio-idraulico-pai-"+geoRischioIdraulicoPai) %> + +
+
+ <%=LanguageUtil.get(pageContext, "geo-presenza-prescrizioni") %>: +
+
+ <% String geoPresenzaPrescrizioni = BeanPropertiesUtil.getString(dettPratica, "geoPresenzaPrescrizioni"); %> + + <%= LanguageUtil.get(pageContext, "geo-presenza-prescrizioni-"+geoPresenzaPrescrizioni) %> + +
+
<%=LanguageUtil.get(pageContext, "geo-fattibilita-sismica") %>: @@ -1231,17 +1271,7 @@
-
-
- <%=LanguageUtil.get(pageContext, "geo-presenza-prescrizioni") %>: -
-
- <% String geoPresenzaPrescrizioni = BeanPropertiesUtil.getString(dettPratica, "geoPresenzaPrescrizioni"); %> - - <%= LanguageUtil.get(pageContext, "geo-presenza-prescrizioni-"+geoPresenzaPrescrizioni) %> - -
-
+
<%=LanguageUtil.get(pageContext, "geo-note-prescrizioni") %>: diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java index 6931e006..967ba906 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailAttachmentPersistenceImpl.java @@ -42,7 +42,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailAttachmentException; import it.tref.liferay.portos.mailmanager.model.EmailAttachment; import it.tref.liferay.portos.mailmanager.model.impl.EmailAttachmentImpl; import it.tref.liferay.portos.mailmanager.model.impl.EmailAttachmentModelImpl; -import it.tref.liferay.portos.mailmanager.service.persistence.EmailAttachmentPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java index 6b806a45..12f7c61e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailPersistenceImpl.java @@ -44,7 +44,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailException; import it.tref.liferay.portos.mailmanager.model.Email; import it.tref.liferay.portos.mailmanager.model.impl.EmailImpl; import it.tref.liferay.portos.mailmanager.model.impl.EmailModelImpl; -import it.tref.liferay.portos.mailmanager.service.persistence.EmailPersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java index b4583674..c7944800 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/mailmanager/service/persistence/EmailTemplatePersistenceImpl.java @@ -46,7 +46,6 @@ import it.tref.liferay.portos.mailmanager.NoSuchEmailTemplateException; import it.tref.liferay.portos.mailmanager.model.EmailTemplate; import it.tref.liferay.portos.mailmanager.model.impl.EmailTemplateImpl; import it.tref.liferay.portos.mailmanager.model.impl.EmailTemplateModelImpl; -import it.tref.liferay.portos.mailmanager.service.persistence.EmailTemplatePersistence; import java.io.Serializable; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties index 5dcc4a5d..513e6b5f 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-mail-manager-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_Mail - build.number=82 - build.date=1607506075611 + build.number=83 + build.date=1610446343471 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java index 87bf9fe2..6a4c7ba4 100644 --- a/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java +++ b/liferay-plugins-sdk-6.2/webs/portos-kaleo-web/docroot/WEB-INF/src/it/tref/liferay/portos/kaleo/hook/struts/EditWorkflowTaskAction.java @@ -1,6 +1,7 @@ package it.tref.liferay.portos.kaleo.hook.struts; import it.tref.liferay.portos.bo.model.ControlloPratica; +import it.tref.liferay.portos.bo.model.IntPratica; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; @@ -13,7 +14,6 @@ import it.tref.liferay.portos.kaleo.util.WorkflowUtil; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; @@ -56,6 +56,8 @@ 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.WorkflowException; +import com.liferay.portal.kernel.workflow.WorkflowInstance; +import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowLog; import com.liferay.portal.kernel.workflow.WorkflowLogManagerUtil; import com.liferay.portal.kernel.workflow.WorkflowTask; @@ -68,14 +70,17 @@ import com.liferay.portal.model.LayoutTypePortlet; import com.liferay.portal.model.Organization; import com.liferay.portal.model.Portlet; import com.liferay.portal.model.User; +import com.liferay.portal.model.WorkflowInstanceLink; import com.liferay.portal.security.auth.PrincipalException; import com.liferay.portal.service.GroupLocalServiceUtil; import com.liferay.portal.service.OrganizationLocalServiceUtil; import com.liferay.portal.service.PortletLocalServiceUtil; +import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.ServiceContextFactory; import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil; +import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import com.liferay.portal.workflow.kaleo.model.KaleoInstance; @@ -86,10 +91,17 @@ import com.liferay.portal.workflow.kaleo.service.KaleoTaskInstanceTokenLocalServ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { private final static Log _log = LogFactoryUtil.getLog(EditWorkflowTaskAction.class); - private final static List valoriAmmessi = Arrays.asList(StatoPraticaConstants.ANNULLATA, - StatoPraticaConstants.CONFORME, StatoPraticaConstants.INTEGRAZIONE, - StatoPraticaConstants.NON_CONFORME, StatoPraticaConstants.NO_PARERE, - StatoPraticaConstants.PREAVVISO_CONTRARIO); + @SuppressWarnings("serial") + private final static List valoriAmmessi = new ArrayList() { + { + add(StatoPraticaConstants.ANNULLATA); + add(StatoPraticaConstants.CONFORME); + add(StatoPraticaConstants.INTEGRAZIONE); + add(StatoPraticaConstants.NON_CONFORME); + add(StatoPraticaConstants.NO_PARERE); + add(StatoPraticaConstants.PREAVVISO_CONTRARIO); + } + }; @Override public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, @@ -158,6 +170,7 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { String transitionName = ParamUtil.getString(actionRequest, "transitionName"); String comment = ParamUtil.getString(actionRequest, "comment"); + boolean aggiorna = true; // ADT: bug mancata problema assegnazione WF checkPresenzaIstruttore(transitionName, workflowTaskId); @@ -185,23 +198,48 @@ public class EditWorkflowTaskAction extends BaseStrutsPortletAction { } else if (transitionName.equalsIgnoreCase("Riassegna") || transitionName.equalsIgnoreCase("assegna")) { HttpServletRequest httpServletRequest = PortalUtil.getOriginalServletRequest(PortalUtil .getHttpServletRequest(actionRequest)); - String istr = httpServletRequest.getParameter("kaleo--istruttore--") != null ? httpServletRequest - .getParameter("kaleo--istruttore--").trim() : StringPool.BLANK; - if (istr.isEmpty()) { + String istruttore = httpServletRequest.getParameter("kaleo--istruttore--"); + if (Validator.isNull(istruttore)) { _log.error("controllo validazione completamento task = " + transitionName + " -" + workflowTaskId + " non riuscito - istruttore non presente nel workflow"); throw new PortalException("controllo validazione completamento task riassegna non riuscito"); } + if (istruttore.startsWith("--UO--")) { + aggiorna = false; + KaleoTaskInstanceToken taskInstanceToken = KaleoTaskInstanceTokenLocalServiceUtil + .getKaleoTaskInstanceToken(workflowTaskId); + if (taskInstanceToken.getClassName().equals(ControlloPratica.class.getName())) { + ControlloPratica controllo = ControlloPraticaLocalServiceUtil + .getControlloPratica(taskInstanceToken.getClassPK()); + IntPratica pratica = IntPraticaLocalServiceUtil + .getIntPratica(controllo.getIntPraticaId()); + long companyId = controllo.getCompanyId(); + long roleId = RoleLocalServiceUtil.getRole(companyId, "portos_assegnatore").getRoleId(); + int uo = Integer.parseInt(istruttore.substring(6)); + WorkflowInstanceLink link = WorkflowInstanceLinkLocalServiceUtil.getWorkflowInstanceLink( + companyId, controllo.getGroupId(), ControlloPratica.class.getName(), + controllo.getPrimaryKey()); + WorkflowInstance instance = WorkflowInstanceManagerUtil.getWorkflowInstance(companyId, + link.getWorkflowInstanceId()); + + pratica.setUnitaOperativa(uo); + IntPraticaLocalServiceUtil.updateIntPratica(pratica); + WorkflowTaskManagerUtil + .assignWorkflowTaskToRole(companyId, taskInstanceToken.getUserId(), + workflowTaskId, roleId, "Trasferito all'UO " + uo + + " per assegnazione all'istruttore", null, + instance.getWorkflowContext()); + } + } } - Map workflowContext = new HashMap(); - - workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); - - WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); - - WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), themeDisplay.getUserId(), - workflowTaskId, transitionName, comment, workflowContext); + if (aggiorna) { + Map workflowContext = new HashMap(); + workflowContext.put(WorkflowConstants.CONTEXT_TRANSITION_NAME, transitionName); + WorkflowUtil.updateWorkflowContextWithTaskFormParameters(actionRequest, workflowContext); + WorkflowTaskManagerUtil.completeWorkflowTask(themeDisplay.getCompanyId(), + themeDisplay.getUserId(), workflowTaskId, transitionName, comment, workflowContext); + } } protected void relaseTask(ActionRequest actionRequest) throws Exception {