Sfoglia il codice sorgente

- aggiunta cambio assegnatario pratica

- aggiunta impersonamento assegnatario
feature/fix_soggetti
marcoalderighi 2 anni fa
parent
commit
c1d32248ab
  1. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar
  2. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar
  3. BIN
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-report-shared.jar
  4. 24
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  5. 39
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  6. 66
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-bo-shared.jar

File binario non mostrato.

BIN
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/lib/portos-report-shared.jar

File binario non mostrato.

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

@ -11,6 +11,7 @@ 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;
@ -24,8 +25,8 @@ 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.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -170,6 +171,27 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void cambiaIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
_log.info("== cambiaIstruttore == dentro");
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")) {
_log.info("== cambiaIstruttore == lastTask è esito");
List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
if(!controlloPraticas.isEmpty() && Validator.isNotNull(controlloPraticas.get(0))){
_log.info("== cambiaIstruttore == controlloPratica trovato");
_log.info("== cambiaIstruttore == istruttoreId: "+istruttoreId);
ControlloPratica controlloPratica = controlloPraticas.get(0);
WorkflowUtil.assegnaUltimoTask(intPratica.getCompanyId(), intPratica.getGroupId(),
istruttoreId, themeDisplay.getUserId(), controlloPratica);
}
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void ripristinaPraticaConforme(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{

39
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java

@ -11,6 +11,7 @@ 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.WorkflowInstanceLinkLocalServiceUtil;
@ -23,6 +24,7 @@ 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 it.tref.liferay.portos.bo.util.WorkflowUtil;
import java.util.ArrayList;
import java.util.Date;
@ -43,7 +45,7 @@ public class AdvancedOperationUtil {
return false;
}
}
public static boolean hasControlloPratica_ProceduraC(IntPratica intPratica){
if(Constants.PROCEDURA_C.equalsIgnoreCase(intPratica.getTipoProcedura())){
try{
@ -156,6 +158,41 @@ public class AdvancedOperationUtil {
}
return false;
}
public static long getCurrentAssignee(IntPratica intPratica){
long currentAssignee = 0;
WorkflowTask lastTask = getLastTask(intPratica);
if(Validator.isNotNull(lastTask)){
if(it.tref.liferay.portos.bo.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<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
if(!controlloPraticas.isEmpty() && Validator.isNotNull(controlloPraticas.get(0))){
ControlloPratica controlloPratica = controlloPraticas.get(0);
return WorkflowUtil.getLastTask(controlloPratica.getCompanyId(),
controlloPratica.getGroupId(), null, controlloPratica);
}
}catch (SystemException | PortalException e){
_log.error(e,e);
}
}
return null;
}
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 List<DettPratica> fetchDettPraticaListWithInizioLavori(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){

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

@ -127,7 +127,11 @@
</aui:row>
<aui:row>
<aui:col span="2">
<p><b>Status:</b> <%= intPratica.getStatus() %></p>
<p>
<b>Status:</b>
<aui:workflow-status status="<%= intPratica.getStatus() %>"></aui:workflow-status>
(<%= intPratica.getStatus() %>)
</p>
</aui:col>
</aui:row>
<%
@ -420,6 +424,7 @@
<%
List<WorkflowTask> listaTask = AdvancedOperationUtil.getListaTask(intPratica);
if(Validator.isNotNull(listaTask) && !listaTask.isEmpty()){
long currentAssigneeId = AdvancedOperationUtil.getCurrentAssignee(intPratica);
%>
<liferay-ui:panel title="GESTIONE ATTIVITÀ" extended="true" collapsible="false">
<aui:row>
@ -447,6 +452,25 @@
</div>
</div>
</aui:row>
<c:if test="<%= currentAssigneeId != 0L %>">
<aui:row>
<div style="display:flex;">
<liferay-security:doAsURL
doAsUserId="<%= currentAssigneeId %>"
var="impersonateAssigneeURL">
</liferay-security:doAsURL>
<div style=" margin-right: 15px;">
<p><b>Impersona Assegnatario Workflow:</b></p>
</div>
<liferay-ui:icon
image="team_icon"
target="_blank"
message="Impersona Assegnatario"
url="<%= impersonateAssigneeURL %>">
</liferay-ui:icon>
</div>
</aui:row>
</c:if>
<%
if(intPratica.getStatusByUserId() != 0L ){
User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
@ -469,6 +493,41 @@
url="<%= impersonateIstruttoreURL %>">
</liferay-ui:icon>
</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 " + tecnico.getFullName() + " ?')";
%>
<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>
<%
}
@ -565,11 +624,8 @@
<div id ='<%= renderResponse.getNamespace()+"confirmationModal" %>'>
</div>
<div id ='<%= renderResponse.getNamespace()+"confirmationModalDiv" %>' class="hide" style="display:block;">
</div>
<aui:script use="event-valuechange,aui-modal,aui-io-request">
<% if(Validator.isNotNull(intPratica)){ %>
@ -649,7 +705,5 @@
modal.show();
}
);
</aui:script>

Caricamento…
Annulla
Salva