From e679ae0dea8c78118f7ec401a48c6c244dc929b4 Mon Sep 17 00:00:00 2001 From: Alec Smecher Date: Tue, 29 Aug 2023 12:51:39 -0700 Subject: [PATCH] pkp/pkp-lib#9265 Fix fatal error on preview of unpublished content --- CoinsPlugin.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CoinsPlugin.php b/CoinsPlugin.php index f943efb..33a8c0c 100644 --- a/CoinsPlugin.php +++ b/CoinsPlugin.php @@ -84,10 +84,13 @@ function insertFooter(string $hookName, array $params) : bool ['rft.atitle', $article->getFullTitle($article->getLocale())], ['rft.artnum', $article->getBestArticleId()], ['rft.stitle', $journal->getLocalizedSetting('abbreviation')], - ['rft.volume', $issue->getVolume()], - ['rft.issue', $issue->getNumber()], ]; - + if ($issue) { + $vars = array_merge($vars, [ + ['rft.volume', $issue->getVolume()], + ['rft.issue', $issue->getNumber()], + ]); + } $authors = $publication->getData('authors'); if ($firstAuthor = $authors->first()) { $vars = array_merge($vars, [ @@ -97,7 +100,7 @@ function insertFooter(string $hookName, array $params) : bool } $datePublished = $article->getDatePublished(); - if (!$datePublished) { + if (!$datePublished && $issue) { $datePublished = $issue->getDatePublished(); }