Description
Actions to take after writing current instance to the database, and before final commit of the transaction.
Use the field tc_status to test the status of the updated records:
'' = unchanged
'N' = new
'C' = changed
'D' = deleted
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bdivision.p)
<ANCESTOR-CODE>
/* To empty the temp table */
empty temp-table tUpdateProfileDiv.
/* If division is deleted, delete also profile to COA Mask */
for each tDivision:
if tDivision.tc_Status = "D":U
then do:
if tDivision.COAMaskDivProfile_ID = 0 or
tDivision.COAMaskDivProfile_ID = ?
then next.
create tUpdateProfileDiv.
assign tUpdateProfileDiv.tiParentObject_ID = tDivision.Division_ID
tUpdateProfileDiv.tiProfile_ID = tDivision.COAMaskDivProfile_ID
tUpdateProfileDiv.tcProfileTypeCode = {&PROFILETYPECODE-COAMASKDIV}
tUpdateProfileDiv.tc_Status = "D":U.
next.
end. /* IF tDivision.COAMaskDivProfile_ID = 0 ...*/
end. /* FOR EACH tDivision */
/* Do real Profiles creation/update */
if can-find(first tUpdateProfileDiv)
then do:
if viBProfile8ID = 0 or viBProfile8ID = ?
then do:
<I-12 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "no"
&CLASS = "BProfile"}>
end. /* IF viBProfile8ID = 0 or viBProfile8ID = ? */
else do:
<I-18 {bFcOpenInstance
&CLASS = "BProfile"}>
end. /* IF NOT viBProfile8ID = 0 or viBProfile8ID = ? */
<M-52 run ApiUpdateProfile
(input-output tUpdateProfileDiv (tUpdateProfile),
output viFcReturnSuper (oiReturnStatus)) in BProfile>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then do:
<I-23 {bFcCloseAndStopInstance
&CLASS = "BProfile"}>
return.
end. /* IF viFcReturnSuper < 0 */
else do:
<I-58 {bFcCloseInstance
&CLASS = "BProfile"}>
end. /* IF NOT viFcReturnSuper < 0 */
end. /* IF can-find(first tUpdateProfileDiv) */
/* return status */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.