From d2f41ba6829aad91367cb5e47a5825ffcb7ee2df Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 28 Dec 2011 15:44:36 -0500 Subject: [PATCH] Use hold current shelf lib to determine availability : opac sorting The availability of a hold can now be determined by hold.current_shelf_lib == hold.pickup_lib. This change uses the new hold availability test to sort available holds to front/top of a patron's holds list (for the OPAC). Affects open-ils.circ.holds[.canceled|id_list].retrieve Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index a5b76f9f0f..38f269fe95 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -530,7 +530,17 @@ sub retrieve_holds { } else { # order non-cancelled holds by ready-for-pickup, then active, followed by suspended - $holds_query->{order_by} = {ahr => ['shelf_time', 'frozen', 'request_time']}; + # "compare" sorts false values to the front. testing pickup_lib != current_shelf_lib + # will sort by pl = csl > pl != csl > followed by csl is null; + $holds_query->{order_by} = [ + { class => 'ahr', + field => 'pickup_lib', + compare => {'!=' => {'+ahr' => 'current_shelf_lib'}}}, + {class => 'ahr', field => 'shelf_time'}, + {class => 'ahr', field => 'frozen'}, + {class => 'ahr', field => 'request_time'} + + ]; $holds_query->{where}->{cancel_time} = undef; } -- 2.11.0