project BLF > class BDomain > method SetPrimaryCompany
Description
method to set the primary company (= default company) on a domain
Parameters
iiDomainId | input | integer | |
icCompanyCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/bdomain.p)
if oiReturnStatus = 0
then assign oiReturnStatus = -98.
if iiDomainId = 0 or iiDomainId = ? or
icCompanyCode = '' or icCompanyCode = ?
then do:
assign vcMsg = trim(#T-1'Not all parameters have valid values.':100(5045)T-1#)
oiReturnStatus = -1.
<M-2 run SetMessage
(input vcMsg (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'BLF-74':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
return.
end.
<M-3 run ClearData
(output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-4 run DataLoad
(input '' (icRowids),
input string(iidomainId) (icPkeys),
input '' (icObjectIds),
input '' (icFreeform),
input false (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
find first tDomains where
tDomains.Domain_ID = iiDomainId no-error.
if available tDomains
then do:
assign tDomains.tcCompanyCode = icCompanyCode
tDomains.tc_Status = 'C':U.
end.
<M-5 run ValidateBC
(output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-6 run AdditionalUpdates
(output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
<M-7 run DataSave
(output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.