Bugzilla – Attachment 18859 Details for
Bug 7441
Search results showing wrong branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7441 - search results showing wrong branch? - Followup - Use syspref for XSLT and non-XSLT
Bug-7441---search-results-showing-wrong-branch---F.patch (text/plain), 16.67 KB, created by
Kyle M Hall (khall)
on 2013-06-11 19:15:01 UTC
(
hide
)
Description:
Bug 7441 - search results showing wrong branch? - Followup - Use syspref for XSLT and non-XSLT
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-06-11 19:15:01 UTC
Size:
16.67 KB
patch
obsolete
>From 298ba9b182469f197bb4a48c831cb46a51a93276 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 2 Jan 2013 10:06:11 -0500 >Subject: [PATCH] Bug 7441 - search results showing wrong branch? - Followup - Use syspref for XSLT and non-XSLT > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Comment: Applied all patches. Tested with and without XLST display. >Works as described. No errors. >Not tested with UNIMARC >--- > C4/Search.pm | 16 ++++++++-------- > C4/XSLT.pm | 2 +- > Koha/Template/Plugin/Koha.pm | 1 + > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 4 ++-- > .../prog/en/modules/admin/preferences/opac.pref | 3 +-- > .../opac-tmpl/prog/en/modules/opac-results.tt | 9 +++++++-- > .../prog/en/xslt/MARC21slim2OPACResults.xsl | 10 +++++----- > .../prog/en/xslt/UNIMARCslim2OPACResults.xsl | 10 +++++----- > 9 files changed, 31 insertions(+), 26 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index aec024b..39fd74e 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1865,8 +1865,8 @@ sub searchResults { > $item->{'branchname'} = $branches{$item->{$otherbranch}}; > } > >- my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber}; >-# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item >+ my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber}; >+ # For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item > my $userenv = C4::Context->userenv; > if ( $item->{onloan} && !(C4::Members::GetHideLostItemsPreference($userenv->{'number'}) && $item->{itemlost}) ) { > $onloan_count++; >@@ -1975,12 +1975,12 @@ sub searchResults { > else { > $can_place_holds = 1; > $available_count++; >- $available_items->{$prefix}->{count}++ if $item->{$hbranch}; >- foreach (qw(branchname itemcallnumber description)) { >- $available_items->{$prefix}->{$_} = $item->{$_}; >- } >- $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; >- $available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); >+ $available_items->{$prefix}->{count}++ if $item->{$hbranch}; >+ foreach (qw(branchname itemcallnumber description homebranch holdingbranch)) { >+ $available_items->{$prefix}->{$_} = $item->{$_}; >+ } >+ $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; >+ $available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); > } > } > } # notforloan, item level and biblioitem level >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 54aff60..74f3183 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -207,7 +207,7 @@ sub XSLTParse4Display { > UseControlNumber IntranetBiblioDefaultView BiblioDefaultView > singleBranchMode OPACItemLocation DisplayIconsXSLT > AlternateHoldingsField AlternateHoldingsSeparator >- TrackClicks OPACResultsBranchXSLT / ) >+ TrackClicks OPACResultsBranch / ) > { > my $sp = C4::Context->preference( $syspref ); > next unless defined($sp); >diff --git a/Koha/Template/Plugin/Koha.pm b/Koha/Template/Plugin/Koha.pm >index 2eff9f1..4962552 100644 >--- a/Koha/Template/Plugin/Koha.pm >+++ b/Koha/Template/Plugin/Koha.pm >@@ -21,6 +21,7 @@ use Modern::Perl; > > use base qw( Template::Plugin ); > >+use C4::Koha; > use C4::Context; > > =pod >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 9ec8a49..8c86844 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -427,4 +427,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo'); > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); >-INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'); >+INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranch', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results.', 'Choice'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 318ca33..01554a8 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6993,8 +6993,8 @@ if ( CheckVersion($DBversion) ) { > > $DBversion = "3.13.00.XXX"; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >- $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice')"); >- print "Upgrade to $DBversion done (Add syspref OPACResultsBranchXSLT)\n"; >+ $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranch', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice')"); >+ print "Upgrade to $DBversion done (Add syspref OPACResultsBranch)\n"; > SetVersion($DBversion); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index e377fd6..9406ecc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -84,11 +84,10 @@ OPAC: > - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC. > - > - On search result pages displayed with XSLT stylesheets on the OPAC, show the item's >- - pref: OPACResultsBranchXSLT >+ - pref: OPACResultsBranch > choices: > holdingbranch: "holding branch" > homebranch: "home branch" >- - icons for itemtype and authorized values. > - > - pref: COinSinOPACResults > choices: >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >index 923effa..64ff3fa 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >@@ -1,3 +1,5 @@ >+[% USE Koha %] >+[% USE KohaBranchName %] > [% SET TagsShowEnabled = ( TagsEnabled && TagsShowOnList ) %] > [% SET TagsInputEnabled = ( opacuserlogin && TagsEnabled && TagsInputOnList ) %] > >@@ -538,9 +540,12 @@ $(document).ready(function(){ > [% IF ( singleBranchMode ) %] > [% available_items_loo.location %] > [% ELSE %] >- [% available_items_loo.branchname %] >+ [% IF Koha.Preference('OPACResultsBranch') == 'homebranch' %] >+ [% available_items_loo.homebranch | $KohaBranchName %] >+ [% ELSE %] >+ [% available_items_loo.holdingbranch | $KohaBranchName %] >+ [% END %] > [% END %] >- > [% IF ( OPACItemsResultsDisplay ) %] > [% UNLESS ( singleBranchMode ) %][% available_items_loo.location %][% END %] > [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >index 08a5139..1e9bbf4 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >@@ -20,7 +20,7 @@ > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> > <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/> > >- <xsl:variable name="OPACResultsBranchXSLT" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranchXSLT']"/> >+ <xsl:variable name="OPACResultsBranch" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranch']"/> > <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/> > <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/> > <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/> >@@ -1064,7 +1064,7 @@ > </xsl:when> > <xsl:otherwise> > <xsl:choose> >- <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:when test="$OPACResultsBranch='homebranch'"> > <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> > <xsl:value-of select="items:homebranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -1074,7 +1074,7 @@ > <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> > </xsl:when> >- <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:when test="$OPACResultsBranch='holdingbranch'"> > <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> > <xsl:value-of select="items:holdingbranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -1099,7 +1099,7 @@ > <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> > > <xsl:choose> >- <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:when test="$OPACResultsBranch='homebranch'"> > <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> > <xsl:value-of select="items:homebranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -1109,7 +1109,7 @@ > <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> > </xsl:when> >- <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:when test="$OPACResultsBranch='holdingbranch'"> > <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> > <xsl:value-of select="items:holdingbranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl >index 77315e1..89240fe 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl >@@ -28,7 +28,7 @@ > <xsl:variable name="isbn" > select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/> > >- <xsl:variable name="OPACResultsBranchXSLT" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranchXSLT']"/> >+ <xsl:variable name="OPACResultsBranch" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranch']"/> > <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/> > <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/> > >@@ -147,7 +147,7 @@ > </xsl:when> > <xsl:otherwise> > <xsl:choose> >- <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:when test="$OPACResultsBranch='homebranch'"> > <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> > <xsl:value-of select="items:homebranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -157,7 +157,7 @@ > <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> > </xsl:when> >- <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:when test="$OPACResultsBranch='holdingbranch'"> > <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> > <xsl:value-of select="items:holdingbranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -180,7 +180,7 @@ > <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> > > <xsl:choose> >- <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:when test="$OPACResultsBranch='homebranch'"> > <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> > <xsl:value-of select="items:homebranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >@@ -190,7 +190,7 @@ > <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> > </xsl:when> >- <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:when test="$OPACResultsBranch='holdingbranch'"> > <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> > <xsl:value-of select="items:holdingbranch"/> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >-- >1.7.2.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 7441
:
8656
|
8657
|
9700
|
9701
|
12550
|
12551
|
12552
|
12553
|
13856
|
13888
|
14229
|
14361
|
14362
|
14977
|
14978
|
14979
|
17901
|
17902
|
17903
|
17968
|
18151
|
18152
|
18153
|
18154
|
18857
|
18858
|
18859
|
18942
|
19089
|
19090
|
19091
|
19470
|
19471
|
19472
|
19473
|
19474
|
19475
|
51963
|
52746
|
52747
|
52810
|
52811
|
54058
|
54101
|
54102
|
54250