Bug 26302: Refactor Availability block in OPAC results xslt
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 5 Aug 2021 11:43:16 +0000 (11:43 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 30 Aug 2021 15:04:30 +0000 (17:04 +0200)
commitddce55a2aa33128189f55a7b61ef605b8a656cc2
tree4497ef01594c7157543fa2c7091ede009dd01ea8
parent2fce208e64b7b5e2e63861641becabb08b302d8d
Bug 26302: Refactor Availability block in OPAC results xslt

Decided finally to do a larger refactor here. Hopefully we improved
consistency and removed some redundancy. And the two new prefs provide
additional functionality.

Most significant changes:
[1] Clearer distinction of the Availability line in three parts:
    Available, Reference and Unavailable.
    For Unavailable we loop thru branches now too.
[2] Calling template to list item data (including location or ccode).
    Made the separate Location line obsolete.
[3] The tests around OPACItemLibrary are removed since we now look at
    resultbranch from XSLT.pm.
[4] Removed code replication for various 'other' statuses like Checked out.
[5] Obsoleted three xslt key indexes, singleBranchMode.
[6] Apply the two prefs to control number of listed items.

Test plan:
You may play with: OPACResultsLibrary (home/holding), OPACItemLocation
(library, callno, location, ccode), resultsMaxItems[Unavailable] (numbers),
Reference_NFL_Statuses (list of notforloan codes in reference part).

[1] Create a biblio with various items on a few branches. Fill call number,
    location and ccode too. Set home branch and holdingbranch differently.
[2] Toggle the preferences, and verify display within OAPC search results.

Example with prefs (home, callnumber, 2, 2):
Availability: Items available for loan: Centerville (2)Call number: perl A 4, PERL D 1. Items available for reference: Fairfield: Not For Loan (1)Call number: PERL A 5. Not available: Centerville: Checked out (1)Call number: PERL A 3. Centerville: Ordered (1)Call number: PERL B 1. Centerville: Staff Collection (2)Call number: PERL A 2, PERL E 1. Centerville: Withdrawn (1)Call number: PERL B 2. Fairfield: Withdrawn (1)Call number: PERL C 1.

Same data with prefs (holding, callnumber, 2, 2):
Availability: Items available for loan: Centerville (1)Call number: PERL D 1. Liberty (1)Call number: perl A 4. Items available for reference: Centerville: Not For Loan (1)Call number: PERL A 5. Not available: Centerville: Checked out (1)Call number: PERL A 3. Centerville: Staff Collection (1)Call number: PERL A 2. Centerville: Withdrawn (1)Call number: PERL B 2. Fairfield: Ordered (1)Call number: PERL B 1. Fairfield: Withdrawn (1)Call number: PERL C 1. Liberty: Staff Collection (1)Call number: PERL E 1.

Same data with prefs (holding, library, n/a, n/a):
Availability: Items available for loan: Centerville (1). Liberty (1). Items available for reference: Centerville: Not For Loan (1). Not available: Centerville: Checked out (1). Centerville: Staff Collection (1). Centerville: Withdrawn (1). Fairfield: Ordered (1). Fairfield: Withdrawn (1). Liberty: Staff Collection (1).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl