Bug 28161 - Allow Koha::Patron->extended_attributes be passed a library_id
Summary: Allow Koha::Patron->extended_attributes be passed a library_id
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-16 19:07 UTC by Tomás Cohen Arazi
Modified: 2021-04-20 17:36 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2021-04-16 19:07:41 UTC
Koha::Patron::Attributes->filter_by_branch_limitations accepts the parameter, and falls back to C4::Context->userenv->{branch} if omitted.

Lacking the parameter in Koha::Patron->extended_attributes makes it always fallback to userenv, thus forcing the caller to deal with that instead of just passing the parameter.

Examples:
- A CLI script with a --library_id param for setting extended attributes would be forced to mock a userenv for checks to work
- An API route would need to deal with that as well.

A minor and harmless change adding this parameter would allow more straight-forward use of this method.
Comment 1 Tomás Cohen Arazi 2021-04-20 17:36:32 UTC
With bug 28157 I'm not going forward with this one. Not closing it, as it might be handy in a near future.