Skip to content

Commit

Permalink
Merge remote-tracking branch 'touhidur/i10292_main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Jan 4, 2025
2 parents bbf17b0 + 8e0e42e commit e7d2705
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 130 deletions.
13 changes: 10 additions & 3 deletions classes/search/ArticleSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
<migration class="PKP\migration\upgrade\v3_5_0\I9707_WeblateUILocales"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10738_RemoveInvalidUserGroups"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10362_EventLogEditorNames"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10292_RemoveControlledVocabEntrySettingType"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10292_UpdateControlledVocabAssocId"/>
<migration class="PKP\migration\upgrade\v3_5_0\I10292_UpdateControlledVocabEntrySettingName"/>
</upgrade>

<!-- update plugin configuration - should be done as the final upgrade task -->
Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 77 files
+64 −79 api/v1/invitations/InvitationController.php
+25 −27 api/v1/vocabs/PKPVocabController.php
+2 −2 classes/components/forms/publication/Details.php
+5 −8 classes/components/forms/publication/PKPMetadataForm.php
+137 −56 classes/controlledVocab/ControlledVocab.php
+0 −274 classes/controlledVocab/ControlledVocabDAO.php
+142 −52 classes/controlledVocab/ControlledVocabEntry.php
+0 −294 classes/controlledVocab/ControlledVocabEntryDAO.php
+37 −0 classes/controlledVocab/ControlledVocabEntryMatch.php
+124 −0 classes/controlledVocab/Repository.php
+2 −12 classes/core/PKPApplication.php
+63 −8 classes/core/SettingsBuilder.php
+55 −0 classes/core/casts/MultilingualSettingAttribute.php
+8 −6 classes/core/traits/EntityUpdate.php
+77 −13 classes/core/traits/ModelWithSettings.php
+12 −0 classes/facades/Repo.php
+1 −2 classes/galley/Repository.php
+6 −1 classes/invitation/core/CreateInvitationController.php
+12 −7 classes/invitation/core/Invitation.php
+5 −1 classes/invitation/core/InvitationActionRedirectController.php
+1 −1 classes/invitation/invitations/changeProfileEmail/handlers/ChangeProfileEmailInviteRedirectController.php
+1 −1 classes/invitation/invitations/registrationAccess/handlers/RegistrationAccessInviteRedirectController.php
+1 −1 classes/invitation/invitations/reviewerAccess/handlers/ReviewerAccessInviteRedirectController.php
+26 −1 classes/invitation/invitations/userRoleAssignment/UserRoleAssignmentInvite.php
+12 −4 classes/invitation/invitations/userRoleAssignment/handlers/UserRoleAssignmentInviteRedirectController.php
+54 −1 classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentCreateController.php
+2 −1 classes/invitation/invitations/userRoleAssignment/handlers/api/UserRoleAssignmentReceiveController.php
+5 −1 classes/invitation/invitations/userRoleAssignment/payload/UserRoleAssignmentInvitePayload.php
+93 −0 classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php
+62 −0 classes/invitation/invitations/userRoleAssignment/resources/UserRoleAssignmentInviteManagerDataResource.php
+6 −53 classes/invitation/invitations/userRoleAssignment/resources/UserRoleAssignmentInviteResource.php
+11 −3 classes/metadata/MetadataProperty.php
+1 −2 classes/migration/install/ControlledVocabMigration.php
+42 −0 classes/migration/upgrade/v3_5_0/I10292_RemoveControlledVocabEntrySettingType.php
+53 −0 classes/migration/upgrade/v3_5_0/I10292_UpdateControlledVocabAssocId.php
+39 −0 classes/migration/upgrade/v3_5_0/I10292_UpdateControlledVocabEntrySettingName.php
+48 −50 classes/publication/DAO.php
+1 −1 classes/services/PKPSchemaService.php
+1 −1 classes/site/Version.php
+0 −56 classes/submission/SubmissionAgency.php
+0 −139 classes/submission/SubmissionAgencyDAO.php
+0 −61 classes/submission/SubmissionAgencyEntryDAO.php
+0 −56 classes/submission/SubmissionDiscipline.php
+0 −140 classes/submission/SubmissionDisciplineDAO.php
+0 −61 classes/submission/SubmissionDisciplineEntryDAO.php
+0 −56 classes/submission/SubmissionKeyword.php
+0 −161 classes/submission/SubmissionKeywordDAO.php
+0 −62 classes/submission/SubmissionKeywordEntryDAO.php
+0 −60 classes/submission/SubmissionLanguage.php
+0 −141 classes/submission/SubmissionLanguageDAO.php
+0 −64 classes/submission/SubmissionLanguageEntryDAO.php
+0 −59 classes/submission/SubmissionSubject.php
+0 −141 classes/submission/SubmissionSubjectDAO.php
+0 −61 classes/submission/SubmissionSubjectEntryDAO.php
+0 −162 classes/user/InterestDAO.php
+0 −50 classes/user/InterestEntry.php
+0 −100 classes/user/InterestEntryDAO.php
+0 −105 classes/user/InterestManager.php
+2 −2 classes/user/User.php
+1 −3 classes/user/form/RegistrationForm.php
+8 −7 classes/user/form/RolesForm.php
+145 −0 classes/user/interest/Repository.php
+109 −0 classes/user/interest/UserInterest.php
+7 −12 classes/user/maps/Schema.php
+17 −29 classes/validation/ValidatorControlledVocab.php
+2 −5 controllers/grid/settings/user/form/UserDetailsForm.php
+1 −3 controllers/grid/users/reviewer/form/CreateReviewerForm.php
+3 −0 locale/en/invitation.po
+2 −2 pages/user/PKPUserHandler.php
+14 −8 plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.php
+14 −8 plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.php
+1 −3 plugins/importexport/users/filter/PKPUserUserXmlFilter.php
+1 −3 plugins/importexport/users/filter/UserXmlPKPUserFilter.php
+44 −47 tests/classes/form/validation/FormValidatorControlledVocabTest.php
+29 −23 tests/classes/metadata/MetadataPropertyTest.php
+0 −8 tests/classes/publication/PublicationTest.php
+39 −46 tests/classes/validation/ValidatorControlledVocabTest.php
2 changes: 1 addition & 1 deletion plugins/generic/citationStyleLanguage
13 changes: 8 additions & 5 deletions plugins/importexport/doaj/filter/DOAJJsonFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions plugins/importexport/doaj/filter/DOAJXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
Expand Down
19 changes: 13 additions & 6 deletions plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
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;
use PKP\metadata\MetadataDataObjectAdapter;
use PKP\metadata\MetadataDescription;
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
use PKP\submission\SubmissionKeywordDAO;
use PKP\submission\SubmissionSubjectDAO;

class Dc11SchemaArticleAdapter extends MetadataDataObjectAdapter
{
Expand Down Expand Up @@ -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);

Expand Down
41 changes: 19 additions & 22 deletions plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @defgroup plugins_oaiMetadataFormats_dc_tests Dublin Core OAI Plugin
*/
Expand Down Expand Up @@ -35,18 +36,18 @@
use APP\section\Section;
use APP\submission\Submission;
use Illuminate\Support\LazyCollection;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\MockObject\MockObject;
use PKP\author\Repository as AuthorRepository;
use PKP\controlledVocab\Repository as ControlledVocabRepository;
use PKP\core\Dispatcher;
use PKP\core\Registry;
use PKP\db\DAORegistry;
use PKP\doi\Doi;
use PKP\galley\Collector as GalleyCollector;
use PKP\galley\Galley;
use PKP\oai\OAIRecord;
use PKP\submission\SubmissionKeywordDAO;
use PKP\submission\SubmissionSubjectDAO;
use PKP\tests\PKPTestCase;

#[CoversClass(OAIMetadataFormat_DC::class)]
Expand All @@ -58,7 +59,7 @@ class OAIMetadataFormat_DCTest extends PKPTestCase
*/
protected function getMockedDAOs(): array
{
return [...parent::getMockedDAOs(), 'OAIDAO', 'SubmissionSubjectDAO', 'SubmissionKeywordDAO'];
return [...parent::getMockedDAOs(), 'OAIDAO'];
}

/**
Expand All @@ -79,6 +80,19 @@ protected function getMockedContainerKeys(): array

public function testToXml()
{
$controlledVocabRepoMock = Mockery::mock(ControlledVocabRepository::class)
->makePartial()
->shouldReceive('getBySymbolic')
->twice()
->withAnyArgs()
->andReturn(
['en' => ['article-keyword']],
['en' => ['article-subject', 'article-subject-class']]
)
->getMock();

app()->instance(ControlledVocabRepository::class, $controlledVocabRepoMock);

//
// Create test data.
//
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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
//
Expand Down
2 changes: 1 addition & 1 deletion plugins/oaiMetadataFormats/oaiJats
26 changes: 14 additions & 12 deletions plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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()] ?? '';

Expand Down
39 changes: 25 additions & 14 deletions plugins/reports/articles/ArticleReportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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[] = [
Expand Down
2 changes: 1 addition & 1 deletion plugins/reports/reviewReport
Loading

0 comments on commit e7d2705

Please sign in to comment.