]> git.evergreen-ils.org Git - Evergreen.git/commit
LP 1499123: Modify Perl code for csp.ignore_proximity field.
authorJason Stephenson <jason@sigio.com>
Sat, 26 Sep 2015 15:42:35 +0000 (11:42 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 16 Feb 2016 17:45:07 +0000 (12:45 -0500)
commit831a808746308a174f1209d3bec9c2284602798b
tree12923ae233f69275083e2b26bfb825fda9ddf4ca
parent63205ed42a72a3cb6b3c7d7d3d76154dab40be1f
LP 1499123: Modify Perl code for csp.ignore_proximity field.

* Add get_org_unit_proximity function to AppUtils.

First, we add a helper function to OpenILS::Application::AppUtils that
returns the proximity value between a "from" org_unit and a "to"
org_unit.  It takes a CStoreEditor and the ids of the two org_units as
arguments.

* Use csp.ignore_proximity in O::A::Circ::Circulate::Circulator.

Modify the check_hold_fulfill_blocks method of the Circulator object
to take the csp.ignore_proximity into account.

The new code first calculates the proximity of the circ_lib and the
copy's circ_lib with the patron's home_ou.  It then modifies the main
query in the function to check if the csp object's ignore_proximity
is null or greater than either of the two calculated proximity values.

* Teach SIP::Patron about csp.ignore_proximity.

We modify SIP::Patron::flesh_user_penalties to not report penalties
within csp.ignore_proximity of the user's home_ou.

In order to have a notion of "here" for the proximity check, we modify
SIP::Patron->new to assign its authtoken argument, if any, to the
CStoreEditor.  We then use this authtoken to retrieve the authsession
user so that we may use the authsession user's ws_ou or home_ou as a
context ou for penalty lookup and filtering based on the
csp.ignore_proximity in flesh_user_penalties. If we're not given the
authtoken, we fall back to using the patron's home_ou and the
penalty's context ou for the proximity lookup.

This assumes, of course, that the authsession user's ws_ou or home_ou
have a logical relationship with the desired transaction ou.  For most
self-checks this will likely be true.  For other uses of the SIP
protocol, this is less likely to be true.

* Add Perl live tests.

Add tests for basic checkout and hold functionality as well as for
the OpenILS::SIP::Patron->flesh_user_penalties() changes.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
Open-ILS/src/perlmods/live_t/12-lp1499123_csp_ignore_proximity.t [new file with mode: 0644]