Here is a sort clause that tries to keep the default hprox behavior by default, but if the circ.hold_hprox_depth library setting is set for the copy owning location then use that as the depth.
Although I think this might need another COALESCE for the case when the depth is set to lower than what exists for an OU. For the case where one system uses sub systems, while others don't.
I think I'll just hard code the simple version for our needs. If anyone else would find this generally useful then I'll keep working on it. But if it is only something we want to use then I will probably just keep this modification local.
actor.org_unit_proximity(
(actor.org_unit_ancestor_at_depth(:copyowninglib,
COALESCE(
(SELECT oils_json_to_text(value)::INT
FROM actor.org_unit_ancestor_setting('circ.hold_hprox_depth', :copyowninglib))
,
(SELECT aout.depth
FROM actor.org_unit aou
JOIN actor.org_unit_type aout ON aout.id=aou.ou_type
WHERE aou.id=:copyowninglib
)
))).id
,
(actor.org_unit_ancestor_at_depth(h.pickup_lib,
COALESCE(
(SELECT oils_json_to_text(value)::INT
FROM actor.org_unit_ancestor_setting('circ.hold_hprox_depth', :copyowninglib))
,
(SELECT aout.depth
FROM actor.org_unit aou
JOIN actor.org_unit_type aout ON aout.id=aou.ou_type
WHERE aou.id=:copyowninglib
)
))).id
)
Here is a sort clause that tries to keep the default hprox behavior by default, but if the circ.hold_ hprox_depth library setting is set for the copy owning location then use that as the depth.
Although I think this might need another COALESCE for the case when the depth is set to lower than what exists for an OU. For the case where one system uses sub systems, while others don't.
I think I'll just hard code the simple version for our needs. If anyone else would find this generally useful then I'll keep working on it. But if it is only something we want to use then I will probably just keep this modification local.
actor.org_ unit_proximity( org_unit_ ancestor_ at_depth( :copyowninglib, to_text( value): :INT unit_ancestor_ setting( 'circ.hold_ hprox_depth' , :copyowninglib)) :copyowninglib org_unit_ ancestor_ at_depth( h.pickup_ lib, to_text( value): :INT unit_ancestor_ setting( 'circ.hold_ hprox_depth' , :copyowninglib)) :copyowninglib
(actor.
COALESCE(
(SELECT oils_json_
FROM actor.org_
,
(SELECT aout.depth
FROM actor.org_unit aou
JOIN actor.org_unit_type aout ON aout.id=aou.ou_type
WHERE aou.id=
)
))).id
,
(actor.
COALESCE(
(SELECT oils_json_
FROM actor.org_
,
(SELECT aout.depth
FROM actor.org_unit aou
JOIN actor.org_unit_type aout ON aout.id=aou.ou_type
WHERE aou.id=
)
))).id
)