Quintiq file version 2.0
#parent: #root
Method UpdateExportStatus (String status, Boolean checkIfDisplayMessageBox) id:Method_LibSOPImpExp_BaseButtonExport_UpdateExportStatus
{
  #keys: '[144528.1.177554795]'
  Body:
  [*
    // Update button enabled state, image and tooltip
    exportObj := this.O_GetExportBase();
    
    // No export object means no export executing (get last exported time & button should be enabled)
    if( isnull( exportObj ) or status = LibSOPImpExp_ImportExportBase::Status_Idle() )
    {
      this.Enabled( true, '' );
      this.Image( 'EXPORT2' );
      this.Tooltip( Translations::LibSOPImpExp_Export_LastExportTime( this.O_GetLastExportTime() ) );
    }
    else if( status = LibSOPImpExp_ImportExportBase::Status_InProgress() )
    {
      // Even if another user performed a successful export, as long as this current user's 
      // export still executing, we display 'in progress'
      this.Enabled( false, '' );
      this.Image( 'PROGRESS_BAR' );
      this.Tooltip( Translations::LibSOPImpExp_Export_InProgress() );
    }
    else if( status = LibSOPImpExp_ImportExportBase::Status_Done() )
    {
      this.Enabled( true, '' );
      this.Image( 'EXPORT2' );
      this.Tooltip( Translations::LibSOPImpExp_Export_LastExportTime( this.O_GetLastExportTime() ) );
      
      // If this method triggered by changes to last exported time (either by current user or other users), we skip display success message
      if( checkIfDisplayMessageBox )
      {
        // On sucess, display notification
        WebMessageBox::Success( Application, exportObj.GetSuccessMessage() );
      }
    }
  *]
}
