Skip to content

Commit

Permalink
#10759 Store ORCID's review work put codes in review_assignment_table
Browse files Browse the repository at this point in the history
  • Loading branch information
taslangraham committed Jan 24, 2025
1 parent fdd66d9 commit e0ce557
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 4 deletions.
48 changes: 48 additions & 0 deletions classes/migration/install/ReviewAssignmentSettings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @file classes/migration/install/ReviewAssignmentSettings.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class ReviewAssignmentSettings
*
* @brief Add review_assignment_settings table
*/

namespace PKP\migration\install;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use PKP\migration\Migration;

class ReviewAssignmentSettings extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('review_assignment_settings', function (Blueprint $table) {
$table->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');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @file classes/migration/upgrade/v3_5_0/I10759_AddReviewAssignmentSettings.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I10759_AddReviewAssignmentSettings
*
* @brief Add review_assignment_settings table
*/

namespace PKP\migration\upgrade\v3_5_0;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use PKP\migration\Migration;

class I10759_AddReviewAssignmentSettings extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('review_assignment_settings', function (Blueprint $table) {
$table->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');
}
}
2 changes: 1 addition & 1 deletion classes/orcid/OrcidManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions classes/submission/reviewAssignment/DAO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file classes/submission/reviewAssignment/DAO.php
*
Expand Down Expand Up @@ -68,6 +69,8 @@ class DAO extends EntityDAO
'requestResent' => 'request_resent',
];

/** @copydoc EntityDAO::$settingsTable */
public $settingsTable = 'review_assignment_settings';
/**
* Instantiate a new DataObject
*/
Expand Down
4 changes: 2 additions & 2 deletions jobs/orcid/DepositOrcidSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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}");
Expand Down
10 changes: 9 additions & 1 deletion schemas/reviewAssignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"reviewerId": {
"type": "integer",
"description": "reviewer's unique ID",
"apiSummary": true,
"apiSummary": true,
"validation": [
"nullable"
]
Expand Down Expand Up @@ -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"
]
}
}
}

0 comments on commit e0ce557

Please sign in to comment.