@ -174,22 +174,21 @@ public class AdvancedOperationPortlet extends MVCPortlet {
public void cambiaIstruttore ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
public void cambiaIstruttore ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
ThemeDisplay themeDisplay = ( ThemeDisplay ) actionRequest . getAttribute ( WebKeys . THEME_DISPLAY ) ;
ThemeDisplay themeDisplay = ( ThemeDisplay ) actionRequest . getAttribute ( WebKeys . THEME_DISPLAY ) ;
_log . info ( "== cambiaIstruttore == dentro" ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
long istruttoreId = ParamUtil . getLong ( actionRequest , "istruttoreId" , - 1L ) ;
long istruttoreId = ParamUtil . getLong ( actionRequest , "istruttoreId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
WorkflowTask lastTask = AdvancedOperationUtil . getLastTask ( intPratica ) ;
WorkflowTask lastTask = AdvancedOperationUtil . getLastTask ( intPratica ) ;
if ( lastTask ! = null & & lastTask . getName ( ) . equalsIgnoreCase ( "Esito" ) ) {
if ( lastTask ! = null & & lastTask . getName ( ) . equalsIgnoreCase ( "Esito" ) ) {
_log . info ( "== cambiaIstruttore == lastTask è esito" ) ;
List < ControlloPratica > controlloPraticas = ControlloPraticaLocalServiceUtil . findByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
List < ControlloPratica > controlloPraticas = ControlloPraticaLocalServiceUtil . findByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
if ( ! controlloPraticas . isEmpty ( ) & & Validator . isNotNull ( controlloPraticas . get ( 0 ) ) ) {
if ( ! controlloPraticas . isEmpty ( ) ) {
_log . info ( "== cambiaIstruttore == controlloPratica trovato" ) ;
for ( ControlloPratica controlloPratica : controlloPraticas ) {
_log . info ( "== cambiaIstruttore == istruttoreId: " + istruttoreId ) ;
if ( controlloPratica . getStatus ( ) = = WorkflowConstants . STATUS_PENDING ) {
ControlloPratica controlloPratica = controlloPraticas . get ( 0 ) ;
WorkflowUtil . assegnaUltimoTask ( intPratica . getCompanyId ( ) , intPratica . getGroupId ( ) ,
WorkflowUtil . assegnaUltimoTask ( intPratica . getCompanyId ( ) , intPratica . getGroupId ( ) ,
istruttoreId , themeDisplay . getUserId ( ) , controlloPratica ) ;
istruttoreId , themeDisplay . getUserId ( ) , controlloPratica ) ;
}
}
}
}
}
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
}