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. 52
      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

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

@ -37,11 +37,11 @@ import javax.portlet.ActionResponse;
public class AdvancedOperationPortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AdvancedOperationPortlet.class);
public void deleteControlloPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
List<ControlloPratica> controlloPraticaList =
@ -52,24 +52,24 @@ 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);
}
}
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void reindexPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
_log.info("AdvancedOperationPortlet --- Reindexing fascicolo of IntPraticaId " + intPraticaId);
@ -77,23 +77,45 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void cambiaDataInizioLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_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{
@ -172,7 +194,7 @@ 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);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
@ -192,14 +214,14 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse.setRenderParameter("intPraticaId", String.valueOf(intPraticaId));
}
public void fixUserID(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(!AdvancedOperationUtil.evalInt_Dett_UserID(intPratica)){
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastEditableByIntPratica(intPratica.getIntPraticaId());
if(Validator.isNotNull(dettPratica)){
@ -218,7 +240,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", -1L);
IntPratica intPratica = IntPraticaLocalServiceUtil.fetchIntPratica(intPraticaId);
if(WorkflowConstants.STATUS_INCOMPLETE == intPratica.getStatus()){
_log.info("AdvancedOperationPortlet --- Recovering Pratica Vidimata (INCOMPLETE ==> APPROVED) "
+ "with IntPraticaId " + intPraticaId);

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;
@ -279,6 +281,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

@ -7,4 +7,8 @@
#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