From e0ce55767c176ff84d4828e174131bc6aa79319a Mon Sep 17 00:00:00 2001 From: Taslan Graham Date: Tue, 7 Jan 2025 11:47:08 -0500 Subject: [PATCH] pkp/pkp-lib#10759 Store ORCID's review work put codes in review_assignment_table --- .../install/ReviewAssignmentSettings.php | 48 +++++++++++++++++++ .../I10759_AddReviewAssignmentSettings.php | 48 +++++++++++++++++++ classes/orcid/OrcidManager.php | 2 +- classes/submission/reviewAssignment/DAO.php | 3 ++ jobs/orcid/DepositOrcidSubmission.php | 4 +- schemas/reviewAssignment.json | 10 +++- 6 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 classes/migration/install/ReviewAssignmentSettings.php create mode 100644 classes/migration/upgrade/v3_5_0/I10759_AddReviewAssignmentSettings.php diff --git a/classes/migration/install/ReviewAssignmentSettings.php b/classes/migration/install/ReviewAssignmentSettings.php new file mode 100644 index 00000000000..15519fb254c --- /dev/null +++ b/classes/migration/install/ReviewAssignmentSettings.php @@ -0,0 +1,48 @@ +bigIncrements('review_assignment_settings_id')->primary()->comment('Primary key.'); + $table->bigInteger('review_id')->comment('Foreign key referencing record in review_assignments table'); + $table->string('locale', 28)->nullable()->comment('Locale key.'); + $table->string('setting_name', 255)->comment('Name of settings record.'); + $table->mediumText('setting_value')->nullable()->comment('Settings value.'); + + $table->unique(['review_id', 'locale', 'setting_name'], 'review_assignment_settings_unique'); + $table->foreign('review_id')->references('review_id')->on('review_assignments')->onDelete('cascade')->onUpdate('cascade'); + $table->index(['review_id'], 'review_assignment_settings_review_id'); + }); + } + + /** + * Reverse the migration. + */ + public function down(): void + { + Schema::drop('review_assignment_settings'); + } +} diff --git a/classes/migration/upgrade/v3_5_0/I10759_AddReviewAssignmentSettings.php b/classes/migration/upgrade/v3_5_0/I10759_AddReviewAssignmentSettings.php new file mode 100644 index 00000000000..bd6251742fc --- /dev/null +++ b/classes/migration/upgrade/v3_5_0/I10759_AddReviewAssignmentSettings.php @@ -0,0 +1,48 @@ +bigIncrements('review_assignment_settings_id')->primary()->comment('Primary key.'); + $table->bigInteger('review_id')->comment('Foreign key referencing record in review_assignments table'); + $table->string('locale', 28)->nullable()->comment('Locale key.'); + $table->string('setting_name', 255)->comment('Name of settings record.'); + $table->mediumText('setting_value')->nullable()->comment('Settings value.'); + + $table->unique(['review_id', 'locale', 'setting_name'], 'review_assignment_settings_unique'); + $table->foreign('review_id')->references('review_id')->on('review_assignments')->onDelete('cascade')->onUpdate('cascade'); + $table->index(['review_id'], 'review_assignment_settings_review_id'); + }); + } + + /** + * Reverse the migration. + */ + public function down(): void + { + Schema::drop('review_assignment_settings'); + } +} diff --git a/classes/orcid/OrcidManager.php b/classes/orcid/OrcidManager.php index 636d9ccbd15..4139b634365 100644 --- a/classes/orcid/OrcidManager.php +++ b/classes/orcid/OrcidManager.php @@ -41,7 +41,7 @@ class OrcidManager public const ORCID_PROFILE_URL = 'person'; public const ORCID_WORK_URL = 'work'; public const ORCID_REVIEW_URL = 'peer-review'; - + public const ORCID_ALL_REVIEWS_URL = 'peer-reviews'; // Setting names and values used in ORCID settings forms public const ENABLED = 'orcidEnabled'; public const CLIENT_ID = 'orcidClientId'; diff --git a/classes/submission/reviewAssignment/DAO.php b/classes/submission/reviewAssignment/DAO.php index f252e547d12..5ee856e2f76 100644 --- a/classes/submission/reviewAssignment/DAO.php +++ b/classes/submission/reviewAssignment/DAO.php @@ -1,4 +1,5 @@ 'request_resent', ]; + /** @copydoc EntityDAO::$settingsTable */ + public $settingsTable = 'review_assignment_settings'; /** * Instantiate a new DataObject */ diff --git a/jobs/orcid/DepositOrcidSubmission.php b/jobs/orcid/DepositOrcidSubmission.php index 803c6b9c717..dab16e95886 100644 --- a/jobs/orcid/DepositOrcidSubmission.php +++ b/jobs/orcid/DepositOrcidSubmission.php @@ -54,7 +54,7 @@ public function handle(): void // Submission has already been sent to ORCID. Use PUT to update meta data $uri .= '/' . $putCode; $method = 'PUT'; - $orcidWork['put-code'] = $putCode; + $this->orcidWork['put-code'] = $putCode; } else { // Remove put-code from body because the work has not yet been sent unset($this->orcidWork['put-code']); @@ -95,7 +95,7 @@ public function handle(): void OrcidManager::logInfo("Work 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 = intval(basename(parse_url($location, PHP_URL_PATH))); OrcidManager::logInfo("Work added to profile, putCode: {$putCode}"); diff --git a/schemas/reviewAssignment.json b/schemas/reviewAssignment.json index 11c0dc2bbeb..473b85d9e3a 100644 --- a/schemas/reviewAssignment.json +++ b/schemas/reviewAssignment.json @@ -189,7 +189,7 @@ "reviewerId": { "type": "integer", "description": "reviewer's unique ID", - "apiSummary": true, + "apiSummary": true, "validation": [ "nullable" ] @@ -248,6 +248,14 @@ "multilingual": true, "description": "The title of the associated with the current publication", "readOnly": true + }, + "orcidReviewPutCode": { + "type": "string", + "description": "Put Code for a review work submitted to ORCID.", + "apiSummary": false, + "validation": [ + "nullable" + ] } } }