Skip to content

Commit

Permalink
#32 Set null values if full-text isn't selected for a locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 committed Dec 15, 2020
1 parent e11a0c3 commit 7659619
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions JatsParserPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ function editPublicationFullText(string $hookname, array $args) {
foreach ($localePare as $localeKey => $fileId) {
if (empty($fileId)) {
$newPublication->setData('jatsParser::fullText', null, $localeKey);
$newPublication->setData('jatsParser::fullTextFileId', null, $localeKey);
continue;
}
$submissionFile = $submissionFileDao->getLatestRevision($fileId, SUBMISSION_FILE_PRODUCTION_READY);
Expand Down
7 changes: 6 additions & 1 deletion classes/components/forms/PublicationJATSUploadForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,19 @@ public function __construct($action, $locales, $publication, $submissionFiles, $
);
}

// Update the values so the proper option is selected on thr form initiation if full-text isn't selected for the specific locale
$values = $publication->getData('jatsParser::fullTextFileId');
$emptyValues = array_fill_keys(array_keys($options), null);
empty($values) ? $values = $emptyValues : $values = array_merge($emptyValues, $values);

if (!empty($options)) {
$this->addField(new FieldOptions('jatsParser::fullTextFileId', [
'label' => __('plugins.generic.jatsParser.publication.jats.label'),
'description' => $msg,
'isMultilingual' => true,
'type' => 'radio',
'options' => $options,
'value' => $publication->getData('jatsParser::fullTextFileId'),
'value' => $values,
]))->addField(new FieldOptions('jatsParser::pdfGalley', [
'label' => __('plugins.generic.jatsParser.publication.jats.pdf.label'),
'type' => 'checkbox',
Expand Down

0 comments on commit 7659619

Please sign in to comment.