FF 148
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 29 Nov 2012 22:58:31 +0000 (17:58 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 5 Dec 2012 17:39:36 +0000 (12:39 -0500)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index 271d6d7..60fe6b7 100644 (file)
@@ -294,8 +294,8 @@ sub nearest_hold {
        local $OpenILS::Application::Storage::WRITE = 1;
 
        my $holdsort = isTrue($fifo) ?
-                       "pgt.hold_priority, CASE WHEN h.cut_in_line IS TRUE THEN 0 ELSE 1 END, h.request_time, h.selection_depth DESC, hm.proximity " :
-                       "hm.proximity, pgt.hold_priority, CASE WHEN h.cut_in_line IS TRUE THEN 0 ELSE 1 END, h.selection_depth DESC, h.request_time ";
+                       "pgt.hold_priority, CASE WHEN h.cut_in_line IS TRUE THEN 0 ELSE 1 END, h.request_time, h.selection_depth DESC, COALESCE(hm.proximity, h.prox) " :
+                       "COALESCE(hm.proximity, h.prox), pgt.hold_priority, CASE WHEN h.cut_in_line IS TRUE THEN 0 ELSE 1 END, h.selection_depth DESC, h.request_time ";
 
        my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $here, $cp, $age);
                SELECT  h.id