From 39812e9e261b1557eb2edd412d0383902376ceec Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Wed, 7 Aug 2024 16:44:04 -0300 Subject: [PATCH 1/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- .../pubmed/PubMedExportPlugin.php | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.php b/plugins/importexport/pubmed/PubMedExportPlugin.php index a8b9f63e634..a1a42fa07a5 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.php @@ -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 @@ -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) { From 066c2e761fe6ff5db87afd2157c0a87d7808d483 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Thu, 29 Aug 2024 13:14:05 -0300 Subject: [PATCH 2/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- plugins/importexport/pubmed/PubMedExportPlugin.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.php b/plugins/importexport/pubmed/PubMedExportPlugin.php index a1a42fa07a5..f15296f8311 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.php @@ -191,13 +191,11 @@ public function exportIssues($issueIds, $context, $user) foreach ($issueIds as $issueId) { $sections = Repo::section()->getByIssueId($issueId); + $submissionsInSections = []; + $submissionsInSections[] = Repo::submission()->getInSections($issueId, $context->getId()); 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; - } + $input = array_merge($input, $articles[$section->getId()]['articles']); } } } From d51cbc8c6c7291cf1f963f7913284b375964378a Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Fri, 30 Aug 2024 09:41:26 -0300 Subject: [PATCH 3/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- plugins/importexport/pubmed/PubMedExportPlugin.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.php b/plugins/importexport/pubmed/PubMedExportPlugin.php index f15296f8311..38601ea69e0 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.php @@ -191,12 +191,9 @@ public function exportIssues($issueIds, $context, $user) foreach ($issueIds as $issueId) { $sections = Repo::section()->getByIssueId($issueId); - $submissionsInSections = []; - $submissionsInSections[] = Repo::submission()->getInSections($issueId, $context->getId()); + $submissionsInSections = Repo::submission()->getInSections($issueId, $context->getId()); foreach ($sections as $section) { - foreach ($submissionsInSections as $articles) { - $input = array_merge($input, $articles[$section->getId()]['articles']); - } + $input = array_merge($input, $submissionsInSections[$section->getId()]['articles']); } }