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: update request permissions #343

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,21 @@ export class ItemTransactionComponent implements OnInit, OnDestroy {
* @return: true or false
*/
canCancelRequest(): boolean {
// TODO: manage more complex cases according to specifications (when implemented in backend or invenio-circulation)
return this.transaction.metadata.state === LoanState.PENDING;
// No permission API in backend
// Allowed when loan state is PENDING or ITEM_IN_TRANSIT_FOR_PICKUP according to actions.md
return this.transaction.metadata.state === LoanState.PENDING
|| this.transaction.metadata.state === LoanState.ITEM_IN_TRANSIT_FOR_PICKUP;
}

/**
* Check if request pickup location can be chenged
* @return: true or false
*/
canUpdateRequestPickupLocation(): boolean {
// for now request pickup location update allowed for pending requests only
// TODO: manage case 'at desk' and 'in transit' (needs PO feedback)
return this.transaction.metadata.state === LoanState.PENDING;
// No permission API in backend
// Allowed when loan state is PENDING or ITEM_IN_TRANSIT_FOR_PICKUP according to actions.md
return this.transaction.metadata.state === LoanState.PENDING
|| this.transaction.metadata.state === LoanState.ITEM_IN_TRANSIT_FOR_PICKUP;
}

/**
Expand Down