project QadFinancials > class BEmployee > method ValDepartmentCode

Description

Validates that the department code (if set) reflects a valid dpt_mstr.dpt_dept for the domain.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BEmployee.PreValidateComponent


program code (program1/bemployee.p)

/* Only check for valid department if value is set */
if(t_sEmployee.EmployeeDepartmentCode <> "" and t_sEmployee.EmployeeDepartmentCode <> ?) then do:
    <Q-4 assign vlFcQueryRecordsAvailable = GetDepartmentByCode (NoCache)
          (input vcMfgDomain, (Domain)
           input t_sEmployee.EmployeeDepartmentCode, (DepartmentCode)) in BMfgDepartment >
    if(not vlFcQueryRecordsAvailable) then do:
        vcMessageText = #T-1'The department ($1) is not defined in the system.':30(31062)t-1#.
        <M-3 run SetMessage (input  vcMessageText (icMessage), 
                     input  t_sEmployee.EmployeeDepartmentCode (icArguments), 
                     input  'EmployeeDepartmentCode':U (icFieldName), 
                     input  t_sEmployee.EmployeeDepartmentCode (icFieldValue), 
                     input  'E':U (icType), 
                     input  3 (iiSeverity), 
                     input  '' (icRowid), 
                     input  'QadFin-4666':U (icFcMsgNumber), 
                     input  '' (icFcExplanation), 
                     input  '' (icFcIdentification), 
                     input  '' (icFcContext), 
                     output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        oiReturnStatus = -1.
        return.
    end. /* if(not vlFcQueryRecordsAvailable */
end. /* if(t_sEmployee.EmplolyeeDepartmentCode */