| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetSanityCheckButtonDisplay ( | 
|   internal[WebButton] button | 
| ) id:Method_ApplicationMacroPlanner_SetSanityCheckButtonDisplay | 
| { | 
|   #keys: '[137862.0.600840475]' | 
|   Body: | 
|   [* | 
|     // Update the sanity check button | 
|      | 
|     badgecolor := '' | 
|     tooltips := Translations::MP_SanityCheck_Passed(); | 
|     highestseverity := MacroPlan.SanityCheckHighestSeverity(); | 
|     badge := ''; | 
|     msgcount := MacroPlan.SanityCheckHighestSeverityMsgCount(); | 
|     textcolor := 'White'; | 
|      | 
|     if(  msgcount > 0 ) | 
|     { | 
|       badge := guard( [String]msgcount , '' ); | 
|     } | 
|      | 
|     if( guard( [Number]highestseverity, -1 ) <> 0 ) | 
|     { | 
|       //different color for different most severe violation level | 
|       if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue() ) | 
|       { | 
|         badgecolor := 'Red' | 
|       } | 
|       else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() ) | 
|       { | 
|         badgecolor := 'Purple' | 
|       } | 
|       else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningIssue() ) | 
|       { | 
|         badgecolor := 'Orange' | 
|       } | 
|       else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningWarning() ) | 
|       { | 
|         badgecolor := 'Yellow' | 
|         textcolor := 'Black' | 
|       } | 
|       else if( highestseverity = SanityCheckCategoryLevel::GetSanityCheckCategoryUnclassifiedError() ) | 
|       { | 
|         badgecolor := 'Cyan' | 
|         textcolor := 'Black' | 
|       } | 
|       tooltips := Translations::MP_SanityCheck_Failed( MacroPlan.MostSevereSanityCheckCategoryLevel() ); | 
|     } | 
|                       | 
|     button.Tooltip( tooltips ); | 
|     button.Badge( badge ); | 
|     button.BadgeBackgroundColor( badgecolor ); | 
|     button.BadgeTextColor( textcolor ); | 
|                              | 
|     ApplicationMacroPlanner.SetOptimizerButtonDisplay(); | 
|   *] | 
| } |