Skip to content

Commit

Permalink
Reduce redundant use of getCurrentPublication
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 committed Mar 1, 2023
1 parent e282ee8 commit 3e301c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions templates/frontend/objects/article_summary.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* @uses $primaryGenreIds array List of file genre ids for primary file types
*}
{assign var=articlePath value=$article->getBestArticleId()}
{assign var="publication" value=$article->getCurrentPublication()}

{if (!$section.hideAuthor && $article->getHideAuthor() == $smarty.const.AUTHOR_TOC_DEFAULT) || $article->getHideAuthor() == $smarty.const.AUTHOR_TOC_SHOW}
{assign var="showAuthor" value=true}
Expand Down Expand Up @@ -42,10 +43,10 @@
{/if}
{/if}
{assign var="hasArticleAccess" value=$hasAccess}
{if $currentContext->getSetting('publishingMode') == $smarty.const.PUBLISHING_MODE_OPEN || $article->getCurrentPublication()->getData('accessStatus') == $smarty.const.ARTICLE_ACCESS_OPEN}
{if $currentContext->getSetting('publishingMode') == $smarty.const.PUBLISHING_MODE_OPEN || $publication->getData('accessStatus') == $smarty.const.ARTICLE_ACCESS_OPEN}
{assign var="hasArticleAccess" value=1}
{/if}
{include file="frontend/objects/galley_link.tpl" parent=$article hasAccess=$hasArticleAccess purchaseFee=$currentJournal->getSetting('purchaseArticleFee') purchaseCurrency=$currentJournal->getSetting('currency')}
{include file="frontend/objects/galley_link.tpl" parent=$article publication=$publication hasAccess=$hasArticleAccess purchaseFee=$currentJournal->getSetting('purchaseArticleFee') purchaseCurrency=$currentJournal->getSetting('currency')}
{/foreach}
{/if}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/frontend/objects/galley_link.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{else}
{assign var="page" value="article"}
{assign var="parentId" value=$parent->getBestArticleId()}
{if $publication && $publication->getId() !== $parent->getCurrentPublication()->getId()}
{if $publication && $publication->getId() !== $parent->getData('currentPublicationId')}
{assign var="path" value=$parentId|to_array:"version":$publication->getId():$galley->getBestGalleyId()}
{else}
{assign var="path" value=$parentId|to_array:$galley->getBestGalleyId()}
Expand Down

0 comments on commit 3e301c2

Please sign in to comment.