diff --git a/api/v1/_dois/BackendDoiController.php b/api/v1/_dois/BackendDoiController.php index 1d06d8dfcb5..699c7b885fc 100644 --- a/api/v1/_dois/BackendDoiController.php +++ b/api/v1/_dois/BackendDoiController.php @@ -22,8 +22,8 @@ use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Route; -use Illuminate\Support\LazyCollection; use PKP\db\DAORegistry; +use PKP\userGroup\UserGroup; class BackendDoiController extends \PKP\API\v1\_dois\PKPBackendDoiController { @@ -129,6 +129,7 @@ public function editIssue(Request $illuminateRequest): JsonResponse Repo::issue()->edit($issue, ['doiId' => $doi->getId()]); $issue = Repo::issue()->get($issue->getId()); + $userGroups = UserGroup::withContextIds([$context->getId()])->get(); return response()->json( Repo::issue() @@ -136,20 +137,13 @@ public function editIssue(Request $illuminateRequest): JsonResponse ->map( $issue, $context, - $this->getUserGroups($context->getId()), + $userGroups, $this->getGenres($context->getId()) ), Response::HTTP_OK ); } - protected function getUserGroups(int $contextId): LazyCollection - { - return Repo::userGroup()->getCollector() - ->filterByContextIds([$contextId]) - ->getMany(); - } - protected function getGenres(int $contextId): array { /** @var \PKP\submission\GenreDAO $genreDao */ diff --git a/api/v1/issues/IssueController.php b/api/v1/issues/IssueController.php index f0eddb9e84c..bee6e5284e0 100644 --- a/api/v1/issues/IssueController.php +++ b/api/v1/issues/IssueController.php @@ -25,8 +25,8 @@ use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Route; -use Illuminate\Support\LazyCollection; use PKP\core\PKPBaseController; use PKP\core\PKPRequest; use PKP\db\DAORegistry; @@ -36,6 +36,7 @@ use PKP\security\authorization\UserRolesRequiredPolicy; use PKP\security\Role; use PKP\submission\GenreDAO; +use PKP\userGroup\UserGroup; class IssueController extends PKPBaseController { @@ -266,11 +267,9 @@ public function get(Request $illuminateRequest): JsonResponse return response()->json($data, Response::HTTP_OK); } - protected function getUserGroups(int $contextId): LazyCollection + protected function getUserGroups(int $contextId): Collection { - return Repo::userGroup()->getCollector() - ->filterByContextIds([$contextId]) - ->getMany(); + return UserGroup::withContextIds([$contextId])->get(); } protected function getGenres(int $contextId): array diff --git a/classes/issue/maps/Schema.php b/classes/issue/maps/Schema.php index 43d2da6df99..66087192722 100644 --- a/classes/issue/maps/Schema.php +++ b/classes/issue/maps/Schema.php @@ -19,7 +19,6 @@ use APP\issue\IssueGalleyDAO; use APP\journal\Journal; use Illuminate\Support\Enumerable; -use Illuminate\Support\LazyCollection; use PKP\db\DAORegistry; use PKP\services\PKPSchemaService; use PKP\submission\Genre; @@ -33,8 +32,8 @@ class Schema extends \PKP\core\maps\Schema /** @copydoc \PKP\core\maps\Schema::$schema */ public string $schema = PKPSchemaService::SCHEMA_ISSUE; - /** @var LazyCollection The user groups for this context. */ - public LazyCollection $userGroups; + /** @var Enumerable The user groups for this context. */ + public Enumerable $userGroups; /** @var Genre[] The genres for this context. */ public array $genres; @@ -44,10 +43,10 @@ class Schema extends \PKP\core\maps\Schema * * Includes all properties in the Issue schema * - * @param LazyCollection $userGroups The user groups of this content + * @param Enumerable $userGroups The user groups of this content * @param Genre[] $genres The genres of this context */ - public function map(Issue $item, Journal $context, LazyCollection $userGroups, array $genres): array + public function map(Issue $item, Journal $context, Enumerable $userGroups, array $genres): array { $this->userGroups = $userGroups; $this->genres = $genres; @@ -71,10 +70,10 @@ public function summarize(Issue $item, Journal $context): array * * @see self::map * - * @param LazyCollection $userGroups The user groups of this content + * @param Enumerable $userGroups The user groups of this content * @param Genre[] $genres The genres of this context */ - public function mapMany(Enumerable $collection, Journal $context, LazyCollection $userGroups, array $genres): Enumerable + public function mapMany(Enumerable $collection, Journal $context, Enumerable $userGroups, array $genres): Enumerable { $this->collection = $collection; return $collection->map(function ($item) use ($context, $userGroups, $genres) { diff --git a/classes/search/ArticleSearch.php b/classes/search/ArticleSearch.php index 7d25044fd42..b9a48994156 100644 --- a/classes/search/ArticleSearch.php +++ b/classes/search/ArticleSearch.php @@ -28,6 +28,7 @@ use PKP\plugins\Hook; use PKP\search\SubmissionSearch; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class ArticleSearch extends SubmissionSearch { @@ -77,7 +78,7 @@ public function getSparseArray($unorderedResults, $orderBy, $orderDir, $exclude) } $i = 0; // Used to prevent ties from clobbering each other - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->getMany(); + $authorUserGroups = UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->get(); foreach ($unorderedResults as $submissionId => $data) { // Exclude unwanted IDs. if (in_array($submissionId, $exclude)) { diff --git a/classes/submission/Submission.php b/classes/submission/Submission.php index d908ec2208d..fc76076059c 100644 --- a/classes/submission/Submission.php +++ b/classes/submission/Submission.php @@ -26,8 +26,8 @@ use APP\facades\Repo; use APP\publication\Publication; -use PKP\facades\Locale; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class Submission extends PKPSubmission { @@ -69,7 +69,10 @@ public function _getContextLicenseFieldValue($locale, $field, $publication = nul $publication = $this->getCurrentPublication(); } - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$context->getId()])->getMany(); + $authorUserGroups = UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) + ->withContextIds([$context->getId()]) + ->get(); + $fieldValue = [$context->getPrimaryLocale() => $publication->getAuthorString($authorUserGroups)]; break; case 'context': diff --git a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php index bf7d57978df..e1b3e449e94 100644 --- a/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php +++ b/controllers/grid/users/subscriberSelect/SubscriberSelectGridHandler.php @@ -25,6 +25,7 @@ use PKP\controllers\grid\users\userSelect\UserSelectGridCellProvider; use PKP\security\authorization\ContextAccessPolicy; use PKP\security\Role; +use PKP\userGroup\UserGroup; class SubscriberSelectGridHandler extends GridHandler { @@ -64,14 +65,16 @@ public function initialize($request, $args = null) { parent::initialize($request, $args); + $builder = UserGroup::withContextIds([$request->getContext()->getId()]); $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); - $userGroups = Repo::userGroup()->getUserGroupsByStage( - $request->getContext()->getId(), - $stageId - ); + if ($stageId) { + $builder->withStageIds([$stageId]); + } + $userGroups = $builder->get(); + $this->_userGroupOptions = []; foreach ($userGroups as $userGroup) { - $this->_userGroupOptions[$userGroup->getId()] = $userGroup->getLocalizedName(); + $this->_userGroupOptions[$userGroup->id] = $userGroup->getLocalizedData('name'); } $this->setTitle('editor.submission.findAndSelectUser'); @@ -146,14 +149,12 @@ protected function loadData($request, $filter) */ public function renderFilter($request, $filterData = []) { - $context = $request->getContext(); - $userGroups = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->getMany(); + $contextId = $request->getContext()->getId(); + $userGroups = UserGroup::withContextIds([$contextId])->get(); $userGroupOptions = ['' => __('grid.user.allRoles')]; foreach ($userGroups as $userGroup) { - $userGroupOptions[$userGroup->getId()] = $userGroup->getLocalizedName(); + $userGroupOptions[$userGroup->id] = $userGroup->getLocalizedData('name'); } return parent::renderFilter( diff --git a/cypress/tests/data/60-content/AmwandengaSubmission.cy.js b/cypress/tests/data/60-content/AmwandengaSubmission.cy.js index 151ef5f4bbc..b38cc86e5a1 100644 --- a/cypress/tests/data/60-content/AmwandengaSubmission.cy.js +++ b/cypress/tests/data/60-content/AmwandengaSubmission.cy.js @@ -395,7 +395,7 @@ describe('Data suite: Amwandenga', function() { it('Allow author to edit publication details', function() { cy.login('dbarnes'); cy.visit('/index.php/publicknowledge/workflow/access/' + submission.id); - cy.get('button[aria-label="Alan Mwandenga More Actions"]').click(); + cy.get('button[aria-label="Alan Mwandenga More Actions"]').scrollIntoView().should('be.visible').click(); cy.get('button:contains("Edit")').click(); cy.get('[name="canChangeMetadata"]').check(); cy.get('[id^="submitFormButton"]').contains('OK').click(); @@ -464,7 +464,7 @@ describe('Data suite: Amwandenga', function() { cy.get('button').contains('Create New Version').click(); cy.contains('Are you sure you want to create a new version?'); cy.get('div[role=dialog]:contains("Create New Version")').get('button').contains('Yes').click(); - + // Once there is 'in progress' overlay when creating new version this can be improved cy.wait(10000); diff --git a/lib/pkp b/lib/pkp index 731d29129e1..d05f1af72f3 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit 731d29129e17d6d941a47c6a9a34aa30b566974a +Subproject commit d05f1af72f322c6b3ff241f8185292ca71990f35 diff --git a/pages/article/ArticleHandler.php b/pages/article/ArticleHandler.php index a40ad52ec32..462fd9716f3 100644 --- a/pages/article/ArticleHandler.php +++ b/pages/article/ArticleHandler.php @@ -42,6 +42,7 @@ use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; use PKP\submissionFile\SubmissionFile; +use PKP\userGroup\UserGroup; use stdClass; class ArticleHandler extends Handler @@ -286,7 +287,9 @@ public function view($args, $request) $templateMgr->assign([ 'primaryGalleys' => $primaryGalleys, 'supplementaryGalleys' => $supplementaryGalleys, - 'userGroupsById' => Repo::userGroup()->getCollector()->filterByPublicationIds([$this->publication->getId()])->getMany()->toArray() + 'userGroupsById' => UserGroup::withPublicationIds([$this->publication->getId()]) + ->get() + ->all() ]); // Citations diff --git a/pages/issue/IssueHandler.php b/pages/issue/IssueHandler.php index 8b2cd2aeca9..4ffbeda02ab 100644 --- a/pages/issue/IssueHandler.php +++ b/pages/issue/IssueHandler.php @@ -41,6 +41,7 @@ use PKP\security\Validation; use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; +use PKP\userGroup\UserGroup; class IssueHandler extends Handler { @@ -390,7 +391,10 @@ public static function _setupIssueTemplate(Request $request, Issue $issue, ?Jour $issueSubmissionsInSection[$sectionId]['articles'][] = $submission; } - $authorUserGroups = Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$journal->getId()])->getMany()->remember(); + $authorUserGroups = UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) + ->withContextIds([$journal->getId()]) + ->get(); + $templateMgr->assign([ 'issue' => $issue, 'issueGalleys' => $issueGalleyDao->getByIssueId($issue->getId()), diff --git a/pages/search/SearchHandler.php b/pages/search/SearchHandler.php index 2010a9bff7b..335a149b5e7 100644 --- a/pages/search/SearchHandler.php +++ b/pages/search/SearchHandler.php @@ -21,6 +21,7 @@ use APP\search\ArticleSearch; use APP\security\authorization\OjsJournalMustPublishPolicy; use APP\template\TemplateManager; +use PKP\userGroup\UserGroup; class SearchHandler extends Handler { @@ -166,10 +167,9 @@ public function search($args, $request) 'simDocsEnabled' => true, 'results' => $results, 'error' => $error, - 'authorUserGroups' => Repo::userGroup()->getCollector() - ->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) - ->filterByContextIds($searchFilters['searchJournal'] ? [$searchFilters['searchJournal']->getId()] : null) - ->getMany()->remember(), + 'authorUserGroups' => UserGroup::withRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR]) + ->withContextIds($searchFilters['searchJournal'] ? [$searchFilters['searchJournal']->getId()] : null) + ->get(), 'searchResultOrderOptions' => $articleSearch->getResultSetOrderingOptions($request), 'searchResultOrderDirOptions' => $articleSearch->getResultSetOrderingDirectionOptions(), ]); diff --git a/plugins/generic/citationStyleLanguage b/plugins/generic/citationStyleLanguage index e2d5a1f17d8..904daa2197c 160000 --- a/plugins/generic/citationStyleLanguage +++ b/plugins/generic/citationStyleLanguage @@ -1 +1 @@ -Subproject commit e2d5a1f17d8b854de35ca96d747c17bc3ca69a61 +Subproject commit 904daa2197c709b28b754a26b9828c2ba0629719 diff --git a/plugins/generic/webFeed b/plugins/generic/webFeed index 7e99fa5c1dc..ebed779fff0 160000 --- a/plugins/generic/webFeed +++ b/plugins/generic/webFeed @@ -1 +1 @@ -Subproject commit 7e99fa5c1dc42c1b1e6f3588e5c894cdb9d92dff +Subproject commit ebed779fff0bc97dca563ed70c761c32445fcf81 diff --git a/plugins/oaiMetadataFormats/oaiJats b/plugins/oaiMetadataFormats/oaiJats index 7699c0a9a77..da113122ecb 160000 --- a/plugins/oaiMetadataFormats/oaiJats +++ b/plugins/oaiMetadataFormats/oaiJats @@ -1 +1 @@ -Subproject commit 7699c0a9a774f1e82775beb27cf718e2fb403601 +Subproject commit da113122ecbefc77c5e420b069737d0c2359d6c9 diff --git a/plugins/reports/articles/ArticleReportPlugin.php b/plugins/reports/articles/ArticleReportPlugin.php index e3a419a496e..4e454bec270 100644 --- a/plugins/reports/articles/ArticleReportPlugin.php +++ b/plugins/reports/articles/ArticleReportPlugin.php @@ -28,6 +28,7 @@ use PKP\submission\SubmissionDisciplineDAO; use PKP\submission\SubmissionKeywordDAO; use PKP\submission\SubmissionSubjectDAO; +use PKP\userGroup\UserGroup; class ArticleReportPlugin extends ReportPlugin { @@ -90,15 +91,14 @@ public function display($args, $request) $submissionDisciplineDao = DAORegistry::getDAO('SubmissionDisciplineDAO'); /** @var SubmissionDisciplineDAO $submissionDisciplineDao */ $submissionAgencyDao = DAORegistry::getDAO('SubmissionAgencyDAO'); /** @var SubmissionAgencyDAO $submissionAgencyDao */ - $userGroups = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->getMany() - ->toArray(); + $userGroups = UserGroup::withContextIds([$context->getId()]) + ->get() + ->all(); $editorUserGroupIds = array_map(function ($userGroup) { - return $userGroup->getId(); + return $userGroup->id; }, array_filter($userGroups, function ($userGroup) { - return in_array($userGroup->getRoleId(), [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR]); + return in_array($userGroup->roleId, [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR]); })); // Load the data from the database and store it in an array. diff --git a/templates/controllers/grid/settings/sections/form/sectionForm.tpl b/templates/controllers/grid/settings/sections/form/sectionForm.tpl index b1ce2ae05fd..7a60afb3c8f 100644 --- a/templates/controllers/grid/settings/sections/form/sectionForm.tpl +++ b/templates/controllers/grid/settings/sections/form/sectionForm.tpl @@ -67,8 +67,8 @@ {fbvFormSection list=true title="manager.sections.form.assignEditors"}
{translate key="manager.sections.form.assignEditors.description"}
{foreach from=$assignableUserGroups item="assignableUserGroup"} - {assign var="role" value=$assignableUserGroup.userGroup->getLocalizedName()} - {assign var="userGroupId" value=$assignableUserGroup.userGroup->getId()} + {assign var="role" value=$assignableUserGroup.userGroup->getLocalizedData('name')} + {assign var="userGroupId" value=$assignableUserGroup.userGroup->id} {foreach from=$assignableUserGroup.users item=$username key="id"} {fbvElement type="checkbox" diff --git a/templates/frontend/objects/article_details.tpl b/templates/frontend/objects/article_details.tpl index bd23d265ad8..8e425b8277d 100755 --- a/templates/frontend/objects/article_details.tpl +++ b/templates/frontend/objects/article_details.tpl @@ -122,9 +122,9 @@ {/if} {assign var=authorUserGroup value=$userGroupsById[$author->getData('userGroupId')]} - {if $authorUserGroup->getShowTitle()} + {if $authorUserGroup->showTitle} - {$authorUserGroup->getLocalizedName()|escape} + {$authorUserGroup->getLocalizedData('name')|escape} {/if} {if $author->getData('orcid')}