| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetHasValidConversionToBaseUOM ( | 
|   output Strings feedback_o, | 
|   output Strings sanitycheckfb_o | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Returns true if this unit of measure has at least one conversion factor to every other unit of measures.' | 
|   TextBody: | 
|   [* | 
|     isvalid := true; | 
|      | 
|     // Only check conversion from other uoms to default UOM is enough. | 
|     // Meaning we don't check conversion from default UOM to other uoms | 
|     // as well as other uoms to other uoms | 
|      | 
|     if( not this.IsDefault() and not isnull( this.MacroPlan().DefaultUnitOfMeasure() ) ) | 
|     { | 
|       defaultuom := this.MacroPlan().DefaultUnitOfMeasure(); | 
|        | 
|       cf := select( this, AsSourceUnitOfMeasure, cf, | 
|                     cf.TargetUnitOfMeasure() = defaultuom ); | 
|                      | 
|       isvalid := guard( cf.GetIsEnabled(), false ); | 
|                     | 
|       if( not isnull( feedback_o ) and not isvalid ) | 
|       { | 
|         instance := UnitOfMeasure_MP::GetInstanceText( this.Name() ); | 
|         message := Translations::MP_UnitOfMeasure_ViolateHasValidConversionToBaseUOM( defaultuom.Name() ); | 
|         feedback_o.Add( SanityCheckMessage::GetFormattedMessage( instance, message ) ); | 
|         sanitycheckfb_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() ); | 
|       }  | 
|     } | 
|      | 
|     return isvalid; | 
|   *] | 
| } |