From e2766a92b370dc1415ce3df93bd52fdbbde4b285 Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Tue, 31 Dec 2024 13:00:51 -0500 Subject: [PATCH 1/2] pkp/pkp-lib#10744 Increase opportunity for ORCID work/review deposits --- classes/search/ArticleSearchIndex.php | 7 +++++++ jobs/orcid/DepositOrcidReview.php | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/classes/search/ArticleSearchIndex.php b/classes/search/ArticleSearchIndex.php index d3d2998f1e3..fb845aacfbe 100644 --- a/classes/search/ArticleSearchIndex.php +++ b/classes/search/ArticleSearchIndex.php @@ -16,9 +16,11 @@ namespace APP\search; +use APP\core\Application; use APP\facades\Repo; use APP\journal\Journal; use APP\journal\JournalDAO; +use APP\orcid\actions\SendSubmissionToOrcid; use APP\submission\Submission; use Exception; use PKP\core\PKPApplication; @@ -28,6 +30,7 @@ use PKP\search\SearchFileParser; use PKP\search\SubmissionSearch; use PKP\search\SubmissionSearchIndex; +use PKP\submission\PKPSubmission; use PKP\submissionFile\SubmissionFile; use Throwable; @@ -74,6 +77,10 @@ public function submissionMetadataChanged($submission) $this->_updateTextIndex($submissionId, SubmissionSearch::SUBMISSION_SEARCH_TYPE, (array) $publication->getData('type')); $this->_updateTextIndex($submissionId, SubmissionSearch::SUBMISSION_SEARCH_COVERAGE, (array) $publication->getData('coverage')); // FIXME Index sponsors too? + + if ($publication->getData('status') == PKPSubmission::STATUS_PUBLISHED) { + (new SendSubmissionToOrcid($publication, Application::getContextDAO()->getById($submission->getData('contextId'))))->execute(); + } } /** diff --git a/jobs/orcid/DepositOrcidReview.php b/jobs/orcid/DepositOrcidReview.php index b45d2fed06f..02a5b5df30c 100644 --- a/jobs/orcid/DepositOrcidReview.php +++ b/jobs/orcid/DepositOrcidReview.php @@ -24,6 +24,7 @@ use PKP\config\Config; use PKP\jobs\BaseJob; use PKP\orcid\OrcidManager; +use PKP\submission\reviewAssignment\ReviewAssignment; class DepositOrcidReview extends BaseJob { @@ -43,6 +44,10 @@ public function handle(): void $this->fail('Review assignment does not exist.'); } + if (!in_array($reviewAssignment->getStatus(), ReviewAssignment::REVIEW_COMPLETE_STATUSES)) { + $this->fail('Review assignment was not completed.'); + } + $submission = Repo::submission()->get($reviewAssignment->getSubmissionId()); $context = Application::getContextDAO()->getById($submission->getData('contextId')); @@ -67,7 +72,7 @@ public function handle(): void # Extract only the ORCID from the stored ORCID uri $orcid = basename(parse_url($reviewer->getOrcid(), PHP_URL_PATH)); - $orcidReview = new OrcidReview($submission, $reviewAssignment, $context); + $orcidReview = (new OrcidReview($submission, $reviewAssignment, $context))->toArray(); $uri = OrcidManager::getApiPath($context) . OrcidManager::ORCID_API_VERSION_URL . $orcid . '/' . OrcidManager::ORCID_REVIEW_URL; $method = 'POST'; @@ -89,7 +94,7 @@ public function handle(): void $uri, [ 'headers' => $headers, - 'json' => $orcidReview->toArray(), + 'json' => $orcidReview, ] ); @@ -101,7 +106,7 @@ public function handle(): void OrcidManager::logInfo("Review updated in profile, putCode: {$putCode}"); break; case 201: - $location = $responseHeaders['Location'][0]; + $location = $responseHeaders['location'][0]; // Extract the ORCID work put code for updates/deletion. $putCode = basename(parse_url($location, PHP_URL_PATH)); $reviewer->setData('orcidReviewPutCode', $putCode); From b0983413338718978fe6d0dec71309e51bea0789 Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Sun, 12 Jan 2025 18:52:48 -0500 Subject: [PATCH 2/2] Submodule update --- lib/pkp | 2 +- lib/ui-library | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pkp b/lib/pkp index 74efdd857e6..4a4b7f6b0d2 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit 74efdd857e6dab9dac59eec9c3da74678d4fa368 +Subproject commit 4a4b7f6b0d2b1ed7796a47ce90da9e8a647985fe diff --git a/lib/ui-library b/lib/ui-library index 4fe6ad40af5..48887248d02 160000 --- a/lib/ui-library +++ b/lib/ui-library @@ -1 +1 @@ -Subproject commit 4fe6ad40af5508ea1d6fa8cfd4763b7695465934 +Subproject commit 48887248d0207a9cf2878f13715413ce6e9f2206