compile subroutine quote_intl_fax_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
declare function msg, fieldcount, get_property

$insert logical
$insert msg_equates
$insert popup_equates
$insert company_equ
$insert names_equ

equ valid$         to 0    ;* successful
equ invalid_msg$   to 1    ;* bad data       -   print error message window
equ invalid_conv$  to 2    ;* bad conversion -          "         "
equ invalid_nomsg$ to 3    ;* bad but do not print the error message window
equ CrLf$          to char(13):char(10)

ReturnedValue = DataIo       
status() = Valid$
begin case
   case ConvType = 'ICONV'
      CustID = get_property( @window:'.CUST_NO', 'TEXT' )
      NameID = get_property( @window:'.NAME_NO', 'TEXT' )
		CustPhones = xlate( 'COMPANY', CustID, company_intl_phones$, 'X' )
		NamePhones = xlate( 'NAMES', NameID, names_intl_phone$, 'X' )
		AllPhones = CustPhones:@vm:NamePhones
      locate DataIo in AllPhones using @vm setting Fpos else
	      MsgInfo = ''
	      MsgInfo<mtext$> = quote( DataIo ):' not found for this customer or contact person.'
	      MsgInfo<micon$> = '!'
	      Void = msg( '', MsgInfo )
	      status() = invalid_nomsg$
      end
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
