Bugzilla – Attachment 136525 Details for
Bug 30879
Add option to sort components by biblionumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30879: Add biblionumber as a sorting option in MARC21
Bug-30879-Add-biblionumber-as-a-sorting-option-in-.patch (text/plain), 5.27 KB, created by
Martin Renvoize (ashimema)
on 2022-06-24 15:35:43 UTC
(
hide
)
Description:
Bug 30879: Add biblionumber as a sorting option in MARC21
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-06-24 15:35:43 UTC
Size:
5.27 KB
patch
obsolete
>From 19b4f19e48b7e1c10564b7a8a258513ee185f29e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 22 Jun 2022 14:37:23 +0000 >Subject: [PATCH] Bug 30879: Add biblionumber as a sorting option in MARC21 > >This patch updates the Local-Number indexing by adding a zeropad option >to Zebra indexing and adding this to the mapping files > >It also updates C4/Search.pm to allow biblionumber as an option > >To test: >1 - Apply patches >2 - copy etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl to /etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >3 - Restart all, reindex zebra >4 - Browse to: http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_dsc&count=20 >5 - Confirm records sorted correctly >6 - Browse to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=kw&q=a&sort_by=biblionumber_asc&count=20 >7 - Confirm records sorted correctly > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Search.pm | 6 ++++++ > .../marc_defs/marc21/biblios/biblio-koha-indexdefs.xml | 2 ++ > .../marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl | 9 ++++++++- > etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 4 ++++ > 4 files changed, 20 insertions(+), 1 deletion(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 1ba56c8384..e3debd6993 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -390,6 +390,12 @@ sub getRecords { > elsif ( $sort eq "title_za" || $sort eq "title_dsc" ) { > $sort_by .= "1=4 >i "; > } >+ elsif ( $sort eq "biblionumber_az" || $sort eq "biblionumber_asc" ) { >+ $sort_by .= "1=12 <i "; >+ } >+ elsif ( $sort eq "biblionumber_za" || $sort eq "biblionumber_dsc" ) { >+ $sort_by .= "1=12 >i "; >+ } > else { > warn "Ignoring unrecognized sort '$sort' requested" if $sort_by; > } >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >index c405228d45..7b1895968b 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >@@ -1196,6 +1196,8 @@ > <index_subfields tag="999" subfields="c"> > <target_index>Local-Number:n</target_index> > <target_index>Local-Number:w</target_index> >+ </index_subfields> >+ <index_subfields tag="999" subfields="c" zeropad="1"> > <target_index>Local-Number:s</target_index> > </index_subfields> > <!--record.abs line 269: melm 999$d biblioitemnumber:n,biblioitemnumber:w,biblioitemnumber:s--> >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >index 626c44c5b3..b3222fadb5 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >@@ -1261,11 +1261,18 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xslo:template mode="index_subfields" match="marc:datafield[@tag='999']"> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('c', @code)"> >- <z:index name="Local-Number:n Local-Number:w Local-Number:s"> >+ <z:index name="Local-Number:n Local-Number:w"> > <xslo:value-of select="."/> > </z:index> > </xslo:if> > </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('c', @code)"> >+ <z:index name="Local-Number:s"> >+ <xslo:value-of select="format-number(.,"00000000000")"/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> > <xslo:for-each select="marc:subfield"> > <xslo:if test="contains('d', @code)"> > <z:index name="biblioitemnumber:n biblioitemnumber:w biblioitemnumber:s"> >diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >index f20c48871f..2bdbbf0da6 100644 >--- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >+++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl >@@ -279,6 +279,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xsl:template name="handle-one-index-subfields"> > <xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable> > <xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable> >+ <xsl:variable name="zeropad"><xsl:value-of select="@zeropad"/></xsl:variable> > <xsl:variable name="indexes"> > <xsl:call-template name="get-target-indexes"/> > </xsl:variable> >@@ -302,6 +303,9 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > <xsl:value-of select="$length"/> > <xsl:text>)</xsl:text> > </xsl:when> >+ <xsl:when test="@zeropad"> >+ <xsl:text>format-number(.,"00000000000")</xsl:text> >+ </xsl:when> > <xsl:otherwise> > <xsl:text>.</xsl:text> > </xsl:otherwise> >-- >2.20.1
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 30879
:
136255
|
136425
|
136426
|
136427
|
136428
|
136525
|
136526
|
136527
|
136528
|
136545
|
136546
|
136547
|
136548