Created attachment 4157 [details]
A screenshot illustrating the problem
With the new templates, in results' view in OPAC (having OPACXSLTResultsDisplay set to 'normally') the (un)availability of items is not displayed correctly: if there are no items available, Koha still displays "Availability: Copies available: " (cf. screenshot), whereas it should be "Availability: No items available:" etc.
Apparently the dereference of SEARCH_RESULT.available_items_loop in opac-results.tt is not interpreted correctly (available_items_loop list is empty but [% IF ( SEARCH_RESULT.available_items_loop ) %] is interpreted as true.
A very simple patch follows.
Created attachment 4158 [details] [review]
This patch didn't apply for me ("Patch format detection failed"). I see that the fix is a very simple change. Can you explain how it works?
Created attachment 4258 [details] [review]
Proposed patch (with header)
I have just uploaded this patch with the header (sorry for cutting it off)--it should apply smoothly now.
There are apparently some problems with variable scoping / dereferencing in the SEARCH_RESULT.available_items_loop construct.
Previous (i.e. 3.2) the behaviour was: if there are no items attached at all (just the biblio record) or no item is available (e.g. all items checked out) then "No items available:" message is displayed bellow the title etc. on the collective search results list. As I look at the new template, now it should be the same.
BUT is not. Even if there no items in available_items_loop, the result of the test [% IF ( SEARCH_RESULT.available_items_loop ) %] is positive (I do not know why) and you get "Copies available:" message.
To see this try with records with no items attached both in Koha 3.2 and in 3.4.
So, what the patch does is: it checks explicitly if the first element of the array available_items_loop exist (instead of checking if available_items_loop is not empty). It is less elegant, but it means the same and it does work as expected.
Created attachment 4278 [details] [review]
With OPACXSLTResultsDisplay set to 'normally', the OPAC search results correctly displays "No items available: Checked out (1)".