project BLF > class BSODViolationRule2 > method DeleteAndLog


Parameters


iiRoleIDinputinteger
iiResourceIDinputinteger
iiDomainIDinputinteger
iiCompanyIDinputinteger
iiUsrIDinputinteger
iiSODCategory1IDinputinteger
iiSODCategory2IDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BSODViolationRule2.DeleteByDomain
method BSODViolationRule2.DeleteByRoleResource
method BSODViolationRule2.DeleteByUserRoleCompanyCategory


program code (program1/bsodviolationrule2.p)

if viBSODLog7ID = 0
then do:
    <I-1 {bFcAddToTransaction
         &CLASS           = "BSODLog"}>
end.

for each tSODViolation2 where
        (tSODViolation2.Domain_ID = iiDomainID or iiDomainID = 0) and
        (tSODViolation2.Company_ID = iiCompanyID or iiCompanyID = 0) and
        (tSODViolation2.Usr_ID = iiUsrID or iiUsrID = 0) and
        (tSODViolation2.Role1_ID = iiRoleID or
         tSODViolation2.Role2_ID = iiRoleID or
         iiRoleID = 0) and
      (((tSODViolation2.SODCategory1_ID = iiSODCategory1ID or iiSODCategory1ID = 0) and
        (tSODViolation2.SODCategory2_ID = iiSODCategory2ID or iiSODCategory2ID = 0)) or
       ((tSODViolation2.SODCategory2_ID = iiSODCategory1ID or iiSODCategory1ID = 0) and
        (tSODViolation2.SODCategory1_ID = iiSODCategory2ID or iiSODCategory2ID = 0))) and
         tSODViolation2.tc_Status <> "D",
    each bVRResource1 where
         bVRResource1.tc_ParentRowid = tSODViolation2.tc_Rowid and
         bVRResource1.SODViolation2RCategory = 1 and
         bVRResource1.tc_Status <> "D",
    each bVRResource2 where
         bVRResource2.tc_ParentRowid = tSODViolation2.tc_Rowid and
         bVRResource2.SODViolation2RCategory = 2 and
         bVRResource2.tc_Status <> "D" on error undo, throw:

    if iiResourceID = 0
    or iiResourceID = ?
    then tSODViolation2.tc_Status = "D".
    else if iiResourceID = bVRResource1.Resource_ID
         then if can-find (first tSODViolation2R where
                                 tSODViolation2R.tc_ParentRowid = tSODViolation2.tc_Rowid and
                                 tSODViolation2R.SODViolation2RCategory = 1 and
                                 tSODViolation2R.tc_Rowid <> bVRResource1.tc_Rowid and
                                 tSODViolation2R.tc_Status <> "D")
         then bVRResource1.tc_Status = "D".
         else tSODViolation2.tc_Status = "D".
    else if iiResourceID = bVRResource2.Resource_ID
         then if can-find (first tSODViolation2R where
                                 tSODViolation2R.tc_ParentRowid = tSODViolation2.tc_Rowid and
                                 tSODViolation2R.SODViolation2RCategory = 2 and
                                 tSODViolation2R.tc_Rowid <> bVRResource2.tc_Rowid and
                                 tSODViolation2R.tc_Status <> "D")
         then bVRResource2.tc_Status = "D".
         else tSODViolation2.tc_Status = "D".
end.