Sfoglia il codice sorgente

inizio sviluppo PAO per cambio data fine lavori

feature/pratica-ospedaliera
Marco Alderighi 8 mesi fa
parent
commit
17ac42f295
  1. 27
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  2. 25
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  3. 38
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

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

@ -21,10 +21,13 @@ import it.nextmind.liferay.portos.advanced.operation.util.AdvancedOperationUtil;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica;
import it.tref.liferay.portos.bo.model.FineLavori;
import it.tref.liferay.portos.bo.model.IntPratica;
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.FineLavoriLocalServiceUtil;
import it.tref.liferay.portos.bo.service.FineLavoriServiceUtil;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
@ -117,6 +120,29 @@ public class AdvancedOperationPortlet extends MVCPortlet {
DettPraticaLocalServiceUtil.updateDettPratica(dettPratica);
}
}
public void cambiaDataFineLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
Date dataFineLavori = ParamUtil.getDate(actionRequest, "dataFineLavoriInput",
DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd"), null);
_log.info("AdvancedOperationPortlet --- Changing DataFineLavori on DettPraticas of IntPraticaId" + intPraticaId);
_setDataFineLavori(intPraticaId, dataFineLavori);
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
private void _setDataFineLavori(long intPraticaId, Date dataFineLavori)
throws SystemException {
FineLavori fineLavori = FineLavoriServiceUtil.getLastEditable(intPraticaId);
fineLavori.setDataFineLavori(dataFineLavori);
FineLavoriServiceUtil.updateFineLavori(fineLavori);
}
public void fixNormLavoriInProprio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
@ -188,6 +214,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
_log.info("AdvancedOperationPortlet --- Recovering Pratica Vidimata (INCOMPLETE ==> DRAFT) "
+ "with IntPraticaId " + intPraticaId);
_ripristinaPratica(intPratica, WorkflowConstants.STATUS_DRAFT);
// FIXME: Verificare se va settato lo status dell'ultimo DETTPRATICA a 0
} else {
SessionErrors.add(actionRequest, "operazione-impossibile");
throw new Exception("This Pratica is not in status=5, action RIPRISTINA is not available");

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

@ -24,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.DocPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.FineLavoriLocalServiceUtil;
import it.tref.liferay.portos.bo.service.FineLavoriServiceUtil;
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;
@ -282,6 +283,30 @@ public class AdvancedOperationUtil {
return intPratica.getUserId();
}
public static boolean hasEditableFineLavori(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){
try {
return Validator.isNotNull(
FineLavoriServiceUtil.getLastEditable(intPratica.getIntPraticaId()));
} catch (SystemException e) {
return false;
}
}
return false;
}
public static Date getEditableFineLavoriDate(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){
try {
return FineLavoriServiceUtil.
getLastEditable(intPratica.getIntPraticaId()).getDataFineLavori();
} catch (SystemException e) {
return null;
}
}
return null;
}
public static boolean hasNoFineLavori(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){
try {

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

@ -1,3 +1,4 @@
<%@page import="it.tref.liferay.portos.bo.service.FineLavoriServiceUtil"%>
<%@page import="com.liferay.portal.model.Layout"%>
<%@page import="it.tref.liferay.portos.bo.shared.util.PortletKeys"%>
<%@page import="com.liferay.portal.kernel.util.HtmlUtil"%>
@ -415,6 +416,43 @@
</aui:row>
</liferay-ui:panel>
</div>
<% if(AdvancedOperationUtil.hasEditableFineLavori(intPratica)){ %>
<div class="module-group">
<liferay-ui:panel title="FINE LAVORI" extended="true" collapsible="false">
<aui:row>
<liferay-portlet:actionURL
name="cambiaDataFineLavori"
var="cambiaDataFineLavoriURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionCambiaDataFineLavori = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"cambiaDataFineLavori','Sei sicuro di voler MODIFICARE la DATA di FINE LAVORI?')";
%>
<aui:form action="<%= cambiaDataFineLavoriURL %>" method="post" name="cambiaDataFineLavori">
<div style="display:flex;">
<p><b>Data Fine Lavori:</b></p>
<aui:input
name="dataFineLavoriInput"
label=""
inlineLabel="left"
type="date"
value='<%= DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd").format(AdvancedOperationUtil.getEditableFineLavoriDate(intPratica)) %>'>
</aui:input>
<aui:button
type="button"
cssClass="btn-primary"
name="cambiaDataFineLavoriBtn"
onClick='<%= functionCambiaDataFineLavori %>'
value="Modifica Data"
>
</aui:button>
</div>
</aui:form>
</aui:row>
</liferay-ui:panel>
</div>
<% } %>
<div class="module-group">
<liferay-ui:panel title="IMPERSONAMENTO" extended="true" collapsible="false">
<aui:row>

Caricamento…
Annulla
Salva