Description
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters
| oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bemployee.p)
MAIN_BLOCK:
do on error undo, leave:
<M-29 run StopExternalInstances (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave MAIN_BLOCK.
<M-3 run PreValidateComponent (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave MAIN_BLOCK.
for each t_sEmployee where t_sEmployee.tc_Status EQ 'C':
for first t_iEmployee where
t_iEmployee.tc_Rowid = t_sEmployee.tc_Rowid :
if t_iEmployee.EmployeeCode <> t_sEmployee.EmployeeCode
then do:
assign vcMessageText = #T-9'You cannot change key field values.':30(56496)t-9#
oiReturnStatus = -1.
<M-10 run SetMessage
(input vcMessageText (icMessage),
input t_sEmployee.EmployeeCode (icArguments),
input 'Employee Code':U (icFieldName),
input t_sEmployee.EmployeeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sEmployee.tc_Rowid (icRowid),
input 'QadFin-5718':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BEmployee>
leave MAIN_BLOCK.
end. /* if t_iemp */
end. /* for first t_iEmp */
end. /* for each tEmp */
<M-8 run ValidateBusinessKey (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave MAIN_BLOCK.
<ANCESTOR-CODE>
if oiReturnStatus < 0 then leave MAIN_BLOCK.
<M-1 run PostValidateComponent (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then leave MAIN_BLOCK.
CATCH eSysError AS Progress.Lang.SysError:
assign oiReturnStatus = -98.
END CATCH.
FINALLY:
if oiReturnStatus < 0
then do:
<M-5 run StopExternalInstances (output viFcReturnSuper (oiReturnStatus)) in BEmployee>
end.
END FINALLY.
end. /* of MAIN_BLOCK */