Bug 5810: Subject tracings search complete subfields
This patch adds the syspref TraceCompleteSubfields. When TraceCompleteSubfields is set to "force," clicking on links in non-authority controlled subject tracings will only find other records where the entire subfields match. Leaving it at "don't force" keeps the current behavior of doing a keyword search of the subject indexes. This patch implements complete-subfield subject tracings in MARC21 XSLTs (OPAC and Staff) and all Normal mode interfaces. UNIMARC XSLTs have not been updated. This patch also adds the syspref UseAuthoritiesForTracings. When set to "Do not" tracings in the XSLT detail displays will never generate links using authority numbers, but rather use the heading strings (NB: the tracings currently use only subfield 'a' for generating links). Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com> Signed-off-by: Jane Wagner <jwagner@ptfs.com> Signed-off-by: Jared Camins-Esakov <jcamins@bywatersolutions.com> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
4b2ccab568
commit
4bc293c3aa
|
|
@ -1390,6 +1390,8 @@ sub GetMarcSubjects {
|
|||
my $subfield = "";
|
||||
my $marcsubject;
|
||||
|
||||
my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su';
|
||||
|
||||
foreach my $field ( $record->field('6..') ) {
|
||||
next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
|
||||
my @subfields_loop;
|
||||
|
|
@ -1416,7 +1418,7 @@ sub GetMarcSubjects {
|
|||
@link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
|
||||
}
|
||||
if ( not $found9 ) {
|
||||
push @link_loop, { 'limit' => 'su', link => $linkvalue, operator => $operator };
|
||||
push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
|
||||
}
|
||||
my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ sub XSLTParse4Display {
|
|||
my $sysxml = "<sysprefs>\n";
|
||||
foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
|
||||
DisplayOPACiconsXSLT URLLinkText viewISBD
|
||||
OPACBaseURL / )
|
||||
OPACBaseURL TraceCompleteSubfields
|
||||
UseAuthoritiesForTracings / )
|
||||
{
|
||||
my $sp = C4::Context->preference( $syspref );
|
||||
next unless defined($sp);
|
||||
|
|
|
|||
|
|
@ -288,4 +288,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
||||
|
|
|
|||
|
|
@ -289,3 +289,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
||||
|
|
|
|||
|
|
@ -290,4 +290,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -274,4 +274,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -286,4 +286,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesCcode','1','Use the item collection code when finding items for the shelf browser.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -342,3 +342,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -367,3 +367,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowFineOverride','0','If on, staff will be able to issue books to patrons with fines greater than noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllFinesNeedOverride','1','If on, staff will be asked to override every fine, even if it is below noissuescharge.','0','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AuthoritiesLog','0','If ON, log edit/create/delete actions on authorities.','','YesNo');
|
||||
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');
|
||||
|
|
|
|||
|
|
@ -4068,7 +4068,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 ('TraceCompleteSubfields','0','Force subject tracings to only match complete subfields.','0','YesNo')");
|
||||
$dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for subject tracings instead of heading strings.','0','YesNo')");
|
||||
print "Upgrade to $DBversion done (Add syspref to force whole-subfield matching on subject tracings)\n";
|
||||
SetVersion($DBversion);
|
||||
};
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
|
|
|
|||
|
|
@ -14,3 +14,10 @@ Authorities:
|
|||
yes: "Don't"
|
||||
no: Do
|
||||
- automatically update attached biblios when changing an authority record. If this is off, please ask your administrator to enable the merge_authorities.pl cronjob.
|
||||
-
|
||||
- pref: UseAuthoritiesForTracings
|
||||
default: yes
|
||||
choices:
|
||||
yes: Use
|
||||
no: "Don't use"
|
||||
- authority record numbers instead of text strings for searches from subject tracings.
|
||||
|
|
|
|||
|
|
@ -55,6 +55,13 @@ Searching:
|
|||
yes: Use
|
||||
no: "Don't use"
|
||||
- PazPar2 to group similar results on the OPAC. This requires that PazPar2 is set up and running.
|
||||
-
|
||||
- pref: TraceCompleteSubfields
|
||||
default: 0
|
||||
choices:
|
||||
yes: Force
|
||||
no: "Don't force"
|
||||
- subject tracings in the OPAC and Staff Client to search only for complete-subfield matches.
|
||||
Search Form:
|
||||
-
|
||||
- Show checkboxes to search by
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
<xsl:variable name="UseControlNumber" select="1"/>
|
||||
<xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>
|
||||
<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="leader" select="marc:leader"/>
|
||||
<xsl:variable name="leader6" select="substring($leader,7,1)"/>
|
||||
|
|
@ -121,8 +123,8 @@
|
|||
</xsl:if>
|
||||
|
||||
<!-- Author Statement -->
|
||||
<xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/></xsl:call-template>
|
||||
<xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/></xsl:call-template>
|
||||
<xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
|
||||
<xsl:call-template name="showAuthor"><xsl:with-param name="authorfield" select="marc:datafield[@tag=700 or @tag=710 or @tag=711]"/><xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/></xsl:call-template>
|
||||
|
||||
<xsl:if test="$materialTypeCode!=''">
|
||||
<span class="results_summary"><span class="label">Type: </span>
|
||||
|
|
@ -416,11 +418,11 @@
|
|||
<xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:subfield[@code=9]">
|
||||
<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:otherwise>
|
||||
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<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">
|
||||
|
|
@ -791,6 +793,7 @@
|
|||
|
||||
<xsl:template name="showAuthor">
|
||||
<xsl:param name="authorfield"/>
|
||||
<xsl:param name="UseAuthoritiesForTracings"/>
|
||||
<xsl:if test="count($authorfield)>0">
|
||||
<h5 class="author">
|
||||
<xsl:for-each select="$authorfield">
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
<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="ShowISBD" select="marc:sysprefs/marc:syspref[@name='viewISBD']"/>
|
||||
|
||||
<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="leader" select="marc:leader"/>
|
||||
<xsl:variable name="leader6" select="substring($leader,7,1)"/>
|
||||
<xsl:variable name="leader7" select="substring($leader,8,1)"/>
|
||||
|
|
@ -128,7 +131,7 @@
|
|||
<xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:subfield[@code=9]">
|
||||
<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:otherwise>
|
||||
|
|
@ -143,7 +146,7 @@
|
|||
<xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:subfield[@code=9]">
|
||||
<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:otherwise>
|
||||
|
|
@ -165,7 +168,7 @@
|
|||
</xsl:choose>
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:subfield[@code=9]">
|
||||
<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:otherwise>
|
||||
|
|
@ -479,11 +482,11 @@
|
|||
<xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']">
|
||||
<a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="marc:subfield[@code=9]">
|
||||
<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:otherwise>
|
||||
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su:<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">
|
||||
|
|
|
|||
Loading…
Reference in New Issue