-
-
Save jvanhoesen/8461bf6dd782b07f1f7f9713deddc49f to your computer and use it in GitHub Desktop.
Primary Data-Access-Class RowSelecting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected virtual void _(Events.RowSelecting<AATimeRequest> e) | |
{ | |
if (e.Row is AATimeRequest row) | |
{ | |
using (new PXConnectionScope()) | |
{ | |
//If Approvals are enabled, check if the current user is the set approver | |
if (Setup.Current.TimeRequestApproval ?? false) | |
{ | |
EPEmployee approver = PXSelectJoin<EPEmployee, | |
InnerJoin<EPRule, On<EPEmployee.userID, Equal<EPRule.ownerID>>, | |
InnerJoin<EPAssignmentMap, On<EPRule.assignmentMapID, Equal<EPAssignmentMap.assignmentMapID>>>>, | |
Where<EPAssignmentMap.assignmentMapID, Equal<Required<EPAssignmentMap.assignmentMapID>>>>.Select(this, SetupApproval.Current.AssignmentMapID); | |
if (approver != null) | |
{ | |
row.IsApprover = (approver.UserID == Accessinfo.UserID); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment