Skip to content
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
10 changes: 9 additions & 1 deletion classes/author/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function validate($author, $props, Submission $submission, Context $conte
// Check for input from disallowed locales
ValidatorFactory::allowedLocales($validator, $schemaService->getMultilingualProps(PKPSchemaService::SCHEMA_AUTHOR), $allowedLocales);

$validator->after(function ($validator) use ($props, $submission) {
$validator->after(function ($validator) use ($props, $submission, $context, $primaryLocale) {
// publicationId must match an existing publication that is not yet published
if (isset($props['publicationId']) && !$validator->errors()->get('publicationId')) {
$publication = Repo::publication()->get($props['publicationId']);
Expand All @@ -157,6 +157,14 @@ public function validate($author, $props, Submission $submission, Context $conte
);
}
}

// Author CI statement required?
if ($context->getSetting('requireAuthorCompetingInterests') && empty($props['competingInterests'][$primaryLocale])) {
$validator->errors()->add(
"competingInterests.{$primaryLocale}",
__('author.competingInterests.required')
);
}
});

$errors = [];
Expand Down
1 change: 1 addition & 0 deletions classes/components/forms/publication/ContributorForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public function __construct(string $action, array $locales, ?Submission $submiss
'label' => __('author.competingInterests'),
'description' => __('author.competingInterests.description'),
'isMultilingual' => true,
'isRequired' => true,
]));
}
$this->addField(new FieldRichTextarea('biography', [
Expand Down
5 changes: 4 additions & 1 deletion schemas/author.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
"competingInterests": {
"type": "string",
"description": "A declaration of potential competing interests.",
"multilingual": "true"
"multilingual": "true",
"validation": [
"nullable"
]
},
"country": {
"type": "string",
Expand Down