Bug 11426

Summary: Make HighlightOwnItemsOnOPAC work with XSLT
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: OPACAssignee: Owen Leonard <oleonard>
Status: CLOSED WONTFIX QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: cbrannon, fridolin.somers, jonathan.druart+koha, katrin.fischer, marjorie.barry-vila, martin.renvoize, nick, patrick.robitaille
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 7740, 15758    
Bug Blocks: 12561    
Attachments: Bug 11426: Restore HighlightOwnItemsOnOPAC for XSLT view
Bug 11426: [POC] Make HighlightOwnItemsOnOPAC work with XSLT

Description Nicole C. Engard 2013-12-19 14:39:13 UTC
It would be nice if the HighlightOwnItemsOnOPAC preference worked on sites using XSLT
Comment 1 Christopher Brannon 2019-09-07 02:40:25 UTC
I agree.  This is still an issue.  While at this time, it does move the item(s), it does not increase the size of the font or highlight the row.

I would also add it would be nice it the prefernce allowed you to choose both options for detection, rather than either or.
Comment 2 Owen Leonard 2019-09-08 19:43:06 UTC
In my quick test this looks like it works with or without XSLT on the detail page and neither with or without XSLT on the results page. Can anyone confirm?
Comment 3 Christopher Brannon 2019-09-09 18:04:19 UTC
(In reply to Owen Leonard from comment #2)
> In my quick test this looks like it works with or without XSLT on the detail
> page and neither with or without XSLT on the results page. Can anyone
> confirm?

I can confirm that for us, it puts the items at the top of the list, but I don't see any font changes or highlighting.  I think we have XSLT in use, but am not sure.
Comment 4 Jonathan Druart 2019-10-23 14:40:09 UTC
Detail page: The highlight is supposed to be done adding a "highlight-row-detail" class, but it does not appear in the css file.

Result page: The code has been copied from the detail page, but... cannot work.
A class is also used, highlight-row-results, but is never set. The 'branchcode' key that is compared with $branchcode:
 850                             if ( $item->{branchcode} eq $branchcode ) {
does not exist (not set by searchResults)
Comment 5 Jonathan Druart 2019-10-23 14:41:10 UTC
(In reply to Jonathan Druart from comment #4)
> Result page: The code has been copied from the detail page, but... cannot
> work.
> A class is also used, highlight-row-results, but is never set. The
> 'branchcode' key that is compared with $branchcode:
>  850                             if ( $item->{branchcode} eq $branchcode ) {
> does not exist (not set by searchResults)

=> This is actually a regression, my bad.
  commit df97814f3034a3d5015546c4eca21f08ae951e37
  Bug 15758: Koha::Libraries - Remove GetBranches
Comment 6 Jonathan Druart 2019-10-23 14:48:32 UTC
Created attachment 94631 [details] [review]
Bug 11426: Restore HighlightOwnItemsOnOPAC for XSLT view
Comment 7 Jonathan Druart 2019-10-23 14:49:37 UTC
With this page you will get the feature working as expected with the non-XSLT views (do not forget `yarn build --view opac`)
Comment 8 Katrin Fischer 2020-01-05 11:44:55 UTC
Should this be 'Needs signoff'?
Comment 9 Jonathan Druart 2020-01-05 21:30:10 UTC
(In reply to Katrin Fischer from comment #8)
> Should this be 'Needs signoff'?

No, see my previous comment.
It only makes the feature work for non-XSLT view. We need it for the XSLT view.
Comment 10 Jonathan Druart 2020-04-21 14:23:48 UTC
Created attachment 103379 [details] [review]
Bug 11426: [POC] Make HighlightOwnItemsOnOPAC work with XSLT

This xsl syntax is insane. We should add this ugly choose test all over
this xsl file, then also in the detail page (with the class highlight-row-detail).

Note that the non-XSLT view use HighlightOwnItemsOnOPACWhich that can be
'OpacURLBranch'. In that case we should not test
logged_in_user_branchcode, but $ENV{BRANCHCODE}. However since we use
plack this feature may have been lost.
Comment 11 Jonathan Druart 2020-04-21 14:24:10 UTC
This is a way to go, feel free to continue the job if you need it.
Comment 12 Owen Leonard 2020-06-05 16:09:44 UTC
Jonathan are you unsatisfied with your solution for some reason? What do you think is unfinished?
Comment 13 Jonathan Druart 2020-06-11 11:23:13 UTC
I cannot remember exactly but I think the answer is in the patch comment:

"""
This xsl syntax is insane. We should add this ugly choose test all over
this xsl file, then also in the detail page (with the class highlight-row-detail).
"""
Comment 14 Jonathan Druart 2021-06-18 14:18:42 UTC
This non-XSLT feature will be removed on bug 12561.