haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Quintiq file version 2.0
#parent: #root
Method UpdateImportStatus (Boolean checkIfDisplayMessageBox) id:Method_LibSOPImpExp_BaseButtonImport_UpdateImportStatus
{
  #keys: '[144528.1.557630242]'
  Body:
  [*
    // Update button enabled state, image and tooltip
    importObj := this.O_GetImportBase();
    
    // No import object means no import executing (get last imported time & button should be enabled)
    if( isnull( importObj ) )
    {
      this.Enabled( true, '' );
      this.Image( 'IMPORT1' );
      this.Tooltip( Translations::LibSOPImpExp_Import_LastImportTime( this.O_GetLastImportTime() ) );
    }
    else if( importObj.Status() = LibSOPImpExp_ImportExportBase::Status_InProgress() )
    {
      // Even if another user performed a successful import, as long as this current user's
      // import still executing, we display 'in progress'
      this.Enabled( false, '' );
      this.Image( 'PROGRESS_BAR' );
      this.Tooltip( Translations::LibSOPImpExp_Import_InProgress() );
    }
    else if(  importObj.Status() = LibSOPImpExp_ImportExportBase::Status_Done() )
    {
      this.Enabled( true, '' );
      this.Image( 'IMPORT1' );
      this.Tooltip( Translations::LibSOPImpExp_Import_LastImportTime( this.O_GetLastImportTime() ) );
    
      // On sucess, display notification
      if( checkIfDisplayMessageBox )
      {
        WebMessageBox::Success( Application, importObj.GetSuccessMessage() );
      }
    }
    else if(  importObj.Status() = LibSOPImpExp_ImportExportBase::Status_Error() )
    {
      this.Enabled( true, '' );
      this.Image( 'IMPORT1' );
      this.Tooltip( Translations::LibSOPImpExp_Import_LastImportTime( this.O_GetLastImportTime() ) );
    
      // If this method triggered by changes to last imported time (either by current user or other users), we skip display error message
      if( checkIfDisplayMessageBox )
      {
        WebMessageBox::Error( Application, importObj.GetErrorMessage() );
      }
    }
  *]
}