Bugzilla – Attachment 182479 Details for
Bug 39896
System preference AuthorLinkSortBy is not working for UNIMARC or custom XSLT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39896: Add UNIMARC support for AuthorLinkSortBy
Bug-39896-Add-UNIMARC-support-for-AuthorLinkSortBy.patch (text/plain), 13.33 KB, created by
Marion Durand
on 2025-05-15 09:04:34 UTC
(
hide
)
Description:
Bug 39896: Add UNIMARC support for AuthorLinkSortBy
Filename:
MIME Type:
Creator:
Marion Durand
Created:
2025-05-15 09:04:34 UTC
Size:
13.33 KB
patch
obsolete
>From 8902625bd3a73fe923337232f8644da8548919fe Mon Sep 17 00:00:00 2001 >From: Marion Durand <marion.durand@biblibre.com> >Date: Thu, 15 May 2025 08:31:17 +0000 >Subject: [PATCH] Bug 39896: Add UNIMARC support for AuthorLinkSortBy > >This patch add support for AuthorLinkSortBy and AuthorLinkSortOrder in >the default UNIMARC XSLT files. > >The description of the syspref is also slighly updated to hint users of >custom XSLT file about the need to update their template. > >To test: >0. On a UNIMARC database >1. Set AuthorLinkSortBy to 'title' and AuthorLinkSortORder to > 'descending' >2. On the intranet and OPAC, search for an author you have multiple > titles from and click on a result >3. Click on a link one a name for an author >4. Note a new search is performed, sorted by field from defaultSortField > preference and not by title descending >5. Apply the patch >6. restart_all >7. Check that the syspref description now include a note about custom > XSLT files >8. Repeat step 2 and 3 >9. Note a new search is performed, sorted by title descending >10. Test other values - confirm links are updated in both staff and opac >--- > .../en/modules/admin/preferences/searching.pref | 3 ++- > .../prog/en/xslt/UNIMARCslim2intranetDetail.xsl | 15 ++++++++++++++- > .../prog/en/xslt/UNIMARCslimUtils.xsl | 14 ++++++++++++++ > .../bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl | 14 ++++++++++++++ > .../bootstrap/en/xslt/UNIMARCslimUtils.xsl | 14 ++++++++++++++ > 5 files changed, 58 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 447d145ab2..621c5bf6b3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -213,7 +213,7 @@ Searching: > za: from Z to A > - . > - >- - By default, sort search results from author links in MARC21 detail pages and result lists by >+ - By default, sort search results from author links in detail pages and result lists by > - pref: AuthorLinkSortBy > default: default > choices: >@@ -230,6 +230,7 @@ Searching: > az: from A to Z > za: from Z to A > - . >+ - "<br /><strong>NOTE:</strong> If you are using custom XSLT you need to make sure the system preference check is implemented." > - > - When limiting search results with a library or library group, limit by the item's > - pref: SearchLimitLibrary >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >index 982bea8b8b..d92d9cff86 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl >@@ -21,7 +21,8 @@ > <xsl:variable name="leader6" select="substring($leader,7,1)"/> > <xsl:variable name="leader7" select="substring($leader,8,1)"/> > <xsl:variable name="biblionumber" select="marc:controlfield[@tag=001]"/> >- >+ <xsl:variable name="AuthorLinkSortBy" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortBy']"/> >+ <xsl:variable name="AuthorLinkSortOrder" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortOrder']"/> > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -59,36 +60,48 @@ > <xsl:with-param name="tag">700</xsl:with-param> > <xsl:with-param name="label">Main Author</xsl:with-param> > <xsl:with-param name="spanclass">main_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">710</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Main)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_main_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">701</xsl:with-param> > <xsl:with-param name="label">Coauthor</xsl:with-param> > <xsl:with-param name="spanclass">coauthor</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">702</xsl:with-param> > <xsl:with-param name="label">Secondary Author</xsl:with-param> > <xsl:with-param name="spanclass">secondary_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">711</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Coauthor)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_coauthor</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">712</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Secondary)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_secondary_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:if test="marc:datafield[@tag=101]"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >index e344fdf7de..648f927141 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl >@@ -419,6 +419,8 @@ > <xsl:param name="tag" /> > <xsl:param name="label" /> > <xsl:param name="spanclass" /> >+ <xsl:param name="AuthorLinkSortBy"/> >+ <xsl:param name="AuthorLinkSortOrder"/> > <xsl:if test="marc:datafield[@tag=$tag]"> > <span class="results_summary author {$spanclass}"> > <span class="label"> >@@ -434,6 +436,12 @@ > <xsl:attribute name="href"> > <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=an:</xsl:text> > <xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/> >+ <xsl:if test="$AuthorLinkSortBy!='default'"> >+ <xsl:text>&sort_by=</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortBy"/> >+ <xsl:text>_</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortOrder"/> >+ </xsl:if> > </xsl:attribute> > </xsl:when> > <xsl:otherwise> >@@ -442,6 +450,12 @@ > <xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/> > <xsl:text>%20</xsl:text> > <xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/> >+ <xsl:if test="$AuthorLinkSortBy!='default'"> >+ <xsl:text>&sort_by=</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortBy"/> >+ <xsl:text>_</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortOrder"/> >+ </xsl:if> > </xsl:attribute> > </xsl:otherwise> > </xsl:choose> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >index 0992550b1a..27f1cbe13e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >@@ -23,6 +23,8 @@ > <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/> > <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/> > <xsl:variable name="ContentWarningField" select="marc:sysprefs/marc:syspref[@name='ContentWarningField']"/> >+ <xsl:variable name="AuthorLinkSortBy" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortBy']"/> >+ <xsl:variable name="AuthorLinkSortOrder" select="marc:sysprefs/marc:syspref[@name='AuthorLinkSortOrder']"/> > > <xsl:if test="marc:datafield[@tag=200]"> > <xsl:for-each select="marc:datafield[@tag=200]"> >@@ -89,36 +91,48 @@ > <xsl:with-param name="tag">700</xsl:with-param> > <xsl:with-param name="label">Main Author</xsl:with-param> > <xsl:with-param name="spanclass">main_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">710</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Main)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_main_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">701</xsl:with-param> > <xsl:with-param name="label">Coauthor</xsl:with-param> > <xsl:with-param name="spanclass">coauthor</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">702</xsl:with-param> > <xsl:with-param name="label">Secondary Author</xsl:with-param> > <xsl:with-param name="spanclass">secondary_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">711</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Coauthor)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_coauthor</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_7xx"> > <xsl:with-param name="tag">712</xsl:with-param> > <xsl:with-param name="label">Corporate Author (Secondary)</xsl:with-param> > <xsl:with-param name="spanclass">corporate_secondary_author</xsl:with-param> >+ <xsl:with-param name="AuthorLinkSortOrder" select="$AuthorLinkSortOrder"/> >+ <xsl:with-param name="AuthorLinkSortBy" select="$AuthorLinkSortBy"/> > </xsl:call-template> > > <xsl:call-template name="tag_title"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >index 25874e25f8..054312bc4e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl >@@ -418,6 +418,8 @@ > <xsl:param name="tag" /> > <xsl:param name="label" /> > <xsl:param name="spanclass" /> >+ <xsl:param name="AuthorLinkSortBy"/> >+ <xsl:param name="AuthorLinkSortOrder"/> > <xsl:variable name="IdRef" select="marc:sysprefs/marc:syspref[@name='IdRef']"/> > <xsl:if test="marc:datafield[@tag=$tag]"> > <span class="results_summary author {$spanclass}"> >@@ -433,6 +435,12 @@ > <xsl:attribute name="href"> > <xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text> > <xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/> >+ <xsl:if test="$AuthorLinkSortBy!='default'"> >+ <xsl:text>&sort_by=</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortBy"/> >+ <xsl:text>_</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortOrder"/> >+ </xsl:if> > </xsl:attribute> > </xsl:when> > <xsl:otherwise> >@@ -441,6 +449,12 @@ > <xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/> > <xsl:text>%20</xsl:text> > <xsl:value-of select="str:encode-uri(marc:subfield[@code='b'], true())"/> >+ <xsl:if test="$AuthorLinkSortBy!='default'"> >+ <xsl:text>&sort_by=</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortBy"/> >+ <xsl:text>_</xsl:text> >+ <xsl:value-of select="$AuthorLinkSortOrder"/> >+ </xsl:if> > </xsl:attribute> > </xsl:otherwise> > </xsl:choose> >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39896
:
182479
|
182884