Exemplo n.º 1
0
 // Get issue instance
 $issue = new \Model\Issue();
 if (!empty($matches[1])) {
     $issue->load(intval($matches[1]));
 }
 if (!$issue->id) {
     $subject = trim(preg_replace("/^((Re|Fwd?):\\s)*/i", "", $header->subject));
     $issue->load(array('name=? AND deleted_date IS NULL AND closed_date IS NULL', $subject));
 }
 if ($issue->id) {
     if (trim($text)) {
         $comment = \Model\Issue\Comment::create(array('user_id' => $from_user->id, 'issue_id' => $issue->id, 'text' => $text));
         $log->write(sprintf("Added comment %s on issue #%s - %s", $comment->id, $issue->id, $issue->name));
     }
 } else {
     $issue = \Model\Issue::create(array('name' => $header->subject, 'description' => $text, 'author_id' => $from_user->id, 'owner_id' => $owner, 'status' => 1, 'type_id' => 1));
     $log->write(sprintf("Created issue #%s - %s", $issue->id, $issue->name));
 }
 // Add other recipients as watchers
 if (!empty($header->cc) || count($header->to) > 1) {
     if (!empty($header->cc)) {
         $watchers = array_merge($header->to, $header->cc);
     } else {
         $watchers = $header->to;
     }
     foreach ($watchers as $more_people) {
         $watcher_email = $more_people->mailbox . '@' . $more_people->host;
         $watcher = new \Model\User();
         $watcher->load(array('email=? AND deleted_date IS NULL', $watcher_email));
         if (!empty($watcher->id)) {
             $watching = new \Model\Issue\Watcher();
Exemplo n.º 2
0
 /**
  * Add a new task
  */
 public function add($f3, $params)
 {
     $post = $f3->get("POST");
     $post['sprint_id'] = $post['sprintId'];
     $post['name'] = $post['title'];
     $post['owner_id'] = $post['assigned'];
     $post['due_date'] = $post['dueDate'];
     $post['parent_id'] = $post['storyId'];
     $issue = \Model\Issue::create($post);
     $this->_printJson($issue->cast() + array("taskId" => $issue->id));
 }
Exemplo n.º 3
0
 /**
  * Create a new issue from $_POST
  *
  * @return \Model\Issue
  */
 protected function _saveNew()
 {
     $f3 = \Base::instance();
     return \Model\Issue::create($f3->get("POST"), !!$f3->get("POST.notify"));
 }