コード例 #1
0
 /**
  * update Youtrack with timing data
  * @param string $content timing xml
  * @param string $ticketId ticket reference
  * @return bool success
  */
 function updateYoutrack($content, $ticketId)
 {
     global $youtrackUrl;
     $getDataFromYoutrack = new getDataFromYoutrack();
     $url = $youtrackUrl . '/rest/issue/' . $ticketId . '/timetracking/workitem';
     $res = $getDataFromYoutrack->restResponse($url, 'post', ['Content-Type' => 'text/xml; charset=UTF8'], $content);
     $res = $res->getResponse();
     if ($res->getStatusCode() == 201) {
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
 /**
  * create issue on youtrack, creates $GLOBALS['createByFormAjax'] with upload success data
  * @param array $item youtrack ticket data
  * @param int $ticketRow ticket row no. added to data array
  * @return string new ticket ref
  */
 function stdUserCreateIssue($item, $ticketRow = null)
 {
     global $youtrackUrl;
     $getDataFromYoutrack = new getDataFromYoutrack();
     $authenticationAndSecurity = new authenticationAndSecurity();
     //https://confluence.jetbrains.com/display/YTD65/Create+New+Issue
     // PUT /rest/issue?{project}&{summary}&{description}&{attachments}&{permittedGroup}
     $url = $youtrackUrl . '/rest/issue?project=' . $item["project"] . '&summary=' . urlencode($item['summary']) . '&description=' . urlencode($item['description']);
     $res = $getDataFromYoutrack->restResponse($url, 'put');
     $res = $res->getResponse();
     $location = $res->getHeader('location');
     foreach ($location as $_location) {
         $singleLocation = $_location;
     }
     $ticketRef = explode('/', $singleLocation);
     $ticketRef = $ticketRef[sizeof($ticketRef) - 1];
     $isAjax = $authenticationAndSecurity->getGet("ajax");
     if ($isAjax !== 'true') {
         echo 'created: <a href="' . $youtrackUrl . '/issue/' . $ticketRef . '">' . $ticketRef . ':   ' . $item['summary'] . '</a>';
         echo $GLOBALS["newline"];
     } else {
         $GLOBALS['createByFormAjax'][$ticketRef] = ['uploaded' => true, 'summary' => $item['summary'], 'url' => $youtrackUrl . '/issue/' . $ticketRef, 'ticketRef' => $ticketRef];
         if ($ticketRow) {
             $GLOBALS['createByFormAjax'][$ticketRef]['row'] = $ticketRow;
         }
     }
     return $ticketRef;
 }