Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
if (timesheetApprovalAction.period.open) {
  return "Period is still open. You can't approve the timesheet when period is open."
}

Prevent Users to Approve/Reject Their Own Timesheet

Code Block
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.security.JiraAuthenticationContext;

def authenticationContext = ComponentAccessor.getJiraAuthenticationContext();
def loggedInUser = authenticationContext.getLoggedInUser();

if (timesheetApprovalAction.userKey == loggedInUser.key) {
  return "You can't approve your own timesheet!"
}

Prevent Approval/Rejection of Timesheet if User Hasn’t Submitted it Yet

...