Skip to content

Commit

Permalink
pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson committed Aug 28, 2024
1 parent 904d4fb commit 39812e9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions plugins/importexport/pubmed/PubMedExportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file plugins/importexport/pubmed/PubMedExportPlugin.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2003-2022 John Willinsky
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2003-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class PubMedExportPlugin
Expand Down Expand Up @@ -187,14 +187,22 @@ public function exportIssues($issueIds, $context, $user)
$pubmedExportFilters = $filterDao->getObjectsByGroup('article=>pubmed-xml');
assert(count($pubmedExportFilters) == 1); // Assert only a single serialization filter
$exportFilter = array_shift($pubmedExportFilters);
$submissions = Repo::submission()
->getCollector()
->filterByContextIds([$context->getId()])
->filterByIssueIds($issueIds)
->getMany();
$input = [];

foreach ($issueIds as $issueId) {
$sections = Repo::section()->getByIssueId($issueId);
foreach ($sections as $section) {
$submissionsInSections = [];
$submissionsInSections[] = Repo::submission()->getInSections($issueId, $context->getId());
foreach ($submissionsInSections as $articles) {
foreach ($articles[$section->getId()]['articles'] as $article) {
$input[] = $article;
}
}
}
}

libxml_use_internal_errors(true);
$input = $submissions->toArray();
$submissionXml = $exportFilter->execute($input, true);
$xml = $submissionXml->saveXml();
$errors = array_filter(libxml_get_errors(), function ($a) {
Expand Down

0 comments on commit 39812e9

Please sign in to comment.