Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store ORCID review deposit put code in settings table #10776

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/PKPOrcidWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private function build(): array
$this->context->getPath(),
'article',
'view',
$submission->getId(),
[$submission->getId()],
urlLocaleForPage: '',
);

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"
]
}
}
}
7 changes: 0 additions & 7 deletions schemas/user.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,6 @@
"nullable"
]
},
"orcidReviewPutCode": {
"type": "string",
"apiSummary": true,
"validation": [
"nullable"
]
},
"rememberToken": {
"type": "string",
"writeOnly": true,
Expand Down