From 3fb288de48ce656e0fd87c55944c5c47f5acc835 Mon Sep 17 00:00:00 2001 From: Thiago Matos Date: Fri, 10 May 2024 14:36:20 -0400 Subject: [PATCH 1/3] Change issues order export method Issue: documentacao-e-tarefas/desenvolvimento_e_infra#821 Signed-off-by: Thiago Matos --- .../ExtendedIssueNativeXmlFilter.inc.php | 28 +++++++++++++++---- fullJournal.xsd | 6 +++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/filter/export/ExtendedIssueNativeXmlFilter.inc.php b/filter/export/ExtendedIssueNativeXmlFilter.inc.php index fe72796..05931cb 100644 --- a/filter/export/ExtendedIssueNativeXmlFilter.inc.php +++ b/filter/export/ExtendedIssueNativeXmlFilter.inc.php @@ -15,6 +15,7 @@ public function &process(&$issues) $doc->preserveWhiteSpace = false; $doc->formatOutput = true; $deployment = $this->getDeployment(); + $journal = $deployment->getContext(); if (count($issues) == 1) { $rootNode = $this->createIssueNode($doc, $issues[0]); @@ -24,6 +25,14 @@ public function &process(&$issues) $rootNode->appendChild($this->createIssueNode($doc, $issue)); } } + + $issueDao = DAORegistry::getDAO('IssueDAO'); + if ($issueDao->customIssueOrderingExists($journal->getId())) { + foreach ($issues as $issue) { + $rootNode->appendChild($this->createCustomOrderNode($doc, $issue, $journal)); + } + } + $doc->appendChild($rootNode); $rootNode->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $rootNode->setAttribute('xsi:schemaLocation', $deployment->getNamespace() . ' ' . $deployment->getSchemaFilename()); @@ -45,12 +54,6 @@ public function createIssueNode($doc, $issue) $issueNode->setAttribute('access_status', $issue->getAccessStatus()); $issueNode->setAttribute('url_path', $issue->getData('urlPath')); - $issueDAO = DAORegistry::getDAO('IssueDAO'); - $issueOrder = $issueDAO->getCustomIssueOrder($journal->getId(), $issue->getId()); - if ($issueOrder) { - $issueNode->setAttribute('order', $issueOrder); - } - $this->createLocalizedNodes($doc, $issueNode, 'description', $issue->getDescription(null)); import('plugins.importexport.native.filter.NativeFilterHelper'); $nativeFilterHelper = new NativeFilterHelper(); @@ -100,4 +103,17 @@ public function addArticles($doc, $issueNode, $issue) $issueNode->appendChild($clone); } } + + public function createCustomOrderNode($doc, $issue, $journal) + { + $deployment = $this->getDeployment(); + + $issueDao = DAORegistry::getDAO('IssueDAO'); + $order = $issueDao->getCustomIssueOrder($journal->getId(), $issue->getId()); + + $customOrderNode = $doc->createElementNS($deployment->getNamespace(), 'custom_order', $order); + $customOrderNode->setAttribute('id', $issue->getId()); + + return $customOrderNode; + } } diff --git a/fullJournal.xsd b/fullJournal.xsd index b94259e..41a954f 100644 --- a/fullJournal.xsd +++ b/fullJournal.xsd @@ -130,13 +130,17 @@ - + + + + + From d97df73cbfd5038f35069fe3c2094ba21f2a69ef Mon Sep 17 00:00:00 2001 From: Thiago Matos Date: Fri, 10 May 2024 14:39:05 -0400 Subject: [PATCH 2/3] Change issues order import method Issue: documentacao-e-tarefas/desenvolvimento_e_infra#821 Signed-off-by: Thiago Matos --- .../NativeXmlExtendedIssueFilter.inc.php | 5 ----- filter/import/NativeXmlJournalFilter.inc.php | 20 +++++++++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/filter/import/NativeXmlExtendedIssueFilter.inc.php b/filter/import/NativeXmlExtendedIssueFilter.inc.php index 72366a4..b2c7bdf 100644 --- a/filter/import/NativeXmlExtendedIssueFilter.inc.php +++ b/filter/import/NativeXmlExtendedIssueFilter.inc.php @@ -39,11 +39,6 @@ public function handleElement($node) if ($issue->getCurrent()) { $deployment->setCurrentIssue($issue); } - - if ($seq = $node->getAttribute('order')) { - $issueDao = DAORegistry::getDAO('IssueDAO'); - $issueDao->moveCustomIssueOrder($journal->getId(), $issue->getId(), $seq); - } } return $issue; diff --git a/filter/import/NativeXmlJournalFilter.inc.php b/filter/import/NativeXmlJournalFilter.inc.php index 64f1597..9a5ca27 100644 --- a/filter/import/NativeXmlJournalFilter.inc.php +++ b/filter/import/NativeXmlJournalFilter.inc.php @@ -386,8 +386,13 @@ public function parseIssues($node, $journal) echo __('plugins.importexport.fullJournal.importingIssues') . "\n"; for ($n = $node->firstChild; $n !== null; $n = $n->nextSibling) { - if (is_a($n, 'DOMElement') && $n->tagName === 'extended_issue') { - $this->parseIssue($n, $journal); + if (is_a($n, 'DOMElement')) { + if ($n->tagName === 'extended_issue') { + $this->parseIssue($n, $journal); + } + if ($n->tagName === 'custom_order') { + $this->parseIssueOrder($n, $journal); + } } } @@ -410,6 +415,17 @@ public function parseIssue($node, $journal) return $importedObjects; } + public function parseIssueOrder($node, $journal) + { + $deployment = $this->getDeployment(); + + $issueId = $deployment->getIssueDBId($node->getAttribute('id')); + $customOrder = $node->textContent; + + $issueDAO = DAORegistry::getDAO('IssueDAO'); + $issueDAO->moveCustomIssueOrder($journal->getId(), $issueId, $customOrder); + } + public function parseArticles($node, $journal) { $deployment = $this->getDeployment(); From fffa87f3eb4ad8fff4ea7499dcf3972c424053d4 Mon Sep 17 00:00:00 2001 From: Thiago Matos Date: Fri, 10 May 2024 14:40:00 -0400 Subject: [PATCH 3/3] Update version.xml Issue: documentacao-e-tarefas/desenvolvimento_e_infra#821 Signed-off-by: Thiago Matos --- version.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.xml b/version.xml index 8eb309a..06499e2 100644 --- a/version.xml +++ b/version.xml @@ -10,7 +10,7 @@ fullJournalTransfer plugins.importexport - 2.0.11.3 - 2024-05-09 + 2.0.11.4 + 2024-05-10 FullJournalImportExportPlugin