Quintiq file version 2.0
#parent: ListSWF_Activity
Response OnClickElement (
  SWF_ActivityBase element
) id:Response_ListSWF_Activity_OnClickElement
{
  #keys: '[113694.2.1202806916]'
  Body:
  [*
    // Open/Close an activity
    isClickCheckbox := guard( this.CurrentColumn().Name(), '' ) = 'imgStatus';
    
    transactionManager := SWF_WorkflowDataset.Service();
    
    if( element.IsExternal() )
    {
      transactionManager.TR_UpdateActivityExternalStatus( element.ID(), 
                                                          element.IsExecutable(), 
                                                          ifexpr( isClickCheckbox, not element.IsCompleted(), element.IsCompleted() ), 
                                                          SWF_WorkflowDataset.GetCurrentUserID(), 
                                                          true /* isRequireIOSync */ );
    }
    else
    {
      transactionManager.TR_UpdateActivityStatus( element.ID(), 
                                                  ifexpr( isClickCheckbox, not element.IsCompleted(), element.IsCompleted() ), 
                                                  SWF_WorkflowDataset.GetCurrentUserID() );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_List_OnClickElement'
  Precondition:
  [*
    return ifexpr( element.IsCompleted(),
                   SWF_WorkflowDataset.GetCurrentUser().CanProcessActivity( feedback, element, SWF_ActivityBase::ACTION_SetToOpen() ),
                   SWF_WorkflowDataset.GetCurrentUser().CanProcessActivity( feedback, element, SWF_ActivityBase::ACTION_SetToClose() ) )
                   or not guard( this.CurrentColumn().Name(), '' ) = 'imgStatus';
  *]
}
