Fix various Traditional and holds-go-home best-hold sort orders
Use copy's call number's owning_lib instead of copy's circ_lib
Should compare checkin lib to copy's (call number's) owning_lib, not
hold request lib.
You might think the comparison should be to acp.circ_lib, but that
doesn't work with floating copies (for non-floaters, acp.circ_lib
should be equal to acp.call_number.owning_lib).
approx is a more correct first determinant to give the behavior sites
are used to.
hprox can cause copies to be too eager to go home when
there are holds with that copy's circ lib as its request lib (if that's
what you want, then you do pick or create a sort-order with hprox near
the top).
Address a problem in the copy_has_not_been_home CTE.
This expression was always meant to provide a TRUE or FALSE value as its
lone result, but would return NULL in cases where copies had no transit
history.
Use pickup_lib, not request_lib, as the determinant of
nearness-to-home. request_lib was used with the thinking that an item's
"owning" patrons should have their wishes favored at holds-go-home time,
even if where they wanted to send the copy was not actually home, but
that's neither necessarily desired nor very intuitive.
Clear up holds-go-home logic with better code AND add TechRef
documentation with diagram in attempt to be as clear as possible.
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>