Bugzilla – Attachment 150358 Details for
Bug 29185
Show MARC21 tag 765 - Original Language Entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29185: Groundwork: add template GetCnumSearchURL in Utils
Bug-29185-Groundwork-add-template-GetCnumSearchURL.patch (text/plain), 6.91 KB, created by
Martin Renvoize (ashimema)
on 2023-04-28 07:30:06 UTC
(
hide
)
Description:
Bug 29185: Groundwork: add template GetCnumSearchURL in Utils
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-04-28 07:30:06 UTC
Size:
6.91 KB
patch
obsolete
>From f617a7ba63f31d1a0c94d3b8345483836880b052 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 15 Mar 2023 15:14:29 +0000 >Subject: [PATCH] Bug 29185: Groundwork: add template GetCnumSearchURL in Utils > >Note for QA: Opened bug 33515 to see if we can use this same >function in a few other places too. Would probably reduce code >and increase consistency. > >Test plan: >See next patch. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/en/xslt/MARC21slimUtils.xsl | 48 +++++++++++++++++++ > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 48 +++++++++++++++++++ > 2 files changed, 96 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >index 3ad98c8619..08ed73f01c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >@@ -722,6 +722,54 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="GetCnumSearchURL"> >+ <xsl:param name="title_subfield" select="'t'"/> >+ <xsl:param name="cnum_subfield" select="'w'"/> >+ <xsl:param name="opac_url" select="1"/> >+ <xsl:param name="UseControlNumber"/> >+ >+ <xsl:variable name="orgcode"> >+ <xsl:choose> >+ <xsl:when test="$UseControlNumber!='1'"/> >+ <xsl:when test="substring-before(marc:subfield[@code=$cnum_subfield],')')"> >+ <!-- substring before closing parenthesis, remove parentheses and spaces --> >+ <xsl:value-of select="normalize-space(translate(substring-before(marc:subfield[@code=$cnum_subfield],')'),'()',''))"/> >+ </xsl:when> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="controlnumber"> >+ <xsl:choose> >+ <xsl:when test="$UseControlNumber!='1'"/> >+ <xsl:when test="substring-after(marc:subfield[@code=$cnum_subfield],')')"> >+ <!-- substring after closing parenthesis, remove spaces --> >+ <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code=$cnum_subfield],')'))"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <!-- consider whole subfield now as controlnumber --> >+ <xsl:value-of select="normalize-space(marc:subfield[@code=$cnum_subfield])"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="scriptname"> >+ <xsl:choose> >+ <xsl:when test="$opac_url=1"><xsl:text>/cgi-bin/koha/opac-search.pl</xsl:text></xsl:when> >+ <xsl:otherwise><xsl:text>/cgi-bin/koha/catalogue/search.pl</xsl:text></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:choose> >+ <!-- search for (1) controlnumber AND orgcode, or (2) only controlnumber, or (3) title --> >+ <xsl:when test="$controlnumber!='' and $orgcode!=''"> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber,' and Control-number-identifier:',$orgcode),false())"/> >+ </xsl:when> >+ <xsl:when test="$controlnumber!=''"> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber),false())"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=ti,phr:',translate(marc:subfield[@code=$title_subfield], '()', '')),false())"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ > </xsl:stylesheet> > > <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index e2aacf15d7..4ca526d0a3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -685,6 +685,54 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="GetCnumSearchURL"> >+ <xsl:param name="title_subfield" select="'t'"/> >+ <xsl:param name="cnum_subfield" select="'w'"/> >+ <xsl:param name="opac_url" select="1"/> >+ <xsl:param name="UseControlNumber"/> >+ >+ <xsl:variable name="orgcode"> >+ <xsl:choose> >+ <xsl:when test="$UseControlNumber!='1'"/> >+ <xsl:when test="substring-before(marc:subfield[@code=$cnum_subfield],')')"> >+ <!-- substring before closing parenthesis, remove parentheses and spaces --> >+ <xsl:value-of select="normalize-space(translate(substring-before(marc:subfield[@code=$cnum_subfield],')'),'()',''))"/> >+ </xsl:when> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="controlnumber"> >+ <xsl:choose> >+ <xsl:when test="$UseControlNumber!='1'"/> >+ <xsl:when test="substring-after(marc:subfield[@code=$cnum_subfield],')')"> >+ <!-- substring after closing parenthesis, remove spaces --> >+ <xsl:value-of select="normalize-space(substring-after(marc:subfield[@code=$cnum_subfield],')'))"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <!-- consider whole subfield now as controlnumber --> >+ <xsl:value-of select="normalize-space(marc:subfield[@code=$cnum_subfield])"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="scriptname"> >+ <xsl:choose> >+ <xsl:when test="$opac_url=1"><xsl:text>/cgi-bin/koha/opac-search.pl</xsl:text></xsl:when> >+ <xsl:otherwise><xsl:text>/cgi-bin/koha/catalogue/search.pl</xsl:text></xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:choose> >+ <!-- search for (1) controlnumber AND orgcode, or (2) only controlnumber, or (3) title --> >+ <xsl:when test="$controlnumber!='' and $orgcode!=''"> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber,' and Control-number-identifier:',$orgcode),false())"/> >+ </xsl:when> >+ <xsl:when test="$controlnumber!=''"> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=Control-number:',$controlnumber),false())"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="str:encode-uri(concat($scriptname,'?q=ti,phr:',translate(marc:subfield[@code=$title_subfield], '()', '')),false())"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ > </xsl:stylesheet> > > <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. >-- >2.40.0
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 29185
:
149588
|
149589
|
149590
|
149906
|
149907
|
149908
|
150357
| 150358 |
150359
|
150365
|
151009