Sfoglia il codice sorgente

- fix search container impersonamento

- aggiunto pulsante reset data inizio lavori
feature/fix_soggetti
marcoalderighi 1 anno fa
parent
commit
c64b725639
  1. 30
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  2. 15
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  3. 4
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/css/main.css
  4. 90
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

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

@ -52,11 +52,11 @@ public class AdvancedOperationPortlet extends MVCPortlet {
for(ControlloPratica cp : controlloPraticaList){
if(_log.isDebugEnabled()){
_log.debug("AdvancedOperationPortlet --- Cycling... ControlloPraticaID " + cp.getCompanyId()
+ " Status " + cp.getStatus());
+ " Status " + cp.getStatus());
}
if(ArrayUtil.contains(AdvancedOperationUtil.STATUS_ARRAY, cp.getStatus())){
_log.info("AdvancedOperationPortlet --- Deleting ControlloPratica " + cp.getControlloPraticaId() +
" with Status " + cp.getStatus() +" of IntPraticaId " + intPraticaId);
" with Status " + cp.getStatus() +" of IntPraticaId " + intPraticaId);
ControlloPraticaLocalServiceUtil.deleteControlloPratica(cp);
}
}
@ -83,17 +83,39 @@ public class AdvancedOperationPortlet extends MVCPortlet {
_checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
Date dataInizioLavoriOpera = ParamUtil.getDate(actionRequest, "dataInizioLavoriOperaInput",
DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd"), null);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
_log.info("AdvancedOperationPortlet --- Changing DataInizioLavori on DettPraticas of IntPraticaId" + intPraticaId);
_setDataInizioLavori(intPratica, dataInizioLavoriOpera);
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void resetDataInizioLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(AdvancedOperationUtil.hasNoFineLavori(intPratica)){
_log.info("AdvancedOperationPortlet --- Resetting DataInizioLavori on DettPraticas of IntPraticaId" + intPraticaId);
_setDataInizioLavori(intPratica, null);
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
private void _setDataInizioLavori(IntPratica intPratica, Date dataInizioLavoriOpera)
throws SystemException {
List<DettPratica> dettPraticaListWithInizioLavori = AdvancedOperationUtil.fetchDettPraticaListWithInizioLavori(intPratica);
for(DettPratica dettPratica : dettPraticaListWithInizioLavori){
dettPratica.setDataInizioLavoriOpera(dataInizioLavoriOpera);
dettPratica.setModifiedDate(new Date());
DettPraticaLocalServiceUtil.updateDettPratica(dettPratica);
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void fixNormLavoriInProprio(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{

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

@ -18,10 +18,12 @@ import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
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.shared.util.Constants;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants;
import it.tref.liferay.portos.bo.util.WorkflowUtil;
@ -280,6 +282,19 @@ public class AdvancedOperationUtil {
return intPratica.getUserId();
}
public static boolean hasNoFineLavori(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){
try {
List<FineLavori> fineLavoriList =
FineLavoriLocalServiceUtil.findByIntPraticaId(intPratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
return fineLavoriList.isEmpty();
} catch (SystemException e) {
_log.error(e,e);
}
}
return false;
}
private static List<DettPratica> _getDettPraticaList(long intPraticaId) {
List<DettPratica> dettPraticaList = new ArrayList<DettPratica>();

4
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/css/main.css

@ -8,3 +8,7 @@
#impersonaSoggettiBtn{
cursor: pointer;
}
.aop-ml-5{
margin-left: 5px!important;
}

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

@ -39,6 +39,7 @@
<%@page import="com.liferay.portal.kernel.util.ParamUtil"%>
<%@ include file="/html/init.jsp"%>
<%
long intPraticaId = ParamUtil.getLong(request, "intPraticaId");
String numeroProgetto = ParamUtil.getString(request, "numeroProgetto", StringPool.BLANK);
@ -169,28 +170,51 @@
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionDataInizio = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"cambiaDataInizioLavori','Sei sicuro di voler modificare la DATA di INIZIO LAVORI?')";
String functionChangeDataInizio = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"cambiaDataInizioLavori','Sei sicuro di voler MODIFICARE la DATA di INIZIO LAVORI?')";
%>
<aui:form action="<%= cambiaDataInizioLavoriURL %>" method="post" name="cambiaDataInizioLavori">
<div style="display:flex;">
<div style="display:flex;">
<aui:form action="<%= cambiaDataInizioLavoriURL %>" method="post" name="cambiaDataInizioLavori">
<div style="display:flex;">
<p><b>Data inizio Lavori Opera:</b></p>
<aui:input
name="dataInizioLavoriOperaInput"
label=""
inlineLabel="left"
type="date"
value='<%= DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd").format(dataInizioLavoriOpera) %>'>
</aui:input>
<div>
<aui:button
name="cambiaDataInizioLavoriBtn"
cssClass="btn-primary"
type="button"
value="Cambia"
onClick='<%= functionDataInizio %>'/>
<aui:input
name="dataInizioLavoriOperaInput"
label=""
inlineLabel="left"
type="date"
value='<%= DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd").format(dataInizioLavoriOpera) %>'>
</aui:input>
<div>
<aui:button
name="cambiaDataInizioLavoriBtn"
cssClass="btn-primary aop-ml-5"
type="button"
value="Cambia"
onClick='<%= functionChangeDataInizio %>'/>
</div>
</div>
</div>
</aui:form>
</aui:form>
<c:if test="<%= AdvancedOperationUtil.hasNoFineLavori(intPratica) %>">
<liferay-portlet:actionURL
name="resetDataInizioLavori"
var="resetDataInizioLavoriURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionResetDataInizio = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"resetDataInizioLavori','Sei sicuro di voler RESETTARE la DATA di INIZIO LAVORI?')";
%>
<aui:form action="<%= resetDataInizioLavoriURL %>" method="post" name="resetDataInizioLavori" cssClass="aop-ml-5">
<div>
<aui:button
name="resetDataInizioLavoriBtn"
cssClass="btn-primary"
type="button"
value="Resetta"
onClick='<%= functionResetDataInizio %>'/>
</div>
</aui:form>
</c:if>
</div>
</aui:row>
<% } %>
<aui:row>
@ -433,10 +457,6 @@
total="<%= SoggettoLocalServiceUtil.countByIntPratica(intPraticaId) %>"
/>
<liferay-ui:search-container-row className="it.tref.liferay.portos.bo.model.Soggetto" modelVar="soggetto">
<liferay-security:doAsURL
doAsUserId="<%= soggetto.getUserId() %>"
var="impersonateSoggettoURL">
</liferay-security:doAsURL>
<liferay-ui:search-container-column-text name="RUOLO">
<%= soggetto.getFullTipologiaSoggetto() %>
</liferay-ui:search-container-column-text>
@ -451,14 +471,24 @@
}
%>
</liferay-ui:search-container-column-text>
<%
User soggettoUser =
UserLocalServiceUtil.fetchUserByScreenName(company.getCompanyId(), soggetto.getCodiceFiscale());
%>
<liferay-ui:search-container-column-text name="IMPERSONA" cssClass="text-center text-nowrap">
<liferay-ui:icon
image="impersonate_user"
message="Impersona Soggetto"
target="_blank"
url="<%= impersonateSoggettoURL %>"
>
</liferay-ui:icon>
<c:if test="<%= Validator.isNotNull(soggettoUser) %>">
<liferay-security:doAsURL
doAsUserId="<%= soggettoUser.getUserId() %>"
var="impersonateSoggettoURL">
</liferay-security:doAsURL>
<liferay-ui:icon
image="impersonate_user"
message="Impersona Soggetto"
target="_blank"
url="<%= impersonateSoggettoURL %>"
>
</liferay-ui:icon>
</c:if>
</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator paginate="false" />

Caricamento…
Annulla
Salva