sul-dlss / sul-requests

Rails application for requesting materials from Stanford University Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use patron-specific circulation rules (or FOLIO APIs?) to figure out whether to place a Hold or a Recall

cbeer opened this issue · comments

E.g. https://requests.stanford.edu/hold_recalls/379379/status should have been placed as a Hold, not a Recall, because the patron's group doesn't allow Recalls.

It looks like we initially relied on FOLIO's mod-patron to assign the proper request type, but when we switched to using mod-circulation (for reasons... proxy users, perhaps?) we continued to use the generic circulation rule, not a patron-specific rule.

Here's where we're sending the request type:
https://github.com/sul-dlss/sul-requests/blob/main/app/jobs/submit_folio_request_job.rb#L92C23-L92C45

And the implementation of best_request_type:
https://github.com/sul-dlss/sul-requests/blob/main/app/models/folio/item.rb#L179

We'll need a patron-aware version that evaluates the request type for the specific patron (and presumably opening https://github.com/sul-dlss/sul-requests/blob/main/app/services/folio/circulation_rules/policy_service.rb#L6 up to accept a specific patron group).

If, when evaluating the specific patron group permissions, they are ineligible to hold or recall an item (but one of the "standard" patron groups can do one or the other), I think we should fall back on a regular Hold request until we can provide more specific messaging to the user.