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>
Stamping upgrade for relaxing rank_ou sorting

Signed-off-by: Ben Shum <bshum@biblio.org>
unapi exclude_invisible_acn

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
"exclude_invisible_acn" unapi holdings filter

When present in the unapi includes array, this filter ensures that no
call numbers with 0 opac-visible copies are included in the holdings_xml
output.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Show local call number in TPAC My Lists display

If an opac-visible call number exists that is owned by an org unit
relevant to the patron, show the (most relevant) call number label in
the My Lists display for each record in the list.  Call number is
displayed in both saved and temporary lists.

A call number is considered relevant if its owner is one of:

physical location library
preferred library (plib, home, etc.)
search library

This code leverages the new "exclude_invisible_acn" unapi filter to
ensure that we are only required to retrieve 1 call number in the unapi
output instead of an arbitrarily large set of call numbers, against
which we may have to filter non-visible call numbers.

This commit also addresses and outstanding TODO item in the tpac Perl:
Replace the last use of fetch_marc_xml_by_id with get_records_and_facets
and remove fetch_marc_xml_by_id

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
TPAC My List Call-Number Release Notes

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Consistent response type from TPAC pref lib lookup

In some contexts, the $user->home_ou field is fleshed with a real org
unit object.  Ensure that the response value from _get_pref_lib in the
TPAC takes this into consideration when finding the ID of the user's
home org unit.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
tpac avoid more org_unit template var leaks

Avoid using the variable name 'org_unit' in misc_utils (when compiling
copy visibility info) since the value can leak into the org_selector
template, disrupting the rendering of the org selector.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
TPAC my-list call number includes child orgs

For my-list call number display, if the most relevant call number is a
child of any of the context org units (physical/pref/search), it is
considered relevant for purposes of call number display.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Stamping upgrade for "exclude_invisible_acn" unapi holdings filter

Signed-off-by: Ben Shum <bshum@biblio.org>