Fix various Traditional and holds-go-home best-hold sort orders
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 3 Apr 2013 20:35:51 +0000 (16:35 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 19 Apr 2013 20:16:44 +0000 (16:16 -0400)
commit036232ce17a3ff957cd33e77f664e02f61f2c80d
tree031cfb02aaacb3b0481d400b51a5899ee8259e83
parentec205de7f1c4d703331ac5deb1401e45b9b2f020
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>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.best-hold-order-traditional-approx.sql [new file with mode: 0644]
docs/TechRef/Circ/holds-go-home.txt [new file with mode: 0644]