From 182d0bdbb8a5b87b587ae2ac3ba85e00c22bc9f0 Mon Sep 17 00:00:00 2001 From: withanage Date: Sun, 12 Feb 2023 23:22:52 +0100 Subject: [PATCH] https://github.com/pkp/orcidProfile/issues/229 OrcidProfilePlugin --- OrcidProfilePlugin.php | 23 ++++++++++--------- mailables/OrcidRequestAuthorAuthorization.php | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/OrcidProfilePlugin.php b/OrcidProfilePlugin.php index 797131df..bf16fee5 100755 --- a/OrcidProfilePlugin.php +++ b/OrcidProfilePlugin.php @@ -1319,17 +1319,18 @@ private function buildOrcidExternalIds($submission, $publication, $context, $iss } # Add issue ids if they exist - $pubId = $issue->getStoredPubId('doi'); - $doiObject = $issue->getData('doiObject'); - if ($doiObject) { - $externalIds[] = [ - 'external-id-type' => self::PUBID_TO_ORCID_EXT_ID['doi'], - 'external-id-value' => $doiObject->getData('doi'), - 'external-id-url' => [ - 'value' => $doiObject->getResolvingUrl() - ], - 'external-id-relationship' => 'part-of' - ]; + if($issue) { + $doiObject = $issue->getData('doiObject'); + if ($doiObject) { + $externalIds[] = [ + 'external-id-type' => self::PUBID_TO_ORCID_EXT_ID['doi'], + 'external-id-value' => $doiObject->getData('doi'), + 'external-id-url' => [ + 'value' => $doiObject->getResolvingUrl() + ], + 'external-id-relationship' => 'part-of' + ]; + } } } } else { diff --git a/mailables/OrcidRequestAuthorAuthorization.php b/mailables/OrcidRequestAuthorAuthorization.php index e2c73df5..d4f217b7 100644 --- a/mailables/OrcidRequestAuthorAuthorization.php +++ b/mailables/OrcidRequestAuthorAuthorization.php @@ -17,6 +17,7 @@ use APP\journal\Journal; use APP\plugins\generic\orcidProfile\mailables\traits\OrcidVariables; +use APP\server\Server; use APP\submission\Submission; use PKP\mail\Mailable; use PKP\mail\traits\Configurable; @@ -34,7 +35,7 @@ class OrcidRequestAuthorAuthorization extends Mailable protected static ?string $emailTemplateKey = 'ORCID_REQUEST_AUTHOR_AUTHORIZATION'; protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR]; - public function __construct(Journal $context, Submission $submission, string $oauthUrl) + public function __construct(Journal|Server $context, Submission $submission, string $oauthUrl) { parent::__construct([$context, $submission]); $this->setupOrcidVariables($oauthUrl);