Esempio n. 1
0
 /** @return Tracker_Artifact */
 private function createArtifact(PFUser $user, Tracker $tracker, $title, $body)
 {
     $this->logger->debug("Receiving new artifact from " . $user->getUserName());
     if (!$tracker->userCanSubmitArtifact($user)) {
         $this->logger->info("User " . $user->getUnixName() . " has no right to create an artifact in tracker #" . $tracker->getId());
         $this->notifier->sendErrorMailInsufficientPermissionCreation($user->getEmail(), $title);
         return;
     }
     $title_field = $tracker->getTitleField();
     $description_field = $tracker->getDescriptionField();
     if (!$title_field || !$description_field) {
         throw new Tracker_Artifact_MailGateway_TrackerMissingSemanticException();
     }
     $field_data = array($title_field->getId() => $title, $description_field->getId() => $body);
     UserManager::instance()->setCurrentUser($user);
     return $this->artifact_factory->createArtifact($tracker, $field_data, $user, '');
 }
 /**
  * @return bool
  */
 private function isSemanticDefined(Tracker $tracker)
 {
     $title_field = $tracker->getTitleField();
     $description_field = $tracker->getDescriptionField();
     return $title_field !== null && $description_field !== null;
 }