diff --git a/classes/search/ArticleSearch.php b/classes/search/ArticleSearch.php
index b9a48994156..b67453a5fb7 100644
--- a/classes/search/ArticleSearch.php
+++ b/classes/search/ArticleSearch.php
@@ -23,6 +23,7 @@
use APP\core\Request;
use APP\facades\Repo;
use APP\issue\IssueAction;
+use PKP\controlledVocab\ControlledVocab;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\plugins\Hook;
@@ -200,7 +201,7 @@ public function getSearchFilters($request)
$context = $contextDao->getById($searchFilters['searchJournal']);
} elseif (array_key_exists('journalTitle', $request->getUserVars())) {
$contexts = $contextDao->getAll(true);
- while ($context = $contexts->next()) {
+ while ($context = $contexts->next()) { /** @var \PKP\context\Context $context */
if (in_array(
$request->getUserVar('journalTitle'),
(array) $context->getName(null)
@@ -334,8 +335,14 @@ public function getSimilarityTerms($submissionId)
$article = Repo::submission()->get($submissionId);
if ($article->getData('status') === PKPSubmission::STATUS_PUBLISHED) {
// Retrieve keywords (if any).
- $submissionSubjectDao = DAORegistry::getDAO('SubmissionKeywordDAO'); /** @var \PKP\submission\SubmissionKeywordDAO $submissionSubjectDao */
- $allSearchTerms = array_filter($submissionSubjectDao->getKeywords($article->getCurrentPublication()->getId(), [Locale::getLocale(), $article->getData('locale'), Locale::getPrimaryLocale()]));
+ $allSearchTerms = array_filter(
+ Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $article->getCurrentPublication()->getId(),
+ [Locale::getLocale(), $article->getData('locale'), Locale::getPrimaryLocale()]
+ )
+ );
foreach ($allSearchTerms as $locale => $localeSearchTerms) {
$searchTerms += $localeSearchTerms;
}
diff --git a/dbscripts/xml/upgrade.xml b/dbscripts/xml/upgrade.xml
index 2433aaceda1..25b9f06ad68 100644
--- a/dbscripts/xml/upgrade.xml
+++ b/dbscripts/xml/upgrade.xml
@@ -154,6 +154,9 @@
+
+
+
diff --git a/lib/pkp b/lib/pkp
index b48b679bf1a..025a6fc71ad 160000
--- a/lib/pkp
+++ b/lib/pkp
@@ -1 +1 @@
-Subproject commit b48b679bf1ac19112641b8d0c8599121b6efa6ae
+Subproject commit 025a6fc71ade25af6dfd75ba27a0be82e22db6c9
diff --git a/plugins/generic/citationStyleLanguage b/plugins/generic/citationStyleLanguage
index c7e90faf16a..97c5752329e 160000
--- a/plugins/generic/citationStyleLanguage
+++ b/plugins/generic/citationStyleLanguage
@@ -1 +1 @@
-Subproject commit c7e90faf16ac230e1869bcf51c3beb89203113b8
+Subproject commit 97c5752329e4c5b7b01915b66e6e00c234eddab7
diff --git a/plugins/generic/jatsTemplate b/plugins/generic/jatsTemplate
index 1d9cb8424a4..578de22ea4c 160000
--- a/plugins/generic/jatsTemplate
+++ b/plugins/generic/jatsTemplate
@@ -1 +1 @@
-Subproject commit 1d9cb8424a4a21b37458d482ee7ab92539adb973
+Subproject commit 578de22ea4c97d678a7b0242ba09ec9f019b6578
diff --git a/plugins/importexport/doaj/filter/DOAJJsonFilter.php b/plugins/importexport/doaj/filter/DOAJJsonFilter.php
index e78518132af..ce0011000f8 100644
--- a/plugins/importexport/doaj/filter/DOAJJsonFilter.php
+++ b/plugins/importexport/doaj/filter/DOAJJsonFilter.php
@@ -20,10 +20,9 @@
use APP\facades\Repo;
use APP\plugins\importexport\doaj\DOAJExportDeployment;
use APP\plugins\importexport\doaj\DOAJExportPlugin;
+use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPString;
-use PKP\db\DAORegistry;
use PKP\plugins\importexport\PKPImportExportFilter;
-use PKP\submission\SubmissionKeywordDAO;
class DOAJJsonFilter extends PKPImportExportFilter
{
@@ -176,9 +175,13 @@ public function &process(&$pubObject)
$article['bibjson']['abstract'] = PKPString::html2text($abstract);
}
// Keywords
- /** @var SubmissionKeywordDAO */
- $dao = DAORegistry::getDAO('SubmissionKeywordDAO');
- $keywords = $dao->getKeywords($publication->getId(), [$publicationLocale]);
+ $keywords = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $publication->getId(),
+ [$publicationLocale]
+ );
+
$allowedNoOfKeywords = array_slice($keywords[$publicationLocale] ?? [], 0, 6);
if (!empty($keywords[$publicationLocale])) {
$article['bibjson']['keywords'] = $allowedNoOfKeywords;
diff --git a/plugins/importexport/doaj/filter/DOAJXmlFilter.php b/plugins/importexport/doaj/filter/DOAJXmlFilter.php
index d5817b9f28f..06624a950c3 100644
--- a/plugins/importexport/doaj/filter/DOAJXmlFilter.php
+++ b/plugins/importexport/doaj/filter/DOAJXmlFilter.php
@@ -20,10 +20,9 @@
use APP\plugins\importexport\doaj\DOAJExportPlugin;
use APP\publication\Publication;
use APP\submission\Submission;
+use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPString;
-use PKP\db\DAORegistry;
use PKP\i18n\LocaleConversion;
-use PKP\submission\SubmissionKeywordDAO;
class DOAJXmlFilter extends \PKP\plugins\importexport\native\filter\NativeExportFilter
{
@@ -189,16 +188,22 @@ public function &process(&$pubObjects)
$request = Application::get()->getRequest();
$recordNode->appendChild($node = $doc->createElement('fullTextUrl', htmlspecialchars($request->getDispatcher()->url($request, Application::ROUTE_PAGE, null, 'article', 'view', [$pubObject->getId()], urlLocaleForPage: ''), ENT_COMPAT, 'UTF-8')));
$node->setAttribute('format', 'html');
+
// Keywords
$supportedLocales = $context->getSupportedFormLocales();
- /** @var SubmissionKeywordDAO */
- $dao = DAORegistry::getDAO('SubmissionKeywordDAO');
- $articleKeywords = $dao->getKeywords($publication->getId(), $supportedLocales);
+ $articleKeywords = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $publication->getId(),
+ $supportedLocales
+ );
+
if (array_key_exists($publication->getData('locale'), $articleKeywords)) {
$keywordsInArticleLocale = $articleKeywords[$publication->getData('locale')];
unset($articleKeywords[$publication->getData('locale')]);
$articleKeywords = array_merge([$publication->getData('locale') => $keywordsInArticleLocale], $articleKeywords);
}
+
foreach ($articleKeywords as $locale => $keywords) {
$keywordsNode = $doc->createElement('keywords');
$keywordsNode->setAttribute('language', LocaleConversion::get3LetterIsoFromLocale($locale));
diff --git a/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php b/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php
index dc8aa4d1758..653af06dd7b 100644
--- a/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php
+++ b/plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php
@@ -28,6 +28,7 @@
use APP\oai\ojs\OAIDAO;
use APP\plugins\PubIdPlugin;
use APP\submission\Submission;
+use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
@@ -35,8 +36,6 @@
use PKP\metadata\MetadataDescription;
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
-use PKP\submission\SubmissionKeywordDAO;
-use PKP\submission\SubmissionSubjectDAO;
class Dc11SchemaArticleAdapter extends MetadataDataObjectAdapter
{
@@ -90,12 +89,20 @@ public function &extractMetadataFromDataObject(&$article)
}
// Subject
- $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO'); /** @var SubmissionKeywordDAO $submissionKeywordDao */
- $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO'); /** @var SubmissionSubjectDAO $submissionSubjectDao */
$supportedLocales = $journal->getSupportedFormLocales();
$subjects = array_merge_recursive(
- (array) $submissionKeywordDao->getKeywords($publication->getId(), $supportedLocales),
- (array) $submissionSubjectDao->getSubjects($publication->getId(), $supportedLocales)
+ Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $publication->getId(),
+ $supportedLocales
+ ),
+ Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $publication->getId(),
+ $supportedLocales
+ )
);
$this->_addLocalizedElements($dc11Description, 'dc:subject', $subjects);
diff --git a/plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php b/plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
index 71449fcd7cf..a6e53f1b5cf 100755
--- a/plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
+++ b/plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
@@ -1,4 +1,5 @@
makePartial()
+ ->shouldReceive('getBySymbolic')
+ ->twice()
+ ->withAnyArgs()
+ ->andReturn(
+ ['en' => ['article-keyword']],
+ ['en' => ['article-subject', 'article-subject-class']]
+ )
+ ->getMock();
+
+ app()->instance(ControlledVocabRepository::class, $controlledVocabRepoMock);
+
//
// Create test data.
//
@@ -102,6 +116,7 @@ public function testToXml()
$publication = $this->getMockBuilder(Publication::class)
->onlyMethods([])
->getMock();
+ $publication->setData('id', 0);
$publication->setData('issueId', 96);
$publication->setData('pages', 15);
$publication->setData('type', 'art-type', 'en');
@@ -167,6 +182,7 @@ public function testToXml()
->willReturn(Journal::PUBLISHING_MODE_OPEN);
$journal->setName('journal-title', 'en');
$journal->setData('publisherInstitution', 'journal-publisher');
+ $journal->setData('supportedFormLocales', []);
$journal->setPrimaryLocale('en');
$journal->setPath('journal-path');
$journal->setData('onlineIssn', 'onlineIssn');
@@ -263,25 +279,6 @@ public function testToXml()
->willReturn(LazyCollection::wrap($galleys));
app()->instance(GalleyCollector::class, $mockGalleyCollector);
- // Mocked DAO to return the subjects
- $submissionSubjectDao = $this->getMockBuilder(SubmissionSubjectDAO::class)
- ->onlyMethods(['getSubjects'])
- ->getMock();
- $submissionSubjectDao->expects($this->any())
- ->method('getSubjects')
- ->willReturn(['en' => ['article-subject', 'article-subject-class']]);
- DAORegistry::registerDAO('SubmissionSubjectDAO', $submissionSubjectDao);
-
- // Mocked DAO to return the keywords
- $submissionKeywordDao = $this->getMockBuilder(SubmissionKeywordDAO::class)
- ->onlyMethods(['getKeywords'])
- ->getMock();
- $submissionKeywordDao->expects($this->any())
- ->method('getKeywords')
- ->willReturn(['en' => ['article-keyword']]);
- DAORegistry::registerDAO('SubmissionKeywordDAO', $submissionKeywordDao);
-
-
//
// Test
//
diff --git a/plugins/oaiMetadataFormats/oaiJats b/plugins/oaiMetadataFormats/oaiJats
index 51bf1b373ed..ba44cdfa425 160000
--- a/plugins/oaiMetadataFormats/oaiJats
+++ b/plugins/oaiMetadataFormats/oaiJats
@@ -1 +1 @@
-Subproject commit 51bf1b373ed3ed275c7b904aa3ad564411431f7a
+Subproject commit ba44cdfa42596bf93e6ba454d58eaba796159474
diff --git a/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php b/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
index fd405c7de64..e90b6092470 100644
--- a/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
+++ b/plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
@@ -17,17 +17,15 @@
namespace APP\plugins\oaiMetadataFormats\rfc1807;
use APP\core\Application;
+use APP\facades\Repo;
use APP\issue\Issue;
use APP\issue\IssueAction;
use APP\journal\Journal;
use APP\publication\Publication;
-use APP\section\Section;
use APP\submission\Submission;
-use PKP\db\DAORegistry;
+use PKP\controlledVocab\ControlledVocab;
use PKP\oai\OAIMetadataFormat;
use PKP\oai\OAIUtils;
-use PKP\submission\SubmissionKeywordDAO;
-use PKP\submission\SubmissionSubjectDAO;
class OAIMetadataFormat_RFC1807 extends OAIMetadataFormat
{
@@ -79,15 +77,19 @@ public function toXml($record, $format = null)
$supportedLocales = $journal->getSupportedFormLocales();
- /** @var SubmissionKeywordDAO $submissionKeywordDao */
- $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO');
-
- /** @var SubmissionSubjectDAO $submissionSubjectDao */
- $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO');
-
$subjects = array_merge_recursive(
- (array) $submissionKeywordDao->getKeywords($publication->getId(), $supportedLocales),
- (array) $submissionSubjectDao->getSubjects($publication->getId(), $supportedLocales)
+ Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $publication->getId(),
+ $supportedLocales
+ ),
+ Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $article->getCurrentPublication()->getId(),
+ $supportedLocales
+ )
);
$subject = $subjects[$journal->getPrimaryLocale()] ?? '';
diff --git a/plugins/reports/articles/ArticleReportPlugin.php b/plugins/reports/articles/ArticleReportPlugin.php
index 4e454bec270..f14c6da8e62 100644
--- a/plugins/reports/articles/ArticleReportPlugin.php
+++ b/plugins/reports/articles/ArticleReportPlugin.php
@@ -16,18 +16,15 @@
namespace APP\plugins\reports\articles;
+use APP\core\Application;
use APP\decision\Decision;
use APP\facades\Repo;
-use PKP\db\DAORegistry;
+use PKP\controlledVocab\ControlledVocab;
use PKP\facades\Locale;
use PKP\plugins\ReportPlugin;
use PKP\security\Role;
use PKP\stageAssignment\StageAssignment;
use PKP\submission\PKPSubmission;
-use PKP\submission\SubmissionAgencyDAO;
-use PKP\submission\SubmissionDisciplineDAO;
-use PKP\submission\SubmissionKeywordDAO;
-use PKP\submission\SubmissionSubjectDAO;
use PKP\userGroup\UserGroup;
class ArticleReportPlugin extends ReportPlugin
@@ -86,11 +83,6 @@ public function display($args, $request)
// Add BOM (byte order mark) to fix UTF-8 in Excel
fprintf($fp, chr(0xEF) . chr(0xBB) . chr(0xBF));
- $submissionKeywordDao = DAORegistry::getDAO('SubmissionKeywordDAO'); /** @var SubmissionKeywordDAO $submissionKeywordDao */
- $submissionSubjectDao = DAORegistry::getDAO('SubmissionSubjectDAO'); /** @var SubmissionSubjectDAO $submissionSubjectDao */
- $submissionDisciplineDao = DAORegistry::getDAO('SubmissionDisciplineDAO'); /** @var SubmissionDisciplineDAO $submissionDisciplineDao */
- $submissionAgencyDao = DAORegistry::getDAO('SubmissionAgencyDAO'); /** @var SubmissionAgencyDAO $submissionAgencyDao */
-
$userGroups = UserGroup::withContextIds([$context->getId()])
->get()
->all();
@@ -159,10 +151,29 @@ public function display($args, $request)
$sectionTitles[$sectionId] = $section->getLocalizedTitle();
}
- $subjects = $submissionSubjectDao->getSubjects($submission->getCurrentPublication()->getId());
- $disciplines = $submissionDisciplineDao->getDisciplines($submission->getCurrentPublication()->getId());
- $keywords = $submissionKeywordDao->getKeywords($submission->getCurrentPublication()->getId());
- $agencies = $submissionAgencyDao->getAgencies($submission->getCurrentPublication()->getId());
+ $subjects = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $submission->getCurrentPublication()->getId()
+ );
+
+ $disciplines = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_DISCIPLINE,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $submission->getCurrentPublication()->getId()
+ );
+
+ $keywords = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $submission->getCurrentPublication()->getId()
+ );
+
+ $agencies = Repo::controlledVocab()->getBySymbolic(
+ ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_AGENCY,
+ Application::ASSOC_TYPE_PUBLICATION,
+ $submission->getCurrentPublication()->getId()
+ );
// Store the submission results
$results[] = [
diff --git a/plugins/reports/reviewReport b/plugins/reports/reviewReport
index 14906b4ced0..0481ed0af93 160000
--- a/plugins/reports/reviewReport
+++ b/plugins/reports/reviewReport
@@ -1 +1 @@
-Subproject commit 14906b4ced04cbce66d6d8404a56bca9664b8d82
+Subproject commit 0481ed0af93d3cfb38431e4c755572775a397755
diff --git a/tools/cleanReviewerInterests.php b/tools/cleanReviewerInterests.php
index e395dac777b..b1859287768 100755
--- a/tools/cleanReviewerInterests.php
+++ b/tools/cleanReviewerInterests.php
@@ -3,8 +3,8 @@
/**
* @file tools/cleanReviewerInterests.php
*
- * Copyright (c) 2014-2021 Simon Fraser University
- * Copyright (c) 2003-2021 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 ReviewerInterestsDeletionTool
@@ -16,11 +16,12 @@
require(dirname(__FILE__) . '/bootstrap.php');
+use APP\core\Application;
+use APP\facades\Repo;
+use Illuminate\Support\Collection;
use PKP\cliTool\CommandLineTool;
-use PKP\controlledVocab\ControlledVocabDAO;
-use PKP\controlledVocab\ControlledVocabEntryDAO;
-use PKP\db\DAORegistry;
-use PKP\user\InterestDAO;
+use PKP\controlledVocab\ControlledVocabEntry;
+use PKP\user\interest\UserInterest;
class ReviewerInterestsDeletionTool extends CommandLineTool
{
@@ -57,10 +58,10 @@ public function usage()
/**
* Remove user interests that are not referenced by any user account
*/
- public function execute()
+ public function execute(): void
{
$orphans = $this->_getOrphanVocabInterests();
- if (!count($orphans)) {
+ if ($orphans->count() === 0) {
echo "No user interests to remove.\n";
exit(0);
}
@@ -68,20 +69,13 @@ public function execute()
$command = $this->parameters[0];
switch ($command) {
case '--show':
- $interests = array_map(function ($entry) {
- return $entry->getData(InterestDAO::CONTROLLED_VOCAB_INTEREST);
- }, $orphans);
+ $interests = $orphans->pluck(UserInterest::CONTROLLED_VOCAB_INTEREST)->toArray();
echo "Below are the user interests that are not referenced by any user account.\n";
echo "\t" . join("\n\t", $interests) . "\n";
break;
case '--remove':
- /** @var ControlledVocabEntryDAO */
- $vocabEntryDao = DAORegistry::getDAO('ControlledVocabEntryDAO');
- foreach ($orphans as $orphanVocab) {
- $vocabEntryDao->deleteObject($orphanVocab);
- }
- echo count($orphans) . " entries deleted\n";
+ echo $orphans->toQuery()->delete() . " entries deleted\n";
break;
default:
@@ -92,51 +86,20 @@ public function execute()
}
/**
- * Returns user interests that are not referenced
- *
- * @return array array of ControlledVocabEntry object
+ * Returns user interests collection that are not referenced
*/
- protected function _getOrphanVocabInterests()
+ protected function _getOrphanVocabInterests(): Collection
{
- /** @var InterestDAO */
- $interestDao = DAORegistry::getDAO('InterestDAO');
- /** @var ControlledVocabDAO */
- $vocabDao = DAORegistry::getDAO('ControlledVocabDAO');
- /** @var ControlledVocabEntryDAO */
- $vocabEntryDao = DAORegistry::getDAO('ControlledVocabEntryDAO');
-
- $interestVocab = $vocabDao->getBySymbolic(InterestDAO::CONTROLLED_VOCAB_INTEREST);
- $vocabEntryIterator = $vocabEntryDao->getByControlledVocabId($interestVocab->getId());
- $vocabEntryList = $vocabEntryIterator->toArray();
-
- // list of vocab interests in db
- $allInterestVocabIds = array_map(
- function ($entry) {
- return $entry->getId();
- },
- $vocabEntryList
- );
-
- // list of vocabs associated to users
- $interests = $interestDao->getAllInterests();
- $userInterestVocabIds = array_map(
- function ($interest) {
- return $interest->getId();
- },
- $interests->toArray()
- );
-
- // get the difference
- $diff = array_diff($allInterestVocabIds, $userInterestVocabIds);
-
- $orphans = array_filter(
- $vocabEntryList,
- function ($entry) use ($diff) {
- return in_array($entry->getId(), $diff);
- }
+ $controlledVocab = Repo::controlledVocab()->build(
+ UserInterest::CONTROLLED_VOCAB_INTEREST,
+ Application::ASSOC_TYPE_SITE,
+ Application::SITE_CONTEXT_ID,
);
- return $orphans;
+ return ControlledVocabEntry::query()
+ ->withControlledVocabId($controlledVocab->id)
+ ->whereDoesntHave('userInterest')
+ ->get();
}
}