diff --git a/api/v1/submissions/PKPSubmissionController.php b/api/v1/submissions/PKPSubmissionController.php index c21bb9d8c55..1c9f965d1f9 100644 --- a/api/v1/submissions/PKPSubmissionController.php +++ b/api/v1/submissions/PKPSubmissionController.php @@ -71,7 +71,6 @@ use PKP\submissionFile\SubmissionFile; use PKP\userGroup\UserGroup; - class PKPSubmissionController extends PKPBaseController { use AnonymizeData; @@ -630,7 +629,7 @@ public function add(Request $illuminateRequest): JsonResponse Repo::userGroup()->assignUserToGroup( $user->getId(), $submitAsUserGroup->id - ); + ); } } @@ -845,7 +844,7 @@ public function submit(Request $illuminateRequest): JsonResponse $contextId = $context->getId(); $userGroups = UserGroup::withContextIds($contextId)->cursor(); - + /** @var GenreDAO $genreDao */ $genreDao = DAORegistry::getDAO('GenreDAO'); diff --git a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php index 884784633fd..a703b7eccea 100644 --- a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php +++ b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.php @@ -66,6 +66,7 @@ use PKP\submission\reviewRound\ReviewRoundDAO; use PKP\submission\SubmissionCommentDAO; use PKP\user\User; +use PKP\userGroup\UserGroup; use Symfony\Component\Mailer\Exception\TransportException; class PKPReviewerGridHandler extends GridHandler @@ -472,10 +473,11 @@ public function getUsersNotAssignedAsReviewers($args, $request) { $context = $request->getContext(); $term = $request->getUserVar('term'); - $reviewerUserGroupIds = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->filterByRoleIds([Role::ROLE_ID_REVIEWER]) + + $reviewerUserGroupIds = UserGroup::withContextIds([$context->getId()]) + ->withRoleIds([Role::ROLE_ID_REVIEWER]) ->getIds(); + $users = Repo::user()->getCollector() ->filterExcludeUserGroupIds(iterator_to_array($reviewerUserGroupIds)) ->searchPhrase($term) @@ -563,7 +565,7 @@ public function updateReinstateReviewer($args, $request) $template = Repo::emailTemplate()->getByKey($context->getId(), ReviewerReinstate::getEmailTemplateKey()); $mailable = new ReviewerReinstate($context, $submission, $reviewAssignment); - if($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { + if ($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { Repo::emailLogEntry()->logMailable(SubmissionEmailLogEventType::REVIEW_REINSTATED, $mailable, $submission, $user); } } @@ -622,7 +624,7 @@ public function updateResendRequestReviewer($args, $request) $template = Repo::emailTemplate()->getByKey($context->getId(), ReviewerResendRequest::getEmailTemplateKey()); $mailable = new ReviewerResendRequest($context, $submission, $reviewAssignment); - if($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { + if ($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { Repo::emailLogEntry()->logMailable(SubmissionEmailLogEventType::REVIEW_RESEND, $mailable, $submission, $user); } } @@ -661,7 +663,7 @@ public function updateUnassignReviewer($args, $request) $template = Repo::emailTemplate()->getByKey($context->getId(), ReviewerUnassign::getEmailTemplateKey()); $mailable = new ReviewerUnassign($context, $submission, $reviewAssignment); - if($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { + if ($this->createMail($mailable, $request->getUserVar('personalMessage'), $template, $user, $reviewer)) { Repo::emailLogEntry()->logMailable(SubmissionEmailLogEventType::REVIEW_CANCEL, $mailable, $submission, $user); } } diff --git a/classes/install/PKPInstall.php b/classes/install/PKPInstall.php index 9a695273238..977d3b7d7bf 100644 --- a/classes/install/PKPInstall.php +++ b/classes/install/PKPInstall.php @@ -254,8 +254,7 @@ public function createData() $adminUserGroup->save(); // Assign the user to the admin user group - $repository = Repo::userGroup(); - $repository->assignUserToGroup($user->getId(), $adminUserGroup->id); + Repo::userGroup()->assignUserToGroup($user->getId(), $adminUserGroup->id); // Add initial site data /** @var SiteDAO */ diff --git a/classes/invitation/stepTypes/SendInvitationStep.php b/classes/invitation/stepTypes/SendInvitationStep.php index 2344910e782..dcbc50c9e36 100644 --- a/classes/invitation/stepTypes/SendInvitationStep.php +++ b/classes/invitation/stepTypes/SendInvitationStep.php @@ -10,13 +10,13 @@ * * @brief create accept invitation steps. */ + namespace PKP\invitation\stepTypes; use APP\core\Application; use Exception; use PKP\components\forms\invitation\UserDetailsForm; use PKP\context\Context; -use PKP\facades\Repo; use PKP\invitation\core\Invitation; use PKP\invitation\sections\Email; use PKP\invitation\sections\Form; @@ -24,6 +24,7 @@ use PKP\invitation\steps\Step; use PKP\mail\mailables\UserRoleAssignmentInvitationNotify; use PKP\user\User; +use PKP\userGroup\UserGroup; use stdClass; class SendInvitationStep extends InvitationStepTypes @@ -36,7 +37,7 @@ class SendInvitationStep extends InvitationStepTypes public function getSteps(?Invitation $invitation, Context $context, ?User $user): array { $steps = []; - if(!$invitation && !$user) { + if (!$invitation && !$user) { $steps[] = $this->invitationSearchUser(); } $steps[] = $this->invitationDetailsForm($context); @@ -54,7 +55,7 @@ private function invitationSearchUser(): stdClass __('userInvitation.searchUser.stepName'), 'form', 'UserInvitationSearchFormStep', - __('userInvitation.searchUser.stepDescription'), + __('userInvitation.searchUser.stepDescription'), ); $sections->addSection( null, @@ -167,19 +168,15 @@ private function invitationInvitedEmail(Context $context): stdClass /** * Get all user groups - * @param Context $context - * @return array */ private function getAllUserGroups(Context $context): array { $allUserGroups = []; - $userGroups = Repo::userGroup()->getCollector() - ->filterByContextIds([$context->getId()]) - ->getMany(); + $userGroups = UserGroup::withContextIds([$context->getId()])->get(); foreach ($userGroups as $userGroup) { $allUserGroups[] = [ - 'value' => (int) $userGroup->getId(), - 'label' => $userGroup->getLocalizedName(), + 'value' => (int) $userGroup->id, + 'label' => $userGroup->getLocalizedData('name'), 'disabled' => false ]; } diff --git a/classes/security/authorization/CanAccessSettingsPolicy.php b/classes/security/authorization/CanAccessSettingsPolicy.php index fe6310fb5ec..ad5d406081c 100644 --- a/classes/security/authorization/CanAccessSettingsPolicy.php +++ b/classes/security/authorization/CanAccessSettingsPolicy.php @@ -29,10 +29,10 @@ public function effect() // At least one user group must be an admin, or a manager with setup access. $userGroups = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_GROUP); foreach ($userGroups as $userGroup) { - if ($userGroup->getRoleId() == ROLE_ID_SITE_ADMIN) { + if ($userGroup->roleId == Role::ROLE_ID_SITE_ADMIN) { return AuthorizationPolicy::AUTHORIZATION_PERMIT; } - if ($userGroup->getRoleId() == Role::ROLE_ID_MANAGER && $userGroup->getPermitSettings()) { + if ($userGroup->roleId == Role::ROLE_ID_MANAGER && $userGroup->permitSettings) { return AuthorizationPolicy::AUTHORIZATION_PERMIT; } } diff --git a/classes/submission/maps/Schema.php b/classes/submission/maps/Schema.php index c72550cb90b..6a2a00dcbb8 100644 --- a/classes/submission/maps/Schema.php +++ b/classes/submission/maps/Schema.php @@ -541,12 +541,12 @@ function (Role $role) { ->withStageIds([$stageId]) ->get(); - foreach ($stageAssignments as $stageAssignment) { - $userGroup = $this->getUserGroup($stageAssignment->userGroupId); - if ($userGroup) { - $currentUserAssignedRoles[] = $userGroup->roleId; - } + foreach ($stageAssignments as $stageAssignment) { + $userGroup = $this->getUserGroup($stageAssignment->userGroupId); + if ($userGroup) { + $currentUserAssignedRoles[] = $userGroup->roleId; } + } // Replaces StageAssignmentDAO::getBySubmissionAndUserIdAndStageId $stageAssignments = StageAssignment::withSubmissionIds([$submission->getId()]) @@ -557,18 +557,18 @@ function (Role $role) { foreach ($stageAssignments as $stageAssignment) { $userGroup = UserGroup::find($stageAssignment->userGroupId); $stageAssignmentsOverview[] = [ - "roleId" => $userGroup?->roleId ?? null, - "recommendOnly" => $stageAssignment->recommendOnly, - "canChangeMetadata" => $stageAssignment->canChangeMetadata, - "userId" => $stageAssignment->userId + 'roleId' => $userGroup?->roleId ?? null, + 'recommendOnly' => $stageAssignment->recommendOnly, + 'canChangeMetadata' => $stageAssignment->canChangeMetadata, + 'userId' => $stageAssignment->userId ]; } } $stage['currentUserAssignedRoles'] = array_values(array_unique($currentUserAssignedRoles)); // FIXME - $stageAssignments are just temporarly added until https://github.com/pkp/pkp-lib/issues/10480 is ready $stage['stageAssignments'] = $stageAssignmentsOverview; - if(!$stage['currentUserAssignedRoles']) { - if(in_array(Role::ROLE_ID_MANAGER, $currentRoles)) { + if (!$stage['currentUserAssignedRoles']) { + if (in_array(Role::ROLE_ID_MANAGER, $currentRoles)) { $stage['currentUserAssignedRoles'][] = Role::ROLE_ID_MANAGER; } } @@ -764,8 +764,8 @@ protected function checkDecisionPermissions(int $stageId, Submission $submission if (!$makeRecommendation && !$makeDecision) { $userGroups = Repo::userGroup()->userUserGroups($user->getId(), $contextId); foreach ($userGroups as $userGroup) { - if (in_array($userGroup->getRoleId(), [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN])) { - if (!$userGroup->getRecommendOnly()) { + if (in_array($userGroup->roleId, [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN])) { + if (!$userGroup->recommendOnly) { $makeDecision = true; } else { $makeRecommendation = true; diff --git a/classes/template/PKPTemplateManager.php b/classes/template/PKPTemplateManager.php index bc6c9a4c962..b638256f755 100644 --- a/classes/template/PKPTemplateManager.php +++ b/classes/template/PKPTemplateManager.php @@ -60,9 +60,9 @@ use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; use PKP\submissionFile\SubmissionFile; +use PKP\userGroup\UserGroup; use Smarty; use Smarty_Internal_Template; -use PKP\userGroup\UserGroup; require_once('./lib/pkp/lib/vendor/smarty/smarty/libs/plugins/modifier.escape.php'); // Seems to be needed? @@ -988,7 +988,7 @@ public function setupBackendPage() if ($request->getContext()) { if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], $userRoles))) { - if(Config::getVar('features', 'enable_new_submission_listing')) { + if (Config::getVar('features', 'enable_new_submission_listing')) { if (count(array_intersect([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], $userRoles))) { $dashboardViews = Repo::submission()->getDashboardViews($request->getContext(), $request->getUser(), [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT]); $requestedPage = $router->getRequestedPage($request); @@ -1017,7 +1017,7 @@ public function setupBackendPage() 'submenu' => $viewsData ]; } - if(count(array_intersect([ Role::ROLE_ID_REVIEWER], $userRoles))) { + if (count(array_intersect([ Role::ROLE_ID_REVIEWER], $userRoles))) { $dashboardViews = Repo::submission()->getDashboardViews($request->getContext(), $request->getUser(), [Role::ROLE_ID_REVIEWER]); $requestedPage = $router->getRequestedPage($request); $requestedOp = $router->getRequestedOp($request); @@ -1038,7 +1038,7 @@ public function setupBackendPage() 'icon' => 'ReviewAssignments', ]; } - if(count(array_intersect([ Role::ROLE_ID_AUTHOR], $userRoles))) { + if (count(array_intersect([ Role::ROLE_ID_AUTHOR], $userRoles))) { $dashboardViews = Repo::submission()->getDashboardViews($request->getContext(), $request->getUser(), [Role::ROLE_ID_AUTHOR]); $requestedPage = $router->getRequestedPage($request); $requestedOp = $router->getRequestedOp($request); @@ -1113,7 +1113,7 @@ public function setupBackendPage() } $userGroups = (array) $router->getHandler()->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_GROUP); - $hasSettingsAccess = array_reduce($userGroups, fn ($carry, $userGroup) => $carry || $userGroup->getPermitSettings(), false); + $hasSettingsAccess = array_reduce($userGroups, fn ($carry, $userGroup) => $carry || $userGroup->permitSettings, false); if ($hasSettingsAccess) { $menu['settings'] = [ 'name' => __('navigation.settings'), @@ -1344,15 +1344,15 @@ public function display($template = null, $cache_id = null, $compile_id = null, $query->where('user_id', $user->getId()) ->where(function ($q) { $q->whereNull('date_end') - ->orWhere('date_end', '>', now()); + ->orWhere('date_end', '>', now()); }) ->where(function ($q) { $q->whereNull('date_start') - ->orWhere('date_start', '<=', now()); + ->orWhere('date_start', '<=', now()); }); }) ->get(); - + $userRoles = []; foreach ($userGroups as $userGroup) { $userRoles[] = (int) $userGroup->role_id; diff --git a/classes/userGroup/Repository.php b/classes/userGroup/Repository.php index 6f751623f9a..8d70e045487 100644 --- a/classes/userGroup/Repository.php +++ b/classes/userGroup/Repository.php @@ -480,7 +480,7 @@ public function installSettings(?int $contextId, string $filename): bool // If has manager role then permitMetadataEdit can't be overridden if (in_array($roleId, self::NOT_CHANGE_METADATA_EDIT_PERMISSION_ROLES)) { $permitMetadataEdit = $setting->getAttribute('permitMetadataEdit') === 'true'; - $permitSettings = $setting->getAttribute('permitSettings'); + $permitSettings = $setting->getAttribute('permitSettings') === 'true'; } $defaultStages = explode(',', (string) $setting->getAttribute('stages')); @@ -494,7 +494,7 @@ public function installSettings(?int $contextId, string $filename): bool 'isDefault' => true, 'showTitle' => true, 'masthead' => $masthead, - 'permit_settings' => $permitSettings, + 'permitSettings' => $permitSettings, ]); // Save the UserGroup instance to the database @@ -507,9 +507,9 @@ public function installSettings(?int $contextId, string $filename): bool $stageId = (int) trim($stageId); if ($stageId >= WORKFLOW_STAGE_ID_SUBMISSION && $stageId <= WORKFLOW_STAGE_ID_PRODUCTION) { UserGroupStage::create([ - 'context_id' => $contextId, - 'user_group_id' => $userGroupId, - 'stage_id' => $stageId, + 'contextId' => $contextId, + 'userGroupId' => $userGroupId, + 'stageId' => $stageId, ]); } } diff --git a/classes/userGroup/UserGroup.php b/classes/userGroup/UserGroup.php index 188804c2305..436d7e09eeb 100644 --- a/classes/userGroup/UserGroup.php +++ b/classes/userGroup/UserGroup.php @@ -19,7 +19,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use PKP\core\PKPApplication; use PKP\core\traits\ModelWithSettings; -use PKP\facades\Locale; use PKP\facades\Repo; use PKP\plugins\Hook; use PKP\services\PKPSchemaService; @@ -65,30 +64,10 @@ class UserGroup extends Model 'showTitle', 'permitSelfRegistration', 'permitMetadataEdit', - 'permitSettings' => 'boolean', + 'permitSettings', 'masthead', ]; - /** - * The attributes that should be cast. - * - * @return array - */ - protected function casts(): array - { - return [ - 'contextId' => 'integer', - 'roleId' => 'integer', - 'isDefault' => 'boolean', - 'showTitle' => 'boolean', - 'permitSelfRegistration' => 'boolean', - 'permitMetadataEdit' => 'boolean', - 'masthead' => 'boolean', - 'permitSettings' => 'boolean', - // multilingual attributes will be handled through accessors and mutators - ]; - } - /** * Get the settings table name */ @@ -383,39 +362,6 @@ protected function scopeWithPublicationIds(EloquentBuilder $builder, array $publ }); } - /** - * Set the name attribute. - * - */ - public function setNameAttribute($value): void - { - if (is_string($value)) { - $value = $this->localizeNonLocalizedData($value); - } - $this->setData('name', $value); - } - - /** - * Set the abbrev attribute. - * - */ - public function setAbbrevAttribute($value): void - { - if (is_string($value)) { - $value = $this->localizeNonLocalizedData($value); - } - $this->setData('abbrev', $value); - } - - /** - * Localize non-localized data. - * - */ - protected function localizeNonLocalizedData(string $value): array - { - return [Locale::getLocale() => $value]; - } - /** * Find a UserGroup by ID and optional context ID. * diff --git a/controllers/grid/settings/roles/form/UserGroupForm.php b/controllers/grid/settings/roles/form/UserGroupForm.php index 3fb1f984b82..5bfa54a65fe 100644 --- a/controllers/grid/settings/roles/form/UserGroupForm.php +++ b/controllers/grid/settings/roles/form/UserGroupForm.php @@ -28,12 +28,8 @@ use PKP\security\RoleDAO; use PKP\stageAssignment\StageAssignment; use PKP\userGroup\relationships\UserGroupStage; -use PKP\workflow\WorkflowStageDAO; use PKP\userGroup\UserGroup; -use PKP\userGroup\relationships\UserUserGroup; -use PKP\userGroup\Repository as UserGroupRepository; -use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\DB; +use PKP\workflow\WorkflowStageDAO; class UserGroupForm extends Form { @@ -119,13 +115,12 @@ public function initData() $assignedStages = $userGroup->getAssignedStageIds()->toArray(); // Get a list of all settings-accessible user groups for the current user in // order to prevent them from locking themselves out by disabling the only one. - $mySettingsAccessUserGroupIds = Repo::userGroup()->getCollector() - ->filterByContextIds([$this->getContextId()]) - ->filterByUserIds([Application::get()->getRequest()->getUser()->getId()]) - ->getMany() - ->filter(fn ($userGroup) => $userGroup->getPermitSettings()) - ->map(fn ($userGroup) => $userGroup->getId()) - ->toArray(); + $mySettingsAccessUserGroupIds = UserGroup::withContextIds([$this->getContextId()]) + ->withUserIds([Application::get()->getRequest()->getUser()->getId()]) + ->get() + ->filter(fn ($userGroup) => $userGroup->permitSettings) + ->map(fn ($userGroup) => $userGroup->id) + ->all(); $data = [ 'userGroupId' => $userGroup->id, diff --git a/pages/invitation/InvitationHandler.php b/pages/invitation/InvitationHandler.php index 28345859a73..1ca6efff37e 100644 --- a/pages/invitation/InvitationHandler.php +++ b/pages/invitation/InvitationHandler.php @@ -73,9 +73,6 @@ private function getInvitationByKey(Request $request): Invitation /** * Get invitation by invitation id - * @param Request $request - * @param int $id - * @return Invitation */ private function getInvitationById(Request $request, int $id): Invitation { @@ -117,9 +114,7 @@ public static function getActionUrl(InvitationAction $action, Invitation $invita /** * Create an invitation to accept new role - * @param array $args - * @param Request $request - * @return void + * * @throws \Exception */ public function invite(array $args, Request $request): void @@ -149,13 +144,13 @@ public function invite(array $args, Request $request): void ]; $invitation = null; $user = null; - if(!empty($args)) { + if (!empty($args)) { $invitation = $this->getInvitationById($request, $args[0]); $payload = $invitation->getPayload()->toArray(); $invitationModel = $invitation->invitationModel->toArray(); $invitationMode = 'edit'; - if($invitationModel['userId']){ + if ($invitationModel['userId']) { $user = Repo::user()->get($invitationModel['userId']); } $invitationPayload['userId'] = $invitationModel['userId']; @@ -169,8 +164,8 @@ public function invite(array $args, Request $request): void $invitationPayload['currentUserGroups'] = !$invitationModel['userId'] ? [] : $this->getUserUserGroups($invitationModel['userId']); $invitationPayload['userGroupsToRemove'] = !$payload['userGroupsToRemove'] ? null : $payload['userGroupsToRemove']; $invitationPayload['emailComposer'] = [ - 'emailBody'=>$payload['emailBody'], - 'emailSubject'=>$payload['emailSubject'], + 'emailBody' => $payload['emailBody'], + 'emailSubject' => $payload['emailSubject'], ]; } $templateMgr = TemplateManager::getManager($request); @@ -196,7 +191,7 @@ public function invite(array $args, Request $request): void ]; $steps = new SendInvitationStep(); $templateMgr->setState([ - 'steps' => $steps->getSteps($invitation,$context,$user), + 'steps' => $steps->getSteps($invitation, $context, $user), 'emailTemplatesApiUrl' => $request ->getDispatcher() ->url( @@ -212,7 +207,8 @@ public function invite(array $args, Request $request): void 'pageTitle' => $invitation ? ( $invitationPayload['givenName'][Locale::getLocale()] . ' ' - . $invitationPayload['familyName'][Locale::getLocale()]) + . $invitationPayload['familyName'][Locale::getLocale()] + ) : __('invitation.wizard.pageTitle'), 'pageTitleDescription' => $invitation ? __( @@ -231,25 +227,9 @@ public function invite(array $args, Request $request): void /** * Get current user user groups - * @param int $id - * @return array */ private function getUserUserGroups(int $id): array { - $output = []; - $userGroups = Repo::userGroup()->userUserGroups($id); - foreach ($userGroups as $userGroup) { - $output[] = [ - 'id' => (int) $userGroup->getId(), - 'name' => $userGroup->getName(null), - 'abbrev' => $userGroup->getAbbrev(null), - 'roleId' => (int) $userGroup->getRoleId(), - 'showTitle' => (bool) $userGroup->getShowTitle(), - 'permitSelfRegistration' => (bool) $userGroup->getPermitSelfRegistration(), - 'permitMetadataEdit' => (bool) $userGroup->getPermitMetadataEdit(), - 'recommendOnly' => (bool) $userGroup->getRecommendOnly(), - ]; - } - return $output; + return Repo::userGroup()->userUserGroups($id)->toArray(); } } diff --git a/pages/workflow/PKPWorkflowHandler.php b/pages/workflow/PKPWorkflowHandler.php index 67b6665e1c2..157a53310fa 100644 --- a/pages/workflow/PKPWorkflowHandler.php +++ b/pages/workflow/PKPWorkflowHandler.php @@ -35,6 +35,7 @@ use PKP\components\forms\submission\ChangeSubmissionLanguageMetadataForm; use PKP\components\listPanels\ContributorsListPanel; use PKP\components\PublicationSectionJats; +use PKP\config\Config; use PKP\context\Context; use PKP\core\JSONMessage; use PKP\core\PKPApplication; @@ -54,9 +55,8 @@ use PKP\submission\PKPSubmission; use PKP\submission\reviewRound\ReviewRoundDAO; use PKP\user\User; -use PKP\workflow\WorkflowStageDAO; -use PKP\config\Config; use PKP\userGroup\UserGroup; +use PKP\workflow\WorkflowStageDAO; abstract class PKPWorkflowHandler extends Handler { @@ -134,7 +134,7 @@ public function access($args, $request) assert(isset($workingStageId)); $router = $request->getRouter(); - if(Config::getVar('features', 'enable_new_submission_listing')) { + if (Config::getVar('features', 'enable_new_submission_listing')) { return $request->redirectUrl($router->url($request, null, 'dashboard', 'editorial', null, ['workflowSubmissionId' => $submission->getId()])); } $request->redirectUrl($router->url($request, null, 'workflow', 'index', [$submission->getId(), $workingStageId])); @@ -206,7 +206,7 @@ public function index($args, $request) } else { foreach ($stageAssignments as $stageAssignment) { foreach ($workflowUserGroups as $workflowUserGroup) { - if ($stageAssignment->userGroupId == $workflowUserGroup->usergroupid && + if ($stageAssignment->userGroupId == $workflowUserGroup->userGroupId && !$stageAssignment->recommendOnly) { $canPublish = true; break; @@ -581,7 +581,7 @@ public function editorDecisionActions($args, $request) ->withUserIds([$user->getId()]) ->withRoleIds([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN]) ->get(); - + foreach ($userGroups as $userGroup) { if (!$userGroup->recommendOnly) { $makeDecision = true; diff --git a/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.php b/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.php index 9738aa5a47e..af37fbecb55 100644 --- a/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.php +++ b/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.php @@ -98,7 +98,7 @@ public function createPKPAuthorNode($doc, $author) throw new Exception(__('plugins.importexport.author.exportFailed')); } - $authorNode->setAttribute('user_group_ref', $userGroup->getName($context->getPrimaryLocale())); + $authorNode->setAttribute('user_group_ref', $userGroup->getLocalizedData('name', $context->getPrimaryLocale())); $authorNode->setAttribute('seq', $author->getSequence()); $authorNode->setAttribute('id', $author->getId());