Skip to content

Commit

Permalink
fix(ill_request): permissions failed
Browse files Browse the repository at this point in the history
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Feb 15, 2024
1 parent 4f1de3b commit 7d44c82
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions rero_ils/modules/ill_requests/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019-2022 RERO
# Copyright (C) 2019-2024 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Expand All @@ -17,6 +17,7 @@

"""ILL Request serialization."""

from flask_babel import gettext as _
from invenio_records_rest.serializers.response import record_responsify

from rero_ils.modules.libraries.api import LibrariesSearch
Expand All @@ -32,9 +33,11 @@ def _postprocess_search_hit(self, hit: dict) -> None:
"""Post-process each hit of a search result."""
metadata = hit.get('metadata', {})
if pid := metadata.get('pickup_location', {}).get('pid'):
location = self.get_resource(LocationsSearch(), pid)
pickup_name = location.get('ill_pickup_name', location.get('name'))
metadata['pickup_location']['name'] = pickup_name
if location := self.get_resource(LocationsSearch(), pid):
pickup_name = location.get('ill_pickup_name', location.get('name'))
metadata['pickup_location']['name'] = pickup_name
else:
metadata['pickup_location']['name'] = _('[Deleted]')
super()._postprocess_search_hit(hit)

def _postprocess_search_aggregations(self, aggregations: dict) -> None:
Expand Down

0 comments on commit 7d44c82

Please sign in to comment.