From 2538187aba67e19e11c585cc2a7d6f5f2b488ee5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 21 Apr 2020 16:20:24 +0200 Subject: [PATCH] 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. --- C4/XSLT.pm | 7 +++++++ .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 1b3941c7fb..c35742a80d 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -266,6 +266,11 @@ sub XSLTParse4Display { $variables->{OpenURLResolverURL} = $biblio->get_openurl; } } + + if ( C4::Context->userenv ) { + $variables->{logged_in_user_branchcode} = C4::Context->userenv->{branch} + } + my $varxml = "\n"; while (my ($key, $value) = each %$variables) { $varxml .= "$value\n"; @@ -356,6 +361,7 @@ sub buildKohaItemsNamespace { $status = "available"; } my $homebranch = xml_escape($branches{$item->homebranch}); + my $homebranchcode = xml_escape($item->homebranch); my $holdingbranch = xml_escape($branches{$item->holdingbranch}); my $location = xml_escape($item->location && exists $shelflocations->{$item->location} ? $shelflocations->{$item->location} : $item->location); my $ccode = xml_escape($item->ccode && exists $ccodes->{$item->ccode} ? $ccodes->{$item->ccode} : $item->ccode); @@ -364,6 +370,7 @@ sub buildKohaItemsNamespace { $xml .= "" . "$homebranch" + . "$homebranchcode" . "$holdingbranch" . "$location" . "$ccode" diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index d29fdceaee..43cdcdc6d3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -35,6 +35,7 @@ + @@ -1262,11 +1263,20 @@ - + + + + + + + + + + Call number: - + ( -- 2.20.1