public function doAction(array $data)
 {
     $trac_url = trim($this->tracSetting->getOption('trac_url'));
     $trac_username = trim($this->tracSetting->getOption('trac_username'));
     $trac_password = trim($this->tracSetting->getOption('trac_password'));
     if ($trac_url && $trac_username && $trac_password && (int) $data['reference']) {
         $logged_id = $this->userSession->isLogged() ? $this->userSession->getId() : 0;
         $trac = new \Kanboard\Plugin\Trac\Lib\TracRPC($trac_url . '/login/jsonrpc', array('username' => $trac_username, 'password' => $trac_password));
         $values = array('attr' => array('summary' => $data['title'], 'description' => $data['description']), 'notify' => false);
         $author = '';
         if ((int) $logged_id) {
             $logged = $this->user->getById((int) $logged_id);
             $author = $logged['username'];
         }
         if ((int) $data['owner_id']) {
             $owner = $this->user->getById((int) $data['owner_id']);
             $values['attr']['owner'] = $owner['username'];
             $values['attr']['status'] = 'assigned';
         } else {
             $values['attr']['owner'] = '';
             $values['attr']['status'] = 'new';
         }
         $component = $this->tracSetting->getComponent($data['project_id']);
         if ($component !== false) {
             $values['attr']['component'] = $component;
         }
         $priority = $this->tracSetting->getPriority($data['project_id'], $data['category_id']);
         if ($priority !== false) {
             $values['attr']['priority'] = $priority;
         }
         $res = $trac->getTicketUpdate('update', (int) $data['reference'], $values, $author);
         return $res !== false;
     }
     return false;
 }
 public function doAction(array $data)
 {
     $trac_url = trim($this->tracSetting->getOption('trac_url'));
     $trac_username = trim($this->tracSetting->getOption('trac_username'));
     $trac_password = trim($this->tracSetting->getOption('trac_password'));
     if ($trac_url && $trac_username && $trac_password) {
         $trac = new \Kanboard\Plugin\Trac\Lib\TracRPC($trac_url . '/login/jsonrpc', array('username' => $trac_username, 'password' => $trac_password));
         $task = $this->taskFinder->getById($data['task_id']);
         if (!empty($task) && (int) $task['reference']) {
             $values = array('comment' => $data['comment'], 'notify' => false);
             $author = '';
             if ((int) $data['user_id']) {
                 $u = $this->user->getById((int) $data['user_id']);
                 $author = $u['username'];
             }
             $res = $trac->getTicketUpdate('update', (int) $task['reference'], $values, $author);
             return $res !== false;
         }
     }
     return false;
 }
 public function doAction(array $data)
 {
     $trac_url = trim($this->tracSetting->getOption('trac_url'));
     $trac_username = trim($this->tracSetting->getOption('trac_username'));
     $trac_password = trim($this->tracSetting->getOption('trac_password'));
     if ($trac_url && $trac_username && $trac_password) {
         $trac = new \Kanboard\Plugin\Trac\Lib\TracRPC($trac_url . '/login/jsonrpc', array('username' => $trac_username, 'password' => $trac_password));
         $values = array('summary' => $data['title'], 'description' => $data['description'], 'attr' => array(), 'notify' => false);
         if ((int) $data['creator_id']) {
             $creator = $this->user->getById((int) $data['creator_id']);
             $values['attr']['reporter'] = $creator['username'];
         }
         if ((int) $data['owner_id']) {
             $owner = $this->user->getById((int) $data['owner_id']);
             $values['attr']['owner'] = $owner['username'];
             $values['attr']['status'] = 'assigned';
         } else {
             $values['attr']['owner'] = '';
             $values['attr']['status'] = 'new';
         }
         $component = $this->tracSetting->getComponent($data['project_id']);
         if ($component !== false) {
             $values['attr']['component'] = $component;
         }
         $priority = $this->tracSetting->getPriority($data['project_id'], $data['category_id']);
         if ($priority !== false) {
             $values['attr']['priority'] = $priority;
         }
         $res = $trac->getTicketUpdate('create', '', $values);
         if ($res !== false) {
             $this->logger->debug('>>>>>>>>>>>>>>>>>>>>>> ' . var_export($res, true));
             return (bool) $this->taskModification->update(array('reference' => $res, 'id' => $data['id']));
         }
     }
     return false;
 }