/** * Add an artefact in the tracker * * @return Tracker_Artifact or false if an error occured */ public function create(Tracker $tracker, array $fields_data, PFUser $user, $submitted_on, $send_notification) { $artifact = $this->getBareArtifact($tracker, $user, $submitted_on); if (!$this->fields_validator->validate($artifact, $fields_data)) { return; } $use_artifact_permissions = 0; $id = $this->artifact_dao->create($tracker->id, $user->getId(), $submitted_on, $use_artifact_permissions); if (!$id) { return; } $artifact->setId($id); $changeset_id = $this->changeset_creator->create($artifact, $fields_data, $user, $submitted_on); if (!$changeset_id) { return; } $changeset = new Tracker_Artifact_Changeset($changeset_id, $artifact, $artifact->getSubmittedBy(), $artifact->getSubmittedOn(), $user->getEmail()); if ($send_notification) { $changeset->notify(); } return $artifact; }