/**
  * Add an artefact in the tracker
  * 
  * @param Tracker $tracker           The tracker this artifact belongs to
  * @param array   $fields_data       The data of the artifact to create
  * @param PFUser    $user              The user that want to create the artifact
  * @param string  $email             The email if the user is anonymous (null if anonymous)
  * @param boolean $send_notification true if a notification must be sent, false otherwise
  * 
  * @return Tracker_Artifact or false if an error occured
  */
 public function createArtifact(Tracker $tracker, $fields_data, PFUser $user, $email, $send_notification = true)
 {
     $formelement_factory = Tracker_FormElementFactory::instance();
     $fields_validator = new Tracker_Artifact_Changeset_InitialChangesetFieldsValidator($formelement_factory);
     $changeset_creator = new Tracker_Artifact_Changeset_InitialChangesetCreator($fields_validator, $formelement_factory, new Tracker_Artifact_ChangesetDao(), $this, EventManager::instance());
     $creator = new Tracker_ArtifactCreator($this, $fields_validator, $changeset_creator);
     if ($user->isAnonymous()) {
         $user->setEmail($email);
     }
     $submitted_on = $_SERVER['REQUEST_TIME'];
     return $creator->create($tracker, $fields_data, $user, $submitted_on, $send_notification);
 }
Beispiel #2
0
 private function createFakeInitialChangeset(Tracker $tracker, SimpleXMLElement $xml_changeset)
 {
     $this->logger->warn("Impossible to create artifact with first changeset, create a fake one instead: " . $GLOBALS['Response']->getAndClearRawFeedback());
     return $this->artifact_creator->create($tracker, array(), $this->getSubmittedBy($xml_changeset), $this->getSubmittedOn($xml_changeset), $this->send_notifications);
 }