Sfoglia il codice sorgente

aggiunta funzionalità per il cambio istruttore su AOP

feature/advanced-operation
marcoalderighi 2 anni fa
parent
commit
617300a4c3
  1. 25
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  2. 39
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

25
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java

@ -4,14 +4,12 @@ import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil; 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.servlet.SessionErrors;
import com.liferay.portal.kernel.util.ParamUtil; import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.util.WebKeys; import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.kernel.workflow.WorkflowTask;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.theme.ThemeDisplay;
import com.liferay.portal.util.PortalUtil; import com.liferay.portal.util.PortalUtil;
@ -26,6 +24,7 @@ import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.util.List; import java.util.List;
@ -120,6 +119,26 @@ public class AdvancedOperationPortlet extends MVCPortlet {
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId)); actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
} }
public void cambiaIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
long istruttoreId = ParamUtil.getLong(actionRequest, "istruttoreId", -1L);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
WorkflowTask lastTask = AdvancedOperationUtil.getLastTask(intPratica);
if (lastTask != null && lastTask.getName().equalsIgnoreCase("Esito")) {
List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
if(!controlloPraticas.isEmpty()){
for(ControlloPratica controlloPratica : controlloPraticas){
if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){
WorkflowUtil.assegnaUltimoTask(intPratica.getCompanyId(), intPratica.getGroupId(),
istruttoreId, themeDisplay.getUserId(), controlloPratica);
}
}
}
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void fixUO(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{ public void fixUO(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
Privati.checkIfUserIsCompanyAdmin(actionRequest); Privati.checkIfUserIsCompanyAdmin(actionRequest);

39
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

@ -420,6 +420,7 @@
<% <%
List<WorkflowTask> listaTask = AdvancedOperationUtil.getListaTask(intPratica); List<WorkflowTask> listaTask = AdvancedOperationUtil.getListaTask(intPratica);
if(Validator.isNotNull(listaTask) && !listaTask.isEmpty()){ if(Validator.isNotNull(listaTask) && !listaTask.isEmpty()){
long currentAssigneeId = AdvancedOperationUtil.getCurrentAssignee(intPratica);
%> %>
<liferay-ui:panel title="GESTIONE ATTIVITÀ" extended="true" collapsible="false"> <liferay-ui:panel title="GESTIONE ATTIVITÀ" extended="true" collapsible="false">
<aui:row> <aui:row>
@ -448,10 +449,9 @@
</div> </div>
</aui:row> </aui:row>
<% <%
if(intPratica.getStatusByUserId() != 0L ){ if(intPratica.getStatusByUserId() >= 0L ){
User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId()); User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (Validator.isNotNull(tecnico)) { if (Validator.isNotNull(tecnico)) {
%> %>
<aui:row> <aui:row>
<div style="display:flex;"> <div style="display:flex;">
@ -469,6 +469,41 @@
url="<%= impersonateIstruttoreURL %>"> url="<%= impersonateIstruttoreURL %>">
</liferay-ui:icon> </liferay-ui:icon>
</div> </div>
<c:if test="<%= AdvancedOperationUtil.evalCurrentAssignee(intPratica, tecnico) %>">
<%
String currentAssigneeName = StringPool.BLANK;
if(currentAssigneeId > 0L){
currentAssigneeName = UserLocalServiceUtil.getUser(currentAssigneeId).getFullName();
}
String cambiaIstruttoreMsg = currentAssigneeId != 0 ? "Pratica attualmente assegnata a " + currentAssigneeName : "Pratica attualmente senza assegnatario";
String cambiaIstruttoreBtnLabelPrefix = currentAssigneeId != 0 ? "Riassegna" : "Assegna";
%>
<div>
<liferay-portlet:actionURL
name="cambiaIstruttore"
var="cambiaIstruttoreURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="istruttoreId" value="<%= String.valueOf(tecnico.getUserId()) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionCambiaIstruttore = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"cambiaIstruttore','Sei sicuro di voler riassegnare la pratica all istruttore?')";
%>
<aui:form action="<%= cambiaIstruttoreURL %>" method="post" name="cambiaIstruttore">
<aui:button
type="button"
cssClass="btn-primary"
name="cambiaIstruttoreBtn"
onClick="<%= functionCambiaIstruttore %>"
value='<%= cambiaIstruttoreBtnLabelPrefix + " Pratica a " + tecnico.getFullName() %>'
>
</aui:button>
<span>
(<%= cambiaIstruttoreMsg %>)
</span>
</aui:form>
</div>
</c:if>
</aui:row> </aui:row>
<% <%
} }

Caricamento…
Annulla
Salva