Skip to content

Commit

Permalink
pkp/pkp-lib#10506 User Group refactoring to Eloquent Model (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 authored Dec 16, 2024
1 parent 8be6365 commit 51bf1b3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions OAIMetadataFormat_JATS.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use APP\issue\IssueAction;
use PKP\plugins\PluginRegistry;
use PKP\plugins\Hook;
use PKP\userGroup\UserGroup;

class OAIMetadataFormat_JATS extends OAIMetadataFormat {
/**
Expand Down Expand Up @@ -442,7 +443,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
}

// Editorial team
$userGroups = Repo::userGroup()->getCollector()->filterByContextIds([$journal->getId()])->getMany();
$userGroups = UserGroup::withContextIds([$journal->getId()])->get();
$journalMetaNode = $xpath->query('//article/front/journal-meta')->item(0);
$contribGroupNode = $this->_addChildInOrder($journalMetaNode, $doc->createElement('contrib-group'));
$keyContribTypeMapping = [
Expand All @@ -451,12 +452,12 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
'default.groups.name.sectionEditor' => 'secteditor',
];
foreach ($userGroups as $userGroup) {
if (!isset($keyContribTypeMapping[$userGroup->getData('nameLocaleKey')])) continue;
if (!isset($keyContribTypeMapping[$userGroup->nameLocaleKey])) continue;

$users = Repo::user()->getCollector()->filterByUserGroupIds([$userGroup->getId()])->getMany();
$users = Repo::user()->getCollector()->filterByUserGroupIds([$userGroup->id])->getMany();
foreach ($users as $user) {
$contribNode = $contribGroupNode->appendChild($doc->createElement('contrib'));
$contribNode->setAttribute('contrib-type', $keyContribTypeMapping[$userGroup->getData('nameLocaleKey')]);
$contribNode->setAttribute('contrib-type', $keyContribTypeMapping[$userGroup->nameLocaleKey]);
$nameNode = $contribNode->appendChild($doc->createElement('name'));
$surname = method_exists($user, 'getLastName')?$user->getLastName():$user->getLocalizedFamilyName();
if ($surname != '') {
Expand Down

0 comments on commit 51bf1b3

Please sign in to comment.