@@ -, +, @@
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(-)
--- a/C4/XSLT.pm
+++ a/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.= "- $homebranch".
- "$status".
- "".$itemcallnumber.""
- . "
";
+ "$location".
+ "$status".
+ "".$itemcallnumber.""
+ . "";
}
$xml = "".$xml."";
--- a/installer/data/mysql/sysprefs.sql
+++ a/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');
--- a/installer/data/mysql/updatedatabase.pl
+++ a/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)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ a/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
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
+++ a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
@@ -1011,17 +1011,16 @@
- Copies available for loan:
-
-
-
- []
- (
-
- )
-. ,
-
+
+
+ Copy available for loan at Copies available for loan at
+
+
+
+
+ . ,
+
@@ -1035,15 +1034,14 @@
- Copies available for reference:
-
+
+ Copy available for reference at Copies available for reference at
+
+
- []
- (
-
- )
. ,
@@ -1094,6 +1092,27 @@
).
+
+ Location(s):
+
+
+
+
+ . ,
+
+ |
+
+
+
+
+ . ,
+
+
+
+
+
--