Skip to content

Commit

Permalink
pkp/pkp-lib#9784 use full name locale keys for onix export
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson committed Jun 25, 2024
1 parent bb80b29 commit e0ed87a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ function createProductNode($doc, $submission, $publicationFormat) {
$userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /* @var $userGroupDao UserGroupDAO */
$userGroup = $userGroupDao->getById($author->getUserGroupId(), $submission->getContextId());

$userGroupOnixMap = array('author' => 'A01', 'volumeEditor' => 'B01', 'chapterAuthor' => 'A01', 'translator' => 'B06', 'editor' => 'B21'); // From List17, ContributorRole types.
$userGroupOnixMap = array('default.groups.name.author' => 'A01', 'default.groups.name.volumeEditor' => 'B01', 'default.groups.name.chapterAuthor' => 'A01', 'default.groups.name.translator' => 'B06', 'default.groups.name.editor' => 'B21'); // From List17, ContributorRole types.

$abbrevKey = substr($userGroup->getData('abbrevLocaleKey'), strrpos($userGroup->getData('abbrevLocaleKey'), '.') + 1);
$role = array_key_exists($abbrevKey, $userGroupOnixMap) ? $userGroupOnixMap[$abbrevKey] : 'Z99'; // Z99 - unknown contributor type.
$nameKey = $userGroup->getData('nameLocaleKey');
$role = array_key_exists($nameKey, $userGroupOnixMap) ? $userGroupOnixMap[$nameKey] : 'Z99'; // Z99 - unknown contributor type.

$contributorNode->appendChild($this->_buildTextNode($doc, 'ContributorRole', $role));
$contributorNode->appendChild($this->_buildTextNode($doc, 'PersonName', $author->getFullName(false)));
Expand Down

0 comments on commit e0ed87a

Please sign in to comment.