Skip to content

Commit

Permalink
Merge branch 'fixIssuesOrder-821' into 'main'
Browse files Browse the repository at this point in the history
Include order in issue import/export

See merge request softwares-pkp/plugins_ojs/fullJournalTransfer!55
  • Loading branch information
thiagolepidus committed May 9, 2024
2 parents 6eaa92f + 2dd973a commit 778909d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
7 changes: 7 additions & 0 deletions filter/export/ExtendedIssueNativeXmlFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function createIssueNode($doc, $issue)
{
$deployment = $this->getDeployment();
$deployment->setIssue($issue);
$journal = $deployment->getContext();

$issueNode = $doc->createElementNS($deployment->getNamespace(), 'extended_issue');
$this->addIdentifiers($doc, $issueNode, $issue);
Expand All @@ -44,6 +45,12 @@ 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();
Expand Down
14 changes: 10 additions & 4 deletions filter/import/NativeXmlExtendedIssueFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ public function getSingularElementName()

public function handleElement($node)
{
$issue = parent::handleElement($node);
$deployment = $this->getDeployment();
$journal = $deployment->getContext();
$issue = parent::handleElement($node);

if ($issue) {
for ($childNode = $node->firstChild; $childNode !== null; $childNode = $childNode->nextSibling) {
Expand All @@ -34,10 +35,15 @@ public function handleElement($node)
$deployment->setIssueDBId($childNode->textContent, $issue->getId());
}
}
}

if ($issue && $issue->getCurrent()) {
$deployment->setCurrentIssue($issue);
if ($issue->getCurrent()) {
$deployment->setCurrentIssue($issue);
}

if ($seq = $node->getAttribute('order')) {
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueDao->moveCustomIssueOrder($journal->getId(), $issue->getId(), $seq);
}
}

return $issue;
Expand Down
1 change: 1 addition & 0 deletions fullJournal.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<attribute name="current" type="int" use="optional" />
<attribute name="access_status" type="int" use="optional" />
<attribute name="url_path" type="string" use="optional" />
<attribute name="order" type="int" use="optional" />
</complexType>

<element name="extended_issues">
Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>
<application>fullJournalTransfer</application>
<type>plugins.importexport</type>
<release>2.0.11.2</release>
<date>2024-05-04</date>
<release>2.0.11.3</release>
<date>2024-05-09</date>
<class>FullJournalImportExportPlugin</class>
</version>

0 comments on commit 778909d

Please sign in to comment.