project QadFinancials > class BEmployee > method ValActiveActivity

Description

Validates all Activity related info related active Activity flag.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BEmployee.PostValidateComponent


program code (program1/bemployee.p)

/* Activity Code is mandatory */
if t_sEmployee.ActivityCode_ID = ? or
   t_sEmployee.ActivityCode_ID = 0
then do:
    assign vcMessage = trim(substitute(#T-12'You must enter the activity code (employee: &1).':200(1830)T-12#, trim(t_sEmployee.EmployeeCode))).
    <M-7 run SetMessage (input  vcMessage (icMessage),
                 input  '':U (icArguments),
                 input  'tEmployee.tcActivityCode':U (icFieldName),
                 input  '':U (icFieldValue),
                 input  'E':U (icType),
                 input  3 (iiSeverity),
                 input  t_sEmployee.tc_Rowid (icRowid),
                 input  'QADFIN-1641':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BEmployee>
    assign oiReturnStatus = min(-1, viFcReturnSuper).
end.
/* Activity Code has to be of type employee */
else do:
    <Q-9 assign vlFcQueryRecordsAvailable = ActivityCodeByCodeTypeAct (NoCache)
      (input t_sEmployee.tcActivityCode, (ActiveCode)
       input {&ACTIVITYCODETYPE-EMPLOYEE}, (ActiveCodeType)
       input ?, (ActiveCodeIsActive)) in BActivityCode >
    if not vlFcQueryRecordsAvailable
    then do:
        assign vcMessage = trim(substitute(#T-13'The activity code is not of type &amp;2 (employee: &amp;1).':200(59918)T-13#, trim(t_sEmployee.EmployeeCode), {&ACTIVITYCODETYPE-EMPLOYEE-TR})).
        <M-10 run SetMessage (input  vcMessage (icMessage),
                 input  '':U (icArguments),
                 input  'tEmployee.tcActivityCode':U (icFieldName),
                 input  '':U (icFieldValue),
                 input  'E':U (icType),
                 input  3 (iiSeverity),
                 input  t_sEmployee.tc_Rowid (icRowid),
                 input  'QADFIN-2191':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BEmployee>
        assign oiReturnStatus = min(-1, viFcReturnSuper).
    end.                                                                   
end.

/* Default cost centre is mandatory if employee is active for activity sheets */
if t_sEmployee.CostCentre_ID = ? or
   t_sEmployee.CostCentre_ID = 0
then do:
    <M-19 run SetMessage
          (input  #T-19'Cost center is mandatory if employee is active for activity sheets: $1.':80(15506)T-19# (icMessage), 
           input  t_sEmployee.EmployeeCode (icArguments), 
           input  '':U (icFieldName), 
           input  '':U (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  t_sEmployee.tc_Rowid (icRowid), 
           input  'QADFIN-3682':U (icFcMsgNumber), 
           input  '':U (icFcExplanation), 
           input  '':U (icFcIdentification), 
           input  '':U (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BEmployee>
    assign oiReturnStatus = min(-1, viFcReturnSuper).
end.