From cfa1b75e9fa9fb5548a56ab981a66b3ff11b4701 Mon Sep 17 00:00:00 2001 From: Vitalii Bezsheiko Date: Fri, 12 Jan 2024 18:40:51 +0200 Subject: [PATCH] pkp/pkp-lib#8885 Add editorial activity related props to the submission schema --- classes/submission/maps/Schema.php | 13 +++++++++++++ schemas/submission.json | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/classes/submission/maps/Schema.php b/classes/submission/maps/Schema.php index 12f2097c384..fba0dc73b31 100644 --- a/classes/submission/maps/Schema.php +++ b/classes/submission/maps/Schema.php @@ -15,6 +15,7 @@ use APP\core\Application; use APP\submission\Submission; +use PKP\submission\PKPSubmission; class Schema extends \PKP\submission\maps\Schema { @@ -36,6 +37,11 @@ protected function mapByProperties(array $props, Submission $submission): array ); } + if (in_array('scheduledIn', $props)) { + $output['scheduledIn'] = $submission->getData('status') == PKPSubmission::STATUS_SCHEDULED ? + $submission->getCurrentPublication()->getData('issueId') : null; + } + $locales = $this->context->getSupportedSubmissionMetadataLocales(); if (!in_array($primaryLocale = $submission->getData('locale'), $locales)) { @@ -48,4 +54,11 @@ protected function mapByProperties(array $props, Submission $submission): array return $this->withExtensions($output, $submission); } + + protected function appSpecificProps(): array + { + return [ + 'scheduledIn', + ]; + } } diff --git a/schemas/submission.json b/schemas/submission.json index 1f98d04049b..56d02dc6a11 100644 --- a/schemas/submission.json +++ b/schemas/submission.json @@ -9,6 +9,15 @@ "type": "integer", "description": "The section this submission should be assigned to. This can only be passed when creating a new submission and the data is assigned to the first publication. After the submission is created, edit the publication to change the `sectionId`.", "writeOnly": true + }, + "scheduledIn": { + "type": "integer", + "description": "The submission status is `STATUS_SCHEDULED`. It shows the issue it is scheduled in.", + "apiSummary": true, + "readOnly": true, + "validation": [ + "nullable" + ] } } }