Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render a document detailed view with document even if there's a library without pickup location in the organisation #598

Closed
iGormilhit opened this issue Nov 6, 2019 · 0 comments
Assignees
Labels
bug (critical) Blocking issue, should be fixed ASAP

Comments

@iGormilhit
Copy link

iGormilhit commented Nov 6, 2019

Describe the issue
If, inside a given organisation, there's a library with locations, but none being a pickup location, then a reader cannot load any document detailed view with item of this organisation, because the system fails to populate the request button dropdown menu.

To Reproduce
Steps to reproduce the behavior:

  1. As a librarian, create a library with location, but without any pickup location. Edit: a library without location provides the same bug. But if you set one location as a pickup location, removing it does not always result with the same error.
  2. As a reader, log in the system and try to load a document detailed view with items.
  3. You should get an internal server error.
  4. In the log, you should see something like the following:
ERROR in app: Exception on /cantonal/documents/12867 [GET]
Traceback (most recent call last):
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/invenio_records_ui/views.py", line 205, in record_view
    return view_method(pid, record, template=template, **kwargs)
  File "./rero_ils/modules/documents/views.py", line 82, in doc_item_view_method
    viewcode=viewcode
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/templating.py", line 140, in render_template
    ctx.app,
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/invenio/.local/share/virtualenvs/src-Z_EJbJTQ/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/invenio/src/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html", line 20, in top-level template code
    {% from 'rero_ils/macros/macro.html' import dl, dl_dict, div_json %}
  File "/invenio/src/rero_ils/templates/rero_ils/page.html", line 27, in top-level template code
    {%- block outer_body %}
  File "/invenio/src/rero_ils/templates/rero_ils/page.html", line 33, in block "outer_body"
    {%- block body_inner %}
  File "/invenio/src/rero_ils/templates/rero_ils/page.html", line 37, in block "body_inner"
    {%- block page_body %}
  File "/invenio/src/rero_ils/templates/rero_ils/page.html", line 39, in block "page_body"
    {%- block body %}
  File "/invenio/src/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html", line 38, in block "body"
    {%- block record_body %}
  File "/invenio/src/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html", line 283, in block "record_body"
    {{ location.get_library().name }}
jinja2.exceptions.UndefinedError: 'None' has no attribute ‘get_library'

Expected behavior
The document detailed view rendering should succeed, but without pickup location for a give library in the request button dropdown menu.

Software version
ils.test.rero.ch, v0.5.1

ilsdev.test.rero.ch, 9aa529c

Additional information

When creating the first location of a library, the pickup location check box should be activated, without the possibility of deactivating it, until there's another pickup location for this library.

@iGormilhit iGormilhit added bug bug (critical) Blocking issue, should be fixed ASAP labels Nov 6, 2019
jma added a commit to jma/rero-ils that referenced this issue Nov 7, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/rero-ils that referenced this issue Nov 8, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/rero-ils that referenced this issue Nov 8, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
@jma jma mentioned this issue Nov 8, 2019
6 tasks
jma added a commit to jma/rero-ils that referenced this issue Nov 8, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.
* Fixes logged user initial user menu.
* Fixes reset password links in the user email when a librarian create a
patron.
* Forces instance jinja templates to be loaded before all other
templates.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/rero-ils that referenced this issue Nov 8, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.
* Fixes logged user initial user menu.
* Fixes reset password links in the user email when a librarian create a
patron. Closes: rero#608.
* Forces instance jinja templates to be loaded before all other
templates.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/rero-ils that referenced this issue Nov 8, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.
* Fixes logged user initial user menu.
* Fixes reset password links in the user email when a librarian create a
patron. Closes: rero#608.
* Forces instance jinja templates to be loaded before all other
templates.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/rero-ils that referenced this issue Nov 11, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: rero#598.
* Fixes import document using EAN from the BNF server. Closes: rero#607.
* Improves logs to BNF document importation.
* Fixes logged user initial user menu.
* Fixes reset password links in the user email when a librarian create a
patron. Closes: rero#608.
* Forces instance jinja templates to be loaded before all other
templates.
* Makes exception variable more explicit e -> error.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
iGormilhit pushed a commit that referenced this issue Nov 11, 2019
* Fixes item types type validation.
* Fixes validation message for patron phone number.
* Adds opening hours to the library of the 3th organisation.
* Fixes document detailed view for patrons with organisation without
pickup locations. Closes: #598.
* Fixes import document using EAN from the BNF server. Closes: #607.
* Improves logs to BNF document importation.
* Fixes logged user initial user menu.
* Fixes reset password links in the user email when a librarian create a
patron. Closes: #608.
* Forces instance jinja templates to be loaded before all other
templates.
* Makes exception variable more explicit e -> error.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
@jma jma closed this as completed in 5ea94b4 Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (critical) Blocking issue, should be fixed ASAP
Projects
None yet
Development

No branches or pull requests

2 participants