Skip to content

Commit

Permalink
pkp/pkp-lib#9468 assign DOIs only to chapters that have a landing pag…
Browse files Browse the repository at this point in the history
…e, and condsider chapter with DOI to have a landing page
  • Loading branch information
bozana committed Jul 3, 2024
1 parent 30230e1 commit 0443ee6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions classes/monograph/Chapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/submission/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0443ee6

Please sign in to comment.