Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.atlassian.jira.component.ComponentAccessor
- import groovy.sql.Sql
- import java.sql.Connection
- import org.ofbiz.core.entity.ConnectionFactory
- import org.ofbiz.core.entity.DelegatorInterface
- import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
- import com.atlassian.jira.event.type.EventDispatchOption
- import com.atlassian.jira.issue.ModifiedValue
- import com.atlassian.jira.issue.Issue
- import com.atlassian.jira.issue.MutableIssue
- def issue = ComponentAccessor.getIssueManager().getIssueObject('TII-840')
- log.debug ("ID задачи: " + issue.id)
- def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)
- String helperName = delegator.getGroupHelperName("default")
- def issueId = issue.id
- def changeHolder = new DefaultIssueChangeHolder()
- int result
- def sqlStmt = """
- SELECT SUM("SECONDS_PER_DAY") as val
- FROM public."AO_2D3BEA_PLAN_ALLOCATION"
- WHERE "PLAN_ITEM_ID" = $issueId;
- """
- Connection conn = ConnectionFactory.getConnection(helperName)
- Sql sql = new Sql(conn)
- try {
- StringBuffer sb = new StringBuffer()
- sql.eachRow(sqlStmt) {
- result =it.val
- }
- log.debug ("Сумма запланированного времени в секундах: " + result)
- }
- finally {
- sql.close()
- }
- int hours=result/3600
- int minutes=result%3600/60
- log.debug ("Получаем часы: " + hours)
- log.debug ("Получаем минуты: " + minutes)
- def issueManager = ComponentAccessor.getIssueManager()
- def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
- issue.setOriginalEstimate(hours)
- issueManager.updateIssue(user,issue, EventDispatchOption.ISSUE_UPDATED,false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement