private function importArtifactsInNewlyCreatedTracker(Tracker $tracker, SimpleXMLElement $xml_tracker) { if (isset($xml_tracker->artifacts)) { $extraction_path = ''; $this->xml_import->importFromXML($tracker, $xml_tracker->artifacts, $extraction_path); } }
private function importArtifactsInNewlyCreatedTracker(Tracker $tracker, SimpleXMLElement $xml_tracker, $extraction_path) { if (isset($xml_tracker->artifacts)) { $xml_mapping = new TrackerXmlFieldsMapping_FromAnotherPlatform($this->xmlFieldsMapping); $this->xml_import->importFromXML($tracker, $xml_tracker->artifacts, $extraction_path, $xml_mapping); } }
public function importChildren(Tracker_XML_Importer_ArtifactImportedMapping $artifacts_imported_mapping, SimpleXMLElement $xml_artifacts, $extraction_path, Tracker_Artifact $root_artifact, PFUser $user) { $length = count($xml_artifacts->artifact); if ($length <= 1) { return; } $this->addChildrenFromXML($xml_artifacts->artifact[0]); for ($i = 1; $i < $length; $i++) { $xml_artifact = $xml_artifacts->artifact[$i]; $tracker = $this->tracker_factory->getTrackerById((int) $xml_artifact['tracker_id']); if (!$tracker) { throw new Tracker_XML_Importer_TrackerIdNotDefinedException(); } $artifact = $this->xml_importer->importOneArtifactFromXML($tracker, $xml_artifact, $extraction_path); if ($artifact) { $this->addChildrenFromXML($xml_artifact); $artifacts_imported_mapping->add((int) $xml_artifact['id'], $artifact->getId()); } } $this->createLinksBetweenArtifacts($user, $artifacts_imported_mapping, $root_artifact); }
private function processCopy(Tracker_Artifact_Changeset $from_changeset, PFUser $current_user, array $submitted_values) { $xml_artifacts = $this->getXMLRootNode(); $this->xml_exporter->exportSnapshotWithoutComments($xml_artifacts, $from_changeset); $this->file_updater->update($xml_artifacts->artifact); $this->xml_updater->update($this->tracker, $xml_artifacts->artifact, $submitted_values, $current_user, $_SERVER['REQUEST_TIME']); $this->children_xml_exporter->exportChildren($xml_artifacts); $extraction_path = ''; $artifact = $this->xml_importer->importOneArtifactFromXML($this->tracker, $xml_artifacts->artifact[0], $extraction_path); if ($artifact) { $this->artifacts_imported_mapping->add($from_changeset->getArtifact()->getId(), $artifact->getId()); $this->children_xml_importer->importChildren($this->artifacts_imported_mapping, $xml_artifacts, $extraction_path, $artifact, $current_user); $this->addSummaryCommentChangeset($artifact, $current_user, $from_changeset); $this->redirectToArtifact($artifact); } else { $this->logsErrorAndRedirectToTracker('plugin_tracker', 'error_create_copy', $from_changeset->getArtifact()->getId()); } }