Bug 25416: Let OPAC XSLTs know if the context is an anonymous session
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 7 May 2020 17:23:40 +0000 (14:23 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 15 May 2020 08:33:22 +0000 (09:33 +0100)
commit2a216e206c13585308fbfb8897f78f9672bd81e0
tree06cea7e0b8f8bc4cdbeeeefd09d6d0ee3abbaa71
parent7e720e7e820408e7e2b7b03f65cbdd1435a2d031
Bug 25416: Let OPAC XSLTs know if the context is an anonymous session

This patch makes use of the 'variables' parameter in XSLTParse4Display
method in the different places that it is used in the OPAC. It does by
passing this parameter with

    anonymous_session => 1|0

The value will depend on the output from get_template_and_user (i.e. if
there's a returned borrowernumber).

A special case takes place in search results, as the call to
XSLTParse4Display happens in C4::Search::searchResults. So a new
parameter 'xslt_variables' is added to it.

To test:
1. Apply the [DO NOT PUSH] patch
2. Open the OPAC in your browser
3. Try detail pages, search results, tags and lists/shelves pages with
   or without an active session
=> FAIL: It always says (somewhere) 'Anonymous session: Yes'
4. Apply this patch, restart_all
5. Repeat 3
=> SUCCESS: It will tell the Yes/No correctly regarding anonymous
sessions!
6. Sign off :-D

Sponsored-by: Universidad ORT Uruguay
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Search.pm
opac/opac-detail.pl
opac/opac-search.pl
opac/opac-shelves.pl
opac/opac-tags.pl