Skip to content

Commit

Permalink
fix(public document view): allow harvested documents with physical items
Browse files Browse the repository at this point in the history
* Closes #3738.

Co-Authored-by: Pascal Repond <[email protected]>
  • Loading branch information
PascalRepond committed Sep 17, 2024
1 parent 0f8b215 commit 583105f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ <h3>
{% if holdings_count > 0 %}
{% include('rero_ils/_anonymous_button.html') %}
{% endif %}
{% if record.harvested %}
{% if record.harvested and record|n_electronic_holdings %}
{% include('rero_ils/_document_online.html') %}
{% else %}
<public-search-holdings
Expand Down
9 changes: 9 additions & 0 deletions rero_ils/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,15 @@ def get_articles(record):
]


@blueprint.app_template_filter()
def n_electronic_holdings(record):
"""Get the number of electronic holdings for this document.
:return: integer of number of electronic holdings
"""
return Document.get_n_available_holdings(record.pid)[1]


@blueprint.app_template_filter()
def online_holdings(document_pid, viewcode="global"):
"""Find holdings by document pid and viewcode.
Expand Down

0 comments on commit 583105f

Please sign in to comment.