Skip to content

Commit

Permalink
Merge pull request #4389 from kaitlinnewson/8564-3_4_0
Browse files Browse the repository at this point in the history
pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin
  • Loading branch information
bozana authored Aug 30, 2024
2 parents b301b30 + d51cbc8 commit b18ff8b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 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,17 @@ 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);
$submissionsInSections = Repo::submission()->getInSections($issueId, $context->getId());
foreach ($sections as $section) {
$input = array_merge($input, $submissionsInSections[$section->getId()]['articles']);
}
}

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 b18ff8b

Please sign in to comment.