@ -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" ) ;