From: Jason Etheridge Date: Wed, 26 Feb 2020 14:40:04 +0000 (-0500) Subject: LP#1869794 new best hold sort order X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f7de08705a136b7ddc85057b645e19a132b0d57b;p=evergreen%2Ftadl.git LP#1869794 new best hold sort order owning lib to requestee home lib proximity implementation, release notes and TechRef tweak Signed-off-by: Jason Etheridge Signed-off-by: Lindsay Stratton Signed-off-by: Ben Shum --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index e849f66e2c..9225c86a8b 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2973,6 +2973,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index 6c69acb937..4662c23401 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -23,6 +23,7 @@ my $U = "OpenILS::Application::AppUtils"; my %HOLD_SORT_ORDER_BY = ( pprox => 'p.prox', hprox => 'actor.org_unit_proximity(%d, h.pickup_lib)', # $cp->call_number->owning_lib + owning_lib_to_home_lib_prox => 'actor.org_unit_proximity(%d, au.home_ou)', # $cp->call_number->owning_lib aprox => 'COALESCE(hm.proximity, p.prox)', approx => 'action.hold_copy_calculated_proximity(h.id, %d, %d)', # $cp,$here priority => 'pgt.hold_priority', @@ -348,8 +349,9 @@ sub get_hold_sort_order { my $row = $dbh->selectrow_hashref( q! SELECT - cbho.pprox, cbho.hprox, cbho.aprox, cbho.approx, cbho.priority, - cbho.cut, cbho.depth, cbho.htime, cbho.shtime, cbho.rtime + cbho.pprox, cbho.hprox, cbho.owning_lib_to_home_lib_prox, cbho.aprox, + cbho.approx, cbho.priority, cbho.cut, cbho.depth, cbho.htime, + cbho.shtime, cbho.rtime FROM config.best_hold_order cbho WHERE id = ( SELECT oils_json_to_text(value)::INT @@ -378,6 +380,7 @@ sub build_hold_sort_clause { my %order_by_sprintf_args = ( hprox => [$cp->call_number->owning_lib], + owning_lib_to_home_lib_prox => [$cp->call_number->owning_lib], approx => [$cp->id, $here], htime => [$cp->call_number->owning_lib, $cp->call_number->owning_lib], shtime => [$cp->call_number->owning_lib, $cp->call_number->owning_lib] diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 64fd79fa21..ac2df51d2a 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -1140,6 +1140,7 @@ CREATE TABLE config.best_hold_order( name TEXT UNIQUE, -- i18n pprox INT, -- copy capture <-> pickup lib prox hprox INT, -- copy circ lib <-> request lib prox + owning_lib_to_home_lib_prox INT, -- copy owning lib <-> user home lib prox aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm approx INT, -- copy capture <-> pickup lib ADJUSTED prox from function priority INT, -- group hold priority @@ -1154,6 +1155,7 @@ CREATE TABLE config.best_hold_order( ALTER TABLE config.best_hold_order ADD CHECK (( pprox IS NOT NULL OR hprox IS NOT NULL OR + owning_lib_to_home_lib_prox IS NOT NULL OR aprox IS NOT NULL OR priority IS NOT NULL OR cut IS NOT NULL OR diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index a75734572c..ce54ebcf8a 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -16055,6 +16055,14 @@ INSERT INTO config.best_hold_order ( 1, 2, 3, 4, 5, 6, 7, 8 ); +INSERT INTO config.best_hold_order ( + name, + owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime +) VALUES ( + 'Traditional with Holds-chase-home-lib-patrons', + 1, 2, 3, 4, 5, 6, 7, 8, 9 +); + INSERT INTO actor.org_unit_setting ( org_unit, name, value ) VALUES ( diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.hpprox-best-hold-sort-order b/Open-ILS/src/sql/Pg/upgrade/XXXX.hpprox-best-hold-sort-order new file mode 100755 index 0000000000..3d8555beb9 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.hpprox-best-hold-sort-order @@ -0,0 +1,30 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE config.best_hold_order ADD COLUMN owning_lib_to_home_lib_prox INT; -- copy owning lib <-> user home lib prox + +ALTER table config.best_hold_order DROP CONSTRAINT best_hold_order_check; + +-- At least one of these columns must contain a non-null value +ALTER TABLE config.best_hold_order ADD CHECK (( + pprox IS NOT NULL OR + hprox IS NOT NULL OR + owning_lib_to_home_lib_prox IS NOT NULL OR + aprox IS NOT NULL OR + priority IS NOT NULL OR + cut IS NOT NULL OR + depth IS NOT NULL OR + htime IS NOT NULL OR + rtime IS NOT NULL +)); + +INSERT INTO config.best_hold_order ( + name, + owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime +) VALUES ( + 'Traditional with Holds-chase-home-lib-patrons', + 1, 2, 3, 4, 5, 6, 7, 8, 9 +); + +COMMIT; diff --git a/Open-ILS/web/js/dojo/openils/conify/BestHoldOrder.js b/Open-ILS/web/js/dojo/openils/conify/BestHoldOrder.js index 52d2862e20..e4fd1c7564 100644 --- a/Open-ILS/web/js/dojo/openils/conify/BestHoldOrder.js +++ b/Open-ILS/web/js/dojo/openils/conify/BestHoldOrder.js @@ -114,8 +114,9 @@ if (!dojo._hasResource["openils.conify.BestHoldOrder"]) { /* We could get these from the IDL, but if we add more fields to that * later, we have no particular mechanism for determining what is or * isn't metadata. */ - module.fields = ["pprox", "hprox", "aprox", "priority", "cut", "depth", - "htime", "rtime", "approx", "shtime"]; + module.fields = ["pprox", "hprox", "owning_lib_to_home_lib_prox", + "aprox", "priority", "cut", "depth", "htime", "rtime", "approx", + "shtime"]; module.init = function() { module.progress_dialog = dijit.byId("progress-dialog"); diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/hold-sort-order-chase-home-lib-patrons.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/hold-sort-order-chase-home-lib-patrons.adoc new file mode 100644 index 0000000000..4d683cbcdd --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Circulation/hold-sort-order-chase-home-lib-patrons.adoc @@ -0,0 +1,5 @@ +New Hold Sort Order: Traditional with Holds-chase-home-lib-patrons +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This is a new entry under Administration -> Server Administration -> Best-Hold Selection Sort Order in the staff client. It prioritizes holds such that a given item, based on its owning library, will prefer patrons with a matching home library, no matter the pickup library. + diff --git a/docs/TechRef/Circ/custom-best-hold-selection.adoc b/docs/TechRef/Circ/custom-best-hold-selection.adoc index 4670966bc7..277880429b 100644 --- a/docs/TechRef/Circ/custom-best-hold-selection.adoc +++ b/docs/TechRef/Circ/custom-best-hold-selection.adoc @@ -99,6 +99,7 @@ CREATE TABLE config.best_hold_order( name TEXT UNIQUE, -- i18n (metadata) pprox INT, -- copy capture <-> pickup lib prox hprox INT, -- copy circ lib <-> request lib prox + owning_lib_to_home_lib_prox INT, -- copy owning lib <-> user home lib prox aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm priority INT, -- group hold priority cut INT, -- cut-in-line @@ -111,6 +112,7 @@ CREATE TABLE config.best_hold_order( ALTER TABLE config.best_hold_order ADD CHECK (( pprox IS NOT NULL OR hprox IS NOT NULL OR + owning_lib_to_home_lib_prox IS NOT NULL OR aprox IS NOT NULL OR priority IS NOT NULL OR cut IS NOT NULL OR @@ -167,6 +169,14 @@ INSERT INTO config.best_hold_order ( 1, 2, 3, 4, 5, 6, 7, 8 ); +INSERT INTO config.best_hold_order ( + name, + owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime +) VALUES ( + 'Traditional with Holds-chase-home-lib-patrons', + 1, 2, 3, 4, 5, 6, 7, 8, 9 +); + INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, fm_class, update_perm ) VALUES (