project QadFinancials > class BBusinessRelation > method ValidateAvaAddress


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBusinessRelation.ValidateComponentExternalAddress


program code (program1/bbusinessrelation.p)

      
for each tBusRelAvaReturnAddress:

        /* doing find first on address here as updating in both the if and else */
        find first t_sAddress where STRING(t_sAddress.Address_ID)= tBusRelAvaReturnAddress.tcAddressCode exclusive-lock no-error.
    
        find first tBusRelAvaReturnMessage where tBusRelAvaReturnAddress.tcAddressCode = tBusRelAvaReturnMessage.tcMsgAddressCode no-lock no-error.
        
        if available tBusRelAvaReturnMessage
        then do:
            assign vcMessage = trim(substitute(#T-22'Avatax address validation failed for [&1]':90(308607748)T-22#, tBusRelAvaReturnMessage.tcMsgAddressKeyFields)) + chr(10) +
                                                    tBusRelAvaReturnMessage.tcMsgSummary + ' [' + 
                                                    tBusRelAvaReturnMessage.tcMsgRefersTo + ']' + chr(10) +
                                                    tBusRelAvaReturnMessage.tcMsgDetails.

            oiReturnStatus = 1.                              
            <M-86 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  '':U (icFieldName), 
                    input  '':U (icFieldValue), 
                    input  'W':U (icType), 
                    input  3 (iiSeverity), 
                    input  '':U (icRowid), 
                    input  'qadfin-534043':U (icFcMsgNumber), 
                    input  '':U (icFcExplanation), 
                    input  '':U (icFcIdentification), 
                    input  '':U (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation> 
                    
            if available t_sAddress then
                assign
                    t_sAddress.AddressExternalValidationCode = {&AVATAXVALIDATIONCODE-NOTVALID}.
        end.
        else do:

                
                if available t_sAddress
                then do:
                       
                        if (trim(tBusRelAvaReturnAddress.tcLine1) <> trim(t_sAddress.AddressStreet1) or
                            trim(tBusRelAvaReturnAddress.tcLine2) <> trim(t_sAddress.AddressStreet2) or
                            trim(tBusRelAvaReturnAddress.tcLine3) <> trim(t_sAddress.AddressStreet3) or
                            trim(tBusRelAvaReturnAddress.tcPostalCode) <> trim(t_sAddress.AddressZip) or
                            trim(tBusRelAvaReturnAddress.tcCity) <> trim(t_sAddress.AddressCity) or
                            trim(tBusRelAvaReturnAddress.tcRegion) <> trim(t_sAddress.tcStateCode) or
                            trim(tBusRelAvaReturnAddress.tcCountry) <> trim(t_sAddress.tcCountryCode)) 
                        then do:
                            assign vcMessage           = trim(#T-35'Avatax has validated this address and found amendments that you may want to apply':255(828668025)T-35#).
        
                             assign vcMessage = vcMessage + chr(10) + 
                                               trim(#T-80'Address Line 1':20(53222)T-80#) + chr(9) + chr(9) + 
                                                               t_sAddress.AddressStreet1 + ' --> ' + tBusRelAvaReturnAddress.tcLine1 + chr(10) + 
                                               trim(#T-14'Address Line 2':20(73460068)T-14#) + chr(9) + chr(9) + 
                                                              t_sAddress.AddressStreet2 + ' --> ' + tBusRelAvaReturnAddress.tcLine2  + chr(10) + 
                                               trim(#T-34'Address Line 3':20(413952375)T-34#) + chr(9) + chr(9) + 
                                                               t_sAddress.AddressStreet3 + ' --> ' + tBusRelAvaReturnAddress.tcLine3  + chr(10) + 
                                               trim(#T-56'Zip':5(64963)T-56#)+ chr(9) + chr(9) + chr(9) +  
                                                               t_sAddress.AddressZip + ' --> ' +  tBusRelAvaReturnAddress.tcPostalCode + chr(10) +
                                               trim(#T-4'City':20(53223)T-4#) + chr(9) + chr(9) + chr(9) +   
                                                              t_sAddress.AddressCity + ' --> ' + tBusRelAvaReturnAddress.tcCity + chr(10) +
                                               trim(#T-79'State':20(40399)T-79#) + chr(9) + chr(9) + chr(9) +  
                                                              t_sAddress.tcStateCode + ' --> ' + tBusRelAvaReturnAddress.tcRegion + chr(10) +
                                               trim(#T-74'Country':20(4145)T-74#) + chr(9) + chr(9) + chr(9) +  
                                                              t_sAddress.tcCountryCode + ' --> ' + tBusRelAvaReturnAddress.tcCountry.
                                                           .    
                                 oiReturnStatus = 1.                              
                                <M-62 run SetMessage
                                   (input  vcMessage (icMessage), 
                                    input  '':U (icArguments), 
                                    input  '':U (icFieldName), 
                                    input  '':U (icFieldValue), 
                                    input  'W':U (icType), 
                                    input  3 (iiSeverity), 
                                    input  '':U (icRowid), 
                                    input  'qadfin-501738':U (icFcMsgNumber), 
                                    input  '':U (icFcExplanation), 
                                    input  '':U (icFcIdentification), 
                                    input  '':U (icFcContext), 
                                    output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation>
                                    
                             assign vcExternalValidationCode = {&AVATAXVALIDATIONCODE-VALID-NOTACCEPT}.
                       end.      
                       else do:
                            assign vcExternalValidationCode = {&AVATAXVALIDATIONCODE-VALID}.
        
                       end.
                       
                       assign
                               t_sAddress.AddressExternalValidationCode = vcExternalValidationCode.  
                end.             
       end.
end.