diff --git a/classes/monograph/Chapter.php b/classes/monograph/Chapter.php index 39827e827c2..94b572718a4 100644 --- a/classes/monograph/Chapter.php +++ b/classes/monograph/Chapter.php @@ -330,20 +330,20 @@ public function setSourceChapterId(?int $sourceChapterId): void /** * Is a landing page enabled or disabled. * - * @return null|int + * @return null|bool */ public function isPageEnabled() { - return $this->getData('isPageEnabled'); + return $this->getData('isPageEnabled') || !empty($this->getDoi()); } /** * Enable or disable a landing page. * */ - public function setPageEnabled(?int $enable): void + public function setPageEnabled(?bool $enable): void { - $this->setData('isPageEnabled', $enable); + $this->setData('isPageEnabled', $enable || !empty($this->getDoi())); } /** diff --git a/classes/submission/Repository.php b/classes/submission/Repository.php index c387a92b33e..c9d90375ef9 100644 --- a/classes/submission/Repository.php +++ b/classes/submission/Repository.php @@ -76,7 +76,7 @@ public function createDois(Submission $submission): array /** @var ChapterDAO $chapterDao */ $chapterDao = DAORegistry::getDAO('ChapterDAO'); foreach ($chapters as $chapter) { - if (empty($chapter->getData('doiId'))) { + if (empty($chapter->getData('doiId')) && $chapter->isPageEnabled()) { try { $doiId = Repo::doi()->mintChapterDoi($chapter, $submission, $context); $chapter->setData('doiId', $doiId); diff --git a/controllers/grid/users/chapter/form/ChapterForm.php b/controllers/grid/users/chapter/form/ChapterForm.php index efe21802488..2e523cb2442 100644 --- a/controllers/grid/users/chapter/form/ChapterForm.php +++ b/controllers/grid/users/chapter/form/ChapterForm.php @@ -278,6 +278,7 @@ public function fetch($request, $template = null, $display = false) }, $selectedChapterAuthorsArray), 'chapterFileOptions' => $chapterFileOptions, 'selectedChapterFiles' => $selectedChapterFiles, + 'doi' => $this->getChapter()?->getDoi() ]); return parent::fetch($request, $template, $display); diff --git a/locale/en/submission.po b/locale/en/submission.po index 19d419c5483..a2308f00ae4 100644 --- a/locale/en/submission.po +++ b/locale/en/submission.po @@ -462,6 +462,9 @@ msgstr "Production Discussions" msgid "publication.chapter.landingPage" msgstr "Chapter Page" +msgid "publication.chapter.landingPage.doi.description" +msgstr "(This chapter will always be shown on its own page because it has a DOI.)" + msgid "publication.chapter.hasLandingPage" msgstr "" "Show this chapter on its own page and link to that page from the book's " diff --git a/templates/controllers/grid/users/chapter/form/chapterForm.tpl b/templates/controllers/grid/users/chapter/form/chapterForm.tpl index 680e8ac50ce..e52d6bbcd1d 100644 --- a/templates/controllers/grid/users/chapter/form/chapterForm.tpl +++ b/templates/controllers/grid/users/chapter/form/chapterForm.tpl @@ -57,6 +57,9 @@ {fbvFormSection list=true title="publication.chapter.landingPage" for="customExtras"} {fbvElement type="checkbox" name="isPageEnabled" id="isPageEnabled" checked=$isPageEnabled|compare:true label="publication.chapter.hasLandingPage" value="1" translate="true"} + {if $doi} +