Skip to content

Commit

Permalink
pkp/pkp-lib#9425 Make submission language selection and metadata form…
Browse files Browse the repository at this point in the history
…s independent from website language settings
  • Loading branch information
jyhein committed Nov 14, 2023
1 parent 6583bf1 commit 42a91f2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classes/publication/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function validate($publication, array $props, Submission $submission, Con
}

// Check the word count on abstracts
$allowedLocales = array_values(array_unique(array_merge($context->getSupportedSubmissionMetadataLocales(), $publication?->getLanguages() ?? [$primaryLocale])));
$allowedLocales = $submission->getPublicationLanguages($context->getSupportedSubmissionMetadataLocales());
foreach ($allowedLocales as $localeKey) {
if (empty($props['abstract'][$localeKey])) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion classes/publication/maps/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function mapByProperties(array $props, Publication $publication, bool
);
}

$locales = $publication->getLanguages($this->context->getSupportedSubmissionMetadataLocales());
$locales = $this->submission->getPublicationLanguages($this->context->getSupportedSubmissionMetadataLocales());

$output = $this->schemaService->addMissingMultilingualValues(PKPSchemaService::SCHEMA_PUBLICATION, $output, $locales);

Expand Down
2 changes: 1 addition & 1 deletion classes/submission/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function validateSubmit(Submission $submission, Context $context): array
$abstracts = $publication->getData('abstract');
if ($abstracts) {
$abstractErrors = [];
$allowedLocales = $publication->getLanguages($context->getSupportedSubmissionMetadataLocales());
$allowedLocales = $submission->getPublicationLanguages($context->getSupportedSubmissionMetadataLocales());
foreach ($allowedLocales as $localeKey) {
$abstract = $publication->getData('abstract', $localeKey);
$wordCount = $abstract ? PKPString::getWordCount($abstract) : 0;
Expand Down
4 changes: 2 additions & 2 deletions controllers/grid/articleGalleys/form/ArticleGalleyForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($request, $submission, $publication, $articleGalley
$this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this));

// Ensure a locale is provided and valid
$locales = $request->getJournal()->getSupportedSubmissionMetadataLocaleNames() + $publication->getLanguageNames() + ($articleGalley?->getLanguageNames() ?? []);
$locales = $request->getJournal()->getSupportedSubmissionMetadataLocaleNames() + $submission->getPublicationLanguageNames() + ($articleGalley?->getLanguageNames() ?? []);
$this->addCheck(
new \PKP\form\validation\FormValidator(
$this,
Expand Down Expand Up @@ -92,7 +92,7 @@ public function fetch($request, $template = null, $display = false)
]);
}

$supportedLocales = $request->getContext()->getSupportedSubmissionMetadataLocaleNames() + $this->_publication->getLanguageNames() + ($this->_articleGalley?->getLanguageNames() ?? []);
$supportedLocales = $request->getContext()->getSupportedSubmissionMetadataLocaleNames() + $this->_submission->getPublicationLanguageNames() + ($this->_articleGalley?->getLanguageNames() ?? []);
ksort($supportedLocales);

$templateMgr->assign([
Expand Down

0 comments on commit 42a91f2

Please sign in to comment.