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 rero#3738.

Co-Authored-by: Pascal Repond <[email protected]>
  • Loading branch information
PascalRepond committed Aug 29, 2024
1 parent d27c3a1 commit 916d8b2
Show file tree
Hide file tree
Showing 2 changed files with 11 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
10 changes: 10 additions & 0 deletions rero_ils/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,16 @@ def get_articles(record):
]


@blueprint.app_template_filter()
def n_electronic_holdings(record):
"""Get the number of electronic holdings.
: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 916d8b2

Please sign in to comment.