From 839439ab3a602d3a6b39d3f57880e83cdaea4af2 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Wed, 7 Aug 2024 16:28:11 -0300 Subject: [PATCH 1/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- .../pubmed/PubMedExportPlugin.inc.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php index 9e258439fd2..5013d897bdf 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php @@ -160,12 +160,24 @@ 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); - $submissionsIterator = Services::get('submission')->getMany([ - 'contextId' => $context->getId(), - 'issueIds' => $issueIds, - ]); + + $input = []; + $sectionDao = DAORegistry::getDAO('SectionDAO'); + foreach ($issueIds as $issueId) { + $sections = $sectionDao->getByIssueId($issueId); + foreach ($sections as $section) { + $submissionsInSections = []; + $submissionsInSections[] = Services::get('submission')->getInSections($issueId, $context->getId()); + foreach ($submissionsInSections as $articles) { + foreach ($articles[$section->getId()]['articles'] as $article) { + $input[] = $article; + } + } + } + } + libxml_use_internal_errors(true); - $submissionXml = $exportFilter->execute(iterator_to_array($submissionsIterator), true); + $submissionXml = $exportFilter->execute($input, true); $xml = $submissionXml->saveXml(); $errors = array_filter(libxml_get_errors(), function($a) { return $a->level == LIBXML_ERR_ERROR || $a->level == LIBXML_ERR_FATAL; From 7ae7d66428b6c6cff485122367fa2679c6119313 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Thu, 29 Aug 2024 13:13:11 -0300 Subject: [PATCH 2/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- plugins/importexport/pubmed/PubMedExportPlugin.inc.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php index 5013d897bdf..19aa83d6939 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php @@ -165,13 +165,11 @@ function exportIssues($issueIds, $context, $user) { $sectionDao = DAORegistry::getDAO('SectionDAO'); foreach ($issueIds as $issueId) { $sections = $sectionDao->getByIssueId($issueId); + $submissionsInSections = []; + $submissionsInSections[] = Services::get('submission')->getInSections($issueId, $context->getId()); foreach ($sections as $section) { - $submissionsInSections = []; - $submissionsInSections[] = Services::get('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 fcabc5af52fa1d7f4b091427e7724bc0589c8fff Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Fri, 30 Aug 2024 09:42:13 -0300 Subject: [PATCH 3/3] pkp/pkp-lib#8564 order export by issue ordering in pubmed plugin --- plugins/importexport/pubmed/PubMedExportPlugin.inc.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php index 19aa83d6939..85015e56c44 100644 --- a/plugins/importexport/pubmed/PubMedExportPlugin.inc.php +++ b/plugins/importexport/pubmed/PubMedExportPlugin.inc.php @@ -165,12 +165,9 @@ function exportIssues($issueIds, $context, $user) { $sectionDao = DAORegistry::getDAO('SectionDAO'); foreach ($issueIds as $issueId) { $sections = $sectionDao->getByIssueId($issueId); - $submissionsInSections = []; - $submissionsInSections[] = Services::get('submission')->getInSections($issueId, $context->getId()); + $submissionsInSections = Services::get('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']); } }