From 31d018b314e3838e21c6ebadf69a8dc613b02d48 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Wed, 7 Aug 2024 16:53:58 -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 55af5f0ed61..a85a64eb70e 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 @@ -191,14 +191,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 389405c51df79a6795f26597809a43ab8b17e19f Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Thu, 29 Aug 2024 13:15:53 -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 a85a64eb70e..e2ada1bddd2 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.php @@ -195,13 +195,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 86dabfc49cf7881b675ae2ce97dfba2d335462e4 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Fri, 30 Aug 2024 09:42:46 -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 e2ada1bddd2..93452936af3 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.php @@ -195,12 +195,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']); } }