rank_ou() honors pref-lib in non-global context
When determining how to sort an org unit (e.g. sorting copies by circ
lib for display in the catalog), allow the pref-lib to affect the sort
order in global and non-global searches.
Org units are now sorted with the following criteria in the following
order. For example, assume we are sorting a copy circ_lib:
1. circ_lib matches the search_lib
2. circ_lib matches pref_lib
3. distance of circ_lib from pref_lib when pref_lib is a child of
search_lib, if circ_lib is a child of pref_lib.
(For example, searching CONS with pref_lib SYS1, items at BR1 will
sort ahead of items at BR3, since BR1 is a child of the pref_lib).
4. proximity of circ_lib to search_lib, when circ_lib is a child of
search_lib.
5. In all other cases, circ_lib is sorted to the bottom with the rest of
the riffraff.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>