|
28 | 28 | use APP\publicationFormat\PublicationFormat;
|
29 | 29 | use APP\section\Section;
|
30 | 30 | use APP\submission\Submission;
|
| 31 | +use PKP\context\Context; |
31 | 32 | use PKP\db\DAORegistry;
|
32 | 33 | use PKP\facades\Locale;
|
33 | 34 | use PKP\i18n\LocaleConversion;
|
@@ -163,18 +164,24 @@ public function extractMetadataFromDataObject(&$publicationFormat)
|
163 | 164 | $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
|
164 | 165 | foreach ((array) $pubIdPlugins as $plugin) {
|
165 | 166 | $pubId = $plugin->getPubId($publicationFormat);
|
| 167 | + if ($plugin->getSetting($press->getId(), 'enableRepresentationDoi')) { |
| 168 | + $pubId = $plugin->getPubId($publicationFormat); |
| 169 | + } |
| 170 | + if (!$pubId && $plugin->getSetting($press->getId(), 'enablePublicationDoi')) { |
| 171 | + $pubId = $plugin->getPubId($publication); |
| 172 | + } |
166 | 173 | if ($pubId) {
|
167 | 174 | $dc11Description->addStatement('dc:identifier', $pubId);
|
168 | 175 | }
|
169 | 176 | }
|
170 |
| - $context = $request->getContext(); |
171 |
| - if (!$context) { |
172 |
| - $contextDao = Application::getContextDAO(); |
173 |
| - /** @var Press */ |
174 |
| - $context = $contextDao->getById($monograph->getData('contextId')); |
175 |
| - } |
176 |
| - if ($context->areDoisEnabled()) { |
177 |
| - $doi = $publicationFormat->getDoi(); |
| 177 | + if ($press->areDoisEnabled()) { |
| 178 | + $enabledDoiTypes = $press->getData(Context::SETTING_ENABLED_DOI_TYPES) ?? []; |
| 179 | + if (in_array(Repo::doi()::TYPE_REPRESENTATION, $enabledDoiTypes)) { |
| 180 | + $doi = $publicationFormat->getDoi(); |
| 181 | + } |
| 182 | + if (!$doi && in_array(Repo::doi()::TYPE_PUBLICATION, $enabledDoiTypes)) { |
| 183 | + $doi = $publication->getDoi(); |
| 184 | + } |
178 | 185 | if ($doi) {
|
179 | 186 | $dc11Description->addStatement('dc:identifier', $doi);
|
180 | 187 | }
|
|
0 commit comments