Bugzilla – Attachment 9296 Details for
Bug 5079
Make display of shelving location and call number in XSLT results controlled by sysprefs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5079 - Make display of shelving location and call number in XSLT results controlled by sysprefs - Part 1
Bug-5079---Make-display-of-shelving-location-and-c.patch (text/plain), 11.69 KB, created by
Kyle M Hall
on 2012-04-25 14:06:31 UTC
(
hide
)
Description:
Bug 5079 - Make display of shelving location and call number in XSLT results controlled by sysprefs - Part 1
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-04-25 14:06:31 UTC
Size:
11.69 KB
patch
obsolete
>From a7dbc3e0d7b59c2470c33230b601a1b68e8f13bd Mon Sep 17 00:00:00 2001 >From: Elliott Davis <tdavis@uttyler.edu> >Date: Sun, 26 Jun 2011 10:52:09 -0500 >Subject: [PATCH] Bug 5079 - Make display of shelving location and call number in XSLT results controlled by sysprefs - Part 1 > >Added system preference to display shelving location of an item on opac results. >The system preference is called OpacItemLocation. I also moved the call number >to a new line called Location along with the shelving location if it is enabled. > >To Test: > 1) Run database update script to add syspref. > 2) Enable OpacItemLocation to show locations on the opac-search page. > > If it is working you should see the shelving location of the item > before the call number. Multiple home branch shelving locations > are seperated by a '|' character. >--- > C4/XSLT.pm | 21 ++++++-- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 8 +++ > .../prog/en/modules/admin/preferences/opac.pref | 6 ++ > .../prog/en/xslt/MARC21slim2OPACResults.xsl | 53 +++++++++++++------ > 5 files changed, 68 insertions(+), 21 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 56ba544..5d407ba 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -227,12 +227,17 @@ sub buildKohaItemsNamespace { > my ($biblionumber, $hidden_items) = @_; > > my @items = C4::Items::GetItemsInfo($biblionumber); >+ > if ($hidden_items && @$hidden_items) { > my %hi = map {$_ => 1} @$hidden_items; > @items = grep { !$hi{$_->{itemnumber}} } @items; > } >+ >+ my $shelflocations =GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac'); >+ > my $branches = GetBranches(); > my $itemtypes = GetItemTypes(); >+ my $location = ""; > my $xml = ''; > for my $item (@items) { > my $status; >@@ -270,12 +275,20 @@ sub buildKohaItemsNamespace { > } else { > $status = "available"; > } >+ > my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):''; >- my $itemcallnumber = xml_escape($item->{itemcallnumber}); >+ >+ if(C4::Context->preference("OpacItemLocation") && defined $item->{'location'}) { >+ $location = xml_escape($shelflocations->{$item->{location}}); >+ } >+ >+ my $itemcallnumber = xml_escape($item->{itemcallnumber}); >+ > $xml.= "<item><homebranch>$homebranch</homebranch>". >- "<status>$status</status>". >- "<itemcallnumber>".$itemcallnumber."</itemcallnumber>" >- . "</item>"; >+ "<location>$location</location>". >+ "<status>$status</status>". >+ "<itemcallnumber>".$itemcallnumber."</itemcallnumber>" >+ . "</item>"; > > } > $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 49debd2..efcf6b5 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -95,6 +95,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPublic',1,'Turn on/off public OPAC',NULL,'YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacuserjs','','Define custom javascript for inclusion in OPAC','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacuserlogin',1,'Enable or disable display of user login features',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacItemLocation',1,'Show the shelving location of items in the opac',NULL,'YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('patronimages',0,'Enable patron images for the Staff Client',NULL,'YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACpatronimages',0,'Enable patron images in the OPAC',NULL,'YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('printcirculationslips',1,'If ON, enable printing circulation receipts','','YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 84f0437..e79260d 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4358,6 +4358,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+<<<<<<< HEAD > $DBversion = "3.05.00.003"; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > $dbh->do(qq{ >@@ -5212,6 +5213,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.08.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacItemLocation',1,'Show the shelving location of items in the opac',NULL,'YesNo');"); >+ print "Upgrade to $DBversion done (Add OpacItemLocation syspref)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 eb74d81..4431460 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 >@@ -229,6 +229,12 @@ OPAC: > no: "Don't allow" > - patrons to log in to their accounts on the OPAC. > - >+ - pref: OpacItemLocation >+ choices: >+ yes: Show >+ no: "Don't Show" >+ - Show the shelving location of items in opac results. >+ - > - pref: OpacPasswordChange > choices: > yes: Allow >diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >index 68a6a1b..9eda750 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl >@@ -1011,17 +1011,16 @@ > </xsl:when> > <xsl:when test="count(key('item-by-status', 'available'))>0"> > <span class="available"> >- <b><xsl:text>Copies available for loan: </xsl:text></b> >- <xsl:variable name="available_items" >- select="key('item-by-status', 'available')"/> >- <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"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >- <xsl:text> (</xsl:text> >- <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >- <xsl:text>)</xsl:text> >-<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> >+ <b> >+ <xsl:value-of select="count(key('item-by-status', 'available'))"/> >+ <xsl:choose><xsl:when test="count(key('item-by-status', 'available')) = 1"><xsl:text> Copy available for loan at </xsl:text></xsl:when><xsl:otherwise><xsl:text> Copies available for loan at </xsl:text></xsl:otherwise></xsl:choose> >+ </b> >+ <xsl:variable name="available_items" >+ select="key('item-by-status', 'available')"/> >+ <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: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> > </span> > </xsl:when> > </xsl:choose> >@@ -1035,15 +1034,14 @@ > <xsl:choose> > <xsl:when test="count(key('item-by-status', 'reference'))>0"> > <span class="available"> >- <b><xsl:text>Copies available for reference: </xsl:text></b> >- <xsl:variable name="reference_items" >+ <b> >+ <xsl:value-of select="count(key('item-by-status', 'reference'))"/> >+ <xsl:choose><xsl:when test="count(key('item-by-status', 'reference')) = 1"><xsl:text> Copy available for reference at </xsl:text></xsl:when><xsl:otherwise><xsl:text> Copies available for reference at </xsl:text></xsl:otherwise></xsl:choose> >+ </b> >+ <xsl:variable name="reference_items" > select="key('item-by-status', 'reference')"/> > <xsl:for-each select="$reference_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"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >- <xsl:text> (</xsl:text> >- <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >- <xsl:text>)</xsl:text> > <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> > </span> >@@ -1094,6 +1092,27 @@ > <xsl:text>). </xsl:text> </span> > </xsl:if> > </span> >+ <span class="results_summary" id="location"> >+ <span class="label">Location(s): </span> >+ <xsl:variable name="available_items" >+ select="key('item-by-status', 'available')"/> >+ <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="concat(items:location,' ')"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:value-of select="items:itemcallnumber"/></xsl:if> >+ <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:choose><xsl:when test="count(key('item-by-status', 'available'))>0 and count(key('item-by-status', 'reference'))>0"><xsl:text> | </xsl:text></xsl:when></xsl:choose> >+ <xsl:variable name="reference_items" >+ select="key('item-by-status', 'reference')"/> >+ <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> >+ <xsl:value-of select="concat(items:location,' ')"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> <xsl:value-of select="items:itemcallnumber"/></xsl:if> >+ <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> >+ >+ </span> >+ >+ > </xsl:template> > > <xsl:template name="nameABCDQ"> >-- >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 5079
:
4523
|
4534
|
4543
|
4544
|
4545
|
4547
|
9296
|
9297
|
9298
|
9299
|
10912
|
10913
|
10929
|
12317
|
14355
|
14605