Advertisement
TheShestov

Untitled

Jan 20th, 2021
1,855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.99 KB | None | 0 0
  1. import static com.atlassian.jira.component.ComponentAccessor.*
  2. import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
  3. import com.atlassian.jira.issue.MutableIssue
  4.  
  5. // ----> для документооборота
  6.  
  7. log.setLevel(org.apache.log4j.Level.DEBUG)
  8.  
  9. def head = "!!!!! создание подзадач !!!!! behaviour !!! скрипт инициализации "
  10.  
  11. //log.debug head + "getActionName() = " + getActionName()
  12.  
  13. def ff1 = getFieldById(getFieldChanged())
  14.  
  15. if (getActionName() == "Create" && issueContext.getIssueType().isSubTask()) {
  16.     Long parentId = getFieldById("parentIssueId").getValue() as Long
  17.     MutableIssue parent = getIssueManager().getIssueObject(parentId)
  18.    
  19.     //if (parent.getProjectObject().getKey() in ["EFFIECER"]) {
  20.         if (parent.getIssueTypeId().toInteger() in [
  21.             11203, // Client one-time contract
  22.             11205, // Client annex
  23.             11207  // Client sup.agreement
  24.         ]) {
  25.             ff1.setFormValue(getConstantsManager().getAllIssueTypeObjects().find{ it.name == "Client act" }.id)
  26.             ff1.setReadOnly(true)
  27.         } else if (parent.getIssueTypeId().toInteger() in [
  28.             11204, // Partner one-time contract
  29.             11206, // Partner annex
  30.             11208  // Partner sup.agreement
  31.         ]) {
  32.             ff1.setFormValue(getConstantsManager().getAllIssueTypeObjects().find{ it.name == "Partner act" }.id)
  33.             ff1.setReadOnly(true)
  34.         } else if (parent.getIssueTypeId().toInteger() in [
  35.             11700 // Partner support contract
  36.         ]) {
  37.             ff1.setFormValue(getConstantsManager().getAllIssueTypeObjects().find{ it.name == "Partner support act" }.id)
  38.             ff1.setReadOnly(true)
  39.         } else {
  40.            // ff1.setFieldOptions(issueContext.getProjectObject().getIssueTypes().findAll { !(it.name in ["Client act", "Partner act", "Partner support act"]) && it.isSubTask() })
  41.         }
  42.        
  43.     //}
  44. }
  45.  
  46. // <-------------------------
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement