[Koha-patches] [PATCH] [SIGNED-OFF] Bug 4276: XSLT subject tracings only use subfield a
Chris Nighswonger
cnighswonger at foundations.edu
Tue Apr 5 01:59:01 CEST 2011
This patch does not apply cleanly to 3.2.x. If it should apply, please fixup
and resubmit with [3.2.x] in the subject line.
Kind Regards,
Chris
On Wed, Mar 16, 2011 at 2:57 PM, Nicole C. Engard <
nengard at bywatersolutions.com> wrote:
> From: Jared Camins-Esakov <jcamins at bywatersolutions.com>
>
> When XSLT is enabled, the subject tracings on the details view (both OPAC
> and
> Intranet) previously only searched on the subfield 'a'. In addition,
> searches
> failed when the tracing included parentheses, and the XSLT display did not
> include subfields other than abcdvxyz, even for those 6xx tags that have
> other
> subfields.
>
> This patch adds a syspref: TraceSubjectSubdivisons. When
> TraceSubjectSubdivisions is set to "Don't include" (default), the subject
> tracings in the XSLT details view will only search on subfield 'a'. When
> TraceSubjectSubdivisions is set to "Include", the subject tracings will
> search
> on all subfields, not just subfield 'a'.
>
> Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
> ---
> C4/XSLT.pm | 2 +-
> installer/data/mysql/de-DE/mandatory/sysprefs.sql | 2 +-
> installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
> .../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 +
> installer/data/mysql/it-IT/necessari/sysprefs.sql | 1 +
> installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 1 +
> ...m_preferences_full_optimal_for_install_only.sql | 1 +
> ...m_preferences_full_optimal_for_install_only.sql | 1 +
> installer/data/mysql/updatedatabase.pl | 7 +++++++
> .../en/modules/admin/preferences/searching.pref | 7 +++++++
> .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 14 ++++++++++++--
> .../intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 4 +++-
> .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 14 ++++++++++++--
> .../opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl | 4 +++-
> 14 files changed, 52 insertions(+), 8 deletions(-)
>
> diff --git a/C4/XSLT.pm b/C4/XSLT.pm
> index 2d1facc..f349376 100644
> --- a/C4/XSLT.pm
> +++ b/C4/XSLT.pm
> @@ -131,7 +131,7 @@ sub XSLTParse4Display {
> foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
> DisplayOPACiconsXSLT URLLinkText viewISBD
> OPACBaseURL TraceCompleteSubfields
> - UseAuthoritiesForTracings / )
> + UseAuthoritiesForTracings
> TraceSubjectSubdivisions / )
> {
> my $sp = C4::Context->preference( $syspref );
> next unless defined($sp);
> diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
> b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
> index a2018ed..9f6b2f7 100644
> --- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
> +++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
> @@ -291,4 +291,4 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> -
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
> diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql
> b/installer/data/mysql/en/mandatory/sysprefs.sql
> index 6d382c7..8020d11 100644
> --- a/installer/data/mysql/en/mandatory/sysprefs.sql
> +++ b/installer/data/mysql/en/mandatory/sysprefs.sql
> @@ -292,3 +292,4 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
> diff --git
> a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
> b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
> index cc1d954..6a9079c 100644
> ---
> a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
> +++
> b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
> @@ -293,4 +293,5 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
>
> diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql
> b/installer/data/mysql/it-IT/necessari/sysprefs.sql
> index 08abec5..c27a13d 100644
> --- a/installer/data/mysql/it-IT/necessari/sysprefs.sql
> +++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql
> @@ -278,4 +278,5 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
>
> diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
> b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
> index cfbca16..13ca437 100644
> --- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
> +++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
> @@ -290,4 +290,5 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
>
> diff --git
> a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
> b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
> index 5ffcd7b..a4a7707 100644
> ---
> a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
> +++
> b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
> @@ -345,3 +345,4 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
> diff --git
> a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
> b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
> index bceb62b..b3da1cf 100644
> ---
> a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
> +++
> b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
> @@ -370,3 +370,4 @@ INSERT INTO `systempreferences`
> (variable,value,explanation,options,type) VALUES
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match
> complete subfields.','0','YesNo');
> INSERT INTO `systempreferences` (variable,value,explanation,options,type)
> VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for
> subject tracings instead of heading strings.','0','YesNo');
> INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose
> the branch they want to pickup their hold from','1','YesNo');
> +INSERT INTO systempreferences (variable,value,explanation,options,type)
> VALUES ('TraceSubjectSubdivisions', '0', 'Create searches on all
> subdivisions for subject tracings.','1','YesNo');
> diff --git a/installer/data/mysql/updatedatabase.plb/installer/data/mysql/
> updatedatabase.pl
> index 66e9828..0b39a8d 100755
> --- a/installer/data/mysql/updatedatabase.pl
> +++ b/installer/data/mysql/updatedatabase.pl
> @@ -4090,6 +4090,13 @@ if (C4::Context->preference("Version") <
> TransformToNum($DBversion)) {
> SetVersion ($DBversion);
> }
>
> +$DBversion = 'XXX';
> +if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
> + $dbh->do("INSERT INTO systempreferences
> (variable,value,explanation,options,type) VALUES
> ('TraceSubjectSubdivisions', 1, 'Create searches on all subdivisions for
> subject tracings.','1','YesNo')");
> + print "Upgrade to $DBversion done ( include subdivisions when
> generating subject tracing searches )\n";
> + SetVersion ($DBversion);
> +}
> +
> =head1 FUNCTIONS
>
> =head2 DropAllForeignKeys($table)
> 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 5ff267f..e69b17e 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
> @@ -62,6 +62,13 @@ Searching:
> yes: Force
> no: "Don't force"
> - subject tracings in the OPAC and Staff Client to search only
> for complete-subfield matches.
> + -
> + - pref: TraceSubjectSubdivisions
> + default: 0
> + choices:
> + yes: Include
> + no: "Don't include"
> + - subdivisions for searches generated by clicking on subject
> tracings.
> Search Form:
> -
> - Show checkboxes to search by
> diff --git
> a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
> b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
> index 3072ce0..390b8b7 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
> +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
> @@ -21,6 +21,7 @@
> <xsl:variable name="OPACBaseURL"
> select="marc:sysprefs/marc:syspref[@name='OPACBaseURL']"/>
> <xsl:variable name="SubjectModifier"><xsl:if
> test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
> <xsl:variable name="UseAuthoritiesForTracings"
> select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
> + <xsl:variable name="TraceSubjectSubdivisions"
> select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
>
> <xsl:variable name="leader" select="marc:leader"/>
> <xsl:variable name="leader6" select="substring($leader,7,1)"/>
> @@ -421,14 +422,23 @@
> <xsl:when test="marc:subfield[@code=9] and
> $UseAuthoritiesForTracings='1'">
> <xsl:attribute name="href">/cgi-bin/koha/catalogue/
> search.pl?q=an:<xsl:value-of
> select="marc:subfield[@code=9]"/></xsl:attribute>
> </xsl:when>
> + <xsl:when test="$TraceSubjectSubdivisions='1'">
> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/
> search.pl?q=<xsl:call-template name="subfieldSelect">
> + <xsl:with-param
> name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
> + <xsl:with-param name="delimeter"> and
> </xsl:with-param>
> + <xsl:with-param name="prefix">(su<xsl:value-of
> select="$SubjectModifier"/>:"</xsl:with-param>
> + <xsl:with-param name="suffix">")</xsl:with-param>
> + </xsl:call-template>
> + </xsl:attribute>
> + </xsl:when>
> <xsl:otherwise>
> - <xsl:attribute name="href">/cgi-bin/koha/catalogue/
> search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of
> select="marc:subfield[@code='a']"/></xsl:attribute>
> + <xsl:attribute name="href">/cgi-bin/koha/catalogue/
> search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:"<xsl:value-of
> select="marc:subfield[@code='a']"/>"</xsl:attribute>
> </xsl:otherwise>
> </xsl:choose>
> <xsl:call-template name="chopPunctuation">
> <xsl:with-param name="chopString">
> <xsl:call-template name="subfieldSelect">
> - <xsl:with-param
> name="codes">abcdtvxyz</xsl:with-param>
> + <xsl:with-param
> name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
> <xsl:with-param
> name="subdivCodes">vxyz</xsl:with-param>
> <xsl:with-param name="subdivDelimiter">--
> </xsl:with-param>
> </xsl:call-template>
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> index 0cd4559..05a1d83 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> @@ -24,13 +24,15 @@
> <xsl:param name="delimeter"><xsl:text>
> </xsl:text></xsl:param>
> <xsl:param name="subdivCodes"/>
> <xsl:param name="subdivDelimiter"/>
> + <xsl:param name="prefix"/>
> + <xsl:param name="suffix"/>
> <xsl:variable name="str">
> <xsl:for-each select="marc:subfield">
> <xsl:if test="contains($codes, @code)">
> <xsl:if test="contains($subdivCodes, @code)">
> <xsl:value-of select="$subdivDelimiter"/>
> </xsl:if>
> - <xsl:value-of
> select="text()"/><xsl:value-of select="$delimeter"/>
> + <xsl:value-of
> select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of
> select="$suffix"/><xsl:value-of select="$delimeter"/>
> </xsl:if>
> </xsl:for-each>
> </xsl:variable>
> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
> b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
> index b5e60b9..095a642 100755
> --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
> +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl
> @@ -25,6 +25,7 @@
>
> <xsl:variable name="SubjectModifier"><xsl:if
> test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
> <xsl:variable name="UseAuthoritiesForTracings"
> select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
> + <xsl:variable name="TraceSubjectSubdivisions"
> select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
> <xsl:variable name="leader" select="marc:leader"/>
> <xsl:variable name="leader6" select="substring($leader,7,1)"/>
> <xsl:variable name="leader7" select="substring($leader,8,1)"/>
> @@ -478,14 +479,23 @@
> <xsl:when test="marc:subfield[@code=9] and
> $UseAuthoritiesForTracings='1'">
> <xsl:attribute name="href">/cgi-bin/koha/
> opac-search.pl?q=an:<xsl:value-of
> select="marc:subfield[@code=9]"/></xsl:attribute>
> </xsl:when>
> + <xsl:when test="$TraceSubjectSubdivisions='1'">
> + <xsl:attribute name="href">/cgi-bin/koha/
> opac-search.pl?q=<xsl:call-template name="subfieldSelect">
> + <xsl:with-param
> name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
> + <xsl:with-param name="delimeter"> and
> </xsl:with-param>
> + <xsl:with-param name="prefix">(su<xsl:value-of
> select="$SubjectModifier"/>:"</xsl:with-param>
> + <xsl:with-param name="suffix">")</xsl:with-param>
> + </xsl:call-template>
> + </xsl:attribute>
> + </xsl:when>
> <xsl:otherwise>
> - <xsl:attribute name="href">/cgi-bin/koha/
> opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of
> select="marc:subfield[@code='a']"/></xsl:attribute>
> + <xsl:attribute name="href">/cgi-bin/koha/
> opac-search.pl?q=su<xsl:value-of
> select="$SubjectModifier"/>:"<xsl:value-of
> select="marc:subfield[@code='a']"/>"</xsl:attribute>
> </xsl:otherwise>
> </xsl:choose>
> <xsl:call-template name="chopPunctuation">
> <xsl:with-param name="chopString">
> <xsl:call-template name="subfieldSelect">
> - <xsl:with-param
> name="codes">abcdtvxyz</xsl:with-param>
> + <xsl:with-param
> name="codes">abcdfgklmnopqrstvxyz</xsl:with-param>
> <xsl:with-param
> name="subdivCodes">vxyz</xsl:with-param>
> <xsl:with-param name="subdivDelimiter">--
> </xsl:with-param>
> </xsl:call-template>
> diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> index 559de13..4ffc031 100644
> --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slimUtils.xsl
> @@ -24,13 +24,15 @@
> <xsl:param name="delimeter"><xsl:text>
> </xsl:text></xsl:param>
> <xsl:param name="subdivCodes"/>
> <xsl:param name="subdivDelimiter"/>
> + <xsl:param name="prefix"/>
> + <xsl:param name="suffix"/>
> <xsl:variable name="str">
> <xsl:for-each select="marc:subfield">
> <xsl:if test="contains($codes, @code)">
> <xsl:if test="contains($subdivCodes, @code)">
> <xsl:value-of select="$subdivDelimiter"/>
> </xsl:if>
> - <xsl:value-of
> select="text()"/><xsl:value-of select="$delimeter"/>
> + <xsl:value-of
> select="$prefix"/><xsl:value-of select="text()"/><xsl:value-of
> select="$suffix"/><xsl:value-of select="$delimeter"/>
> </xsl:if>
> </xsl:for-each>
> </xsl:variable>
> --
> 1.7.2.3
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20110404/3173ad0b/attachment-0001.htm>
More information about the Koha-patches
mailing list