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

circulation: adapt reroils #955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Babel = ">=2.4.0"
Flask-BabelEx = ">=0.9.3"
## Third party invenio modules used by RERO ILS
invenio-oaiharvester = {editable = true, ref = "v1.0.0a4", git = "https://github.com/inveniosoftware/invenio-oaiharvester.git"}
invenio-circulation = {editable = true, ref = "v1.0.0a21", git = "https://github.com/inveniosoftware/invenio-circulation.git"}
# invenio-circulation = {editable = true, ref = "v1.0.0a21", git = "https://github.com/inveniosoftware/invenio-circulation.git"}
invenio-circulation = {editable = true, ref = "item_at_desk_temp", git = "https://github.com/rero/invenio-circulation.git"}
## Invenio 3.2.1 base modules used by RERO ILS
# same as invenio metadata extras without invenio-search-ui
invenio-indexer = ">=1.1.1,<1.2.0"
Expand Down
82 changes: 33 additions & 49 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from .modules.items.api import Item
from .modules.items.permissions import can_create_item_factory, \
can_update_delete_item_factory
from .modules.items.utils import item_location_retriever
from .modules.libraries.api import Library
from .modules.libraries.permissions import can_update_library_factory
from .modules.loans.api import Loan
Expand All @@ -66,6 +67,7 @@
ItemOnLoanToItemReturned
from .modules.loans.utils import can_be_requested, get_default_loan_duration, \
get_extension_params, is_item_available_for_checkout, \
loan_build_document_ref, loan_build_item_ref, loan_build_patron_ref, \
loan_satisfy_circ_policies
from .modules.locations.api import Location
from .modules.locations.permissions import can_create_location_factory, \
Expand Down Expand Up @@ -1586,18 +1588,20 @@ def _(x):
}

#: Invenio circulation configuration.
CIRCULATION_ITEM_EXISTS = Item.get_record_by_pid
CIRCULATION_ITEM_EXISTS = Item.item_exists
CIRCULATION_PATRON_EXISTS = Patron.get_record_by_pid

CIRCULATION_ITEM_LOCATION_RETRIEVER = Item.item_location_retriever
CIRCULATION_ITEM_LOCATION_RETRIEVER = item_location_retriever
CIRCULATION_DOCUMENT_RETRIEVER_FROM_ITEM = \
Item.get_document_pid_by_item_pid
Item.get_document_pid_by_item_pid_object
CIRCULATION_ITEMS_RETRIEVER_FROM_DOCUMENT = Item.get_items_pid_by_document_pid

CIRCULATION_DOCUMENT_EXISTS = Document.get_record_by_pid
CIRCULATION_ITEM_REF_BUILDER = Loan.loan_build_item_ref
CIRCULATION_PATRON_REF_BUILDER = Loan.loan_build_patron_ref
CIRCULATION_DOCUMENT_REF_BUILDER = Loan.loan_build_document_ref

CIRCULATION_ITEM_REF_BUILDER = loan_build_item_ref
CIRCULATION_PATRON_REF_BUILDER = loan_build_patron_ref
CIRCULATION_DOCUMENT_REF_BUILDER = loan_build_document_ref

CIRCULATION_TRANSACTION_LOCATION_VALIDATOR = \
Location.transaction_location_validator
CIRCULATION_TRANSACTION_USER_VALIDATOR = \
Expand Down Expand Up @@ -1673,7 +1677,10 @@ def _(x):
dict(dest='CANCELLED', trigger='cancel', transition=ToCancelled)
],
'ITEM_IN_TRANSIT_FOR_PICKUP': [
dict(dest='ITEM_AT_DESK', trigger='receive'),
dict(
dest='ITEM_AT_DESK',
trigger='receive'
),
dict(dest='CANCELLED', trigger='cancel', transition=ToCancelled)
],
'ITEM_ON_LOAN': [
Expand Down
4 changes: 2 additions & 2 deletions rero_ils/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
title_variant_format_text
from ..holdings.api import Holding
from ..items.api import Item, ItemStatus
from ..items.utils import item_pid_to_object
from ..libraries.api import Library
from ..loans.api import Loan
from ..loans.utils import can_be_requested
Expand Down Expand Up @@ -208,8 +209,7 @@ def can_request(item):
item.get_library().replace_refs()['organisation']['pid']:
# Complete metadata before Loan creation
loan_metadata = dict(item)
if 'item_pid' not in loan_metadata:
loan_metadata['item_pid'] = item.pid
loan_metadata['item_pid'] = item_pid_to_object(item.pid)
if 'patron_pid' not in loan_metadata:
loan_metadata['patron_pid'] = patron.pid
# Create "virtual" Loan (not registered)
Expand Down
Loading