From f34e036da6fa468d54afb4d476df4c55d6855738 Mon Sep 17 00:00:00 2001 From: Ian Walls Date: Thu, 19 Jan 2012 14:52:37 -0500 Subject: [PATCH] Bug 5079 - Make display of shelving location and call number in XSLT results controlled by sysprefs * Don't show the Location line if there are no copies available, since it will inevitably be blank * Also, don't show locations for Checked Out, Lost, Damaged, Withdrawn, On Hold or In transit items; it doesn't really make sense, since the items aren't actually there, and it results in repetitive listing of the shelving location * 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 pipe character ( i.e. '|' ). --- C4/XSLT.pm | 19 +- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 + .../prog/en/modules/admin/preferences/opac.pref | 6 + .../prog/en/xslt/MARC21slim2OPACResults.xsl | 2073 ++++++++++---------- 5 files changed, 1085 insertions(+), 1021 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 56ba544..d448ddb 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; @@ -271,12 +276,16 @@ sub buildKohaItemsNamespace { $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.""; return $xml; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 49debd2..5035637 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',0,'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..e863a52 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5212,6 +5212,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..e50c880 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" + - 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..974e462 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -2,23 +2,24 @@ ]> - - - - - - - - - - - - - + xmlns:marc="http://www.loc.gov/MARC21/slim" + xmlns:items="http://www.koha-community.org/items" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + exclude-result-prefixes="marc items"> + + + + + + + + + + + + + + @@ -27,840 +28,840 @@ - - - - - - - - - - ST - - - BK - CR - - - BK - MX - CF - MP - VM - MU - PR - - - - - - - - - - - - - - - reformatted digital - - - digitized microfilm - - - digitized other analog - - - - - - - - - - - - - - - braille - - - print - - - electronic - - - microfiche - - - microfilm - - - - - chip cartridge - - - computer optical disc cartridge - - - magnetic disc - - - magneto-optical disc - - - optical disc - - - available online - remote - - - tape cartridge - - - tape cassette - - - tape reel - - - - celestial globe - - - earth moon globe - - - planetary or lunar globe - - - terrestrial globe - - - - kit - - - - atlas - - - diagram - - - map - - - model - - - profile - - - remote-sensing image - - - section - - - view - + + + + + + + + + + ST + + + BK + CR + + + BK + MX + CF + MP + VM + MU + PR + + + + + + + + + + + + + + + reformatted digital + + + digitized microfilm + + + digitized other analog + + + + + + + + + + + + + + + braille + + + print + + + electronic + + + microfiche + + + microfilm + + + + + chip cartridge + + + computer optical disc cartridge + + + magnetic disc + + + magneto-optical disc + + + optical disc + + + available online + remote + + + tape cartridge + + + tape cassette + + + tape reel + + + + celestial globe + + + earth moon globe + + + planetary or lunar globe + + + terrestrial globe + + + + kit + + + + atlas + + + diagram + + + map + + + model + + + profile + + + remote-sensing image + + + section + + + view + + + + aperture card + + + microfiche + + + microfiche cassette + + + microfilm cartridge + + + microfilm cassette + + + microfilm reel + + + microopaque + + + film cartridge + + + film cassette + + + film reel + + + chart + + + collage + + + drawing + + + flash card + + + painting + + + photomechanical print + + + photonegative + + + photoprint + + + picture + + + print + + + technical drawing + + + notated music + + + filmslip + + + filmstrip cartridge + + + filmstrip roll + + + other filmstrip type + + + slide + + + transparency + + + remote-sensing image + + + cylinder + + + roll + + + sound cartridge + + + sound cassette + + + sound disc + + + sound-tape reel + + + sound-track film + + + wire recording + + + braille + + + combination + + + moon + + + tactile, with no writing system + + + braille + + + large print + + + regular print + + + text in looseleaf binder + + + videocartridge + + + videocassette + + + videodisc + + + videoreel + + + - - aperture card - - - microfiche - - - microfiche cassette - - - microfilm cartridge - - - microfilm cassette - - - microfilm reel - - - microopaque - - - film cartridge - - - film cassette - - - film reel - - - chart - - - collage - - - drawing - - - flash card - - - painting - - - photomechanical print - - - photonegative - - - photoprint - - - picture - - - print - - - technical drawing - - - notated music - - - filmslip - - - filmstrip cartridge - - - filmstrip roll - - - other filmstrip type - - - slide - - - transparency - - - remote-sensing image - - - cylinder - - - roll - - - sound cartridge - - - sound cassette - - - sound disc - - - sound-tape reel - - - sound-track film - - - wire recording - - - braille - - - combination - - - moon - - - tactile, with no writing system - - - braille - - - large print - - - regular print - - - text in looseleaf binder - - - videocartridge - - - videocassette - - - videodisc - - - videoreel - - - - - - - - 245 - abhfgknps - - - + + + + 245 + abhfgknps + + + - /cgi-bin/koha/opac-detail.pl?biblionumber=title + /cgi-bin/koha/opac-detail.pl?biblionumber=title - - - - - a - - - - - b - - - - - - h - - - - - fgknps - - - - - - - - - - - - + + + + + a + + + + + b + + + + + + h + + + + + fgknps + + + + + + + + + + + +

- - - - 100,110,111,700,710,711 - abc - - + + + + 100,110,111,700,710,711 + abc + + - - + + - by - + by + - + . - - + + ; - + - + - + - + -- - + - + - - + + ; - + - + - + - + -- - + - - - + + + n - - - + + + - + . - - + + ; - + - - - - + + + +

- - Edition: - - - ab - - - + + Edition: + + + ab + + + - - - - Type: - - book Set - - - book Book - serial Continuing Resource - article Article - - - book Book - kit Kit - mixed materialsMixed Materials - computer file Computer File - map Map - visual material Visual Material - score Score - sound Sound - music Music - - - - ; Format: - + + + + Type: + + book Set + + + book Book + serial Continuing Resource + article Article + + + book Book + kit Kit + mixed materialsMixed Materials + computer file Computer File + map Map + visual material Visual Material + score Score + sound Sound + music Music + + + + ; Format: + - - - ; Type of continuing resource: - + + + ; Type of continuing resource: + - - database - - - loose-leaf - - - series - - - newspaper - - - periodical - - - web site - + + database + + + loose-leaf + + + series + + + newspaper + + + periodical + + + web site + - - - - ; Nature of contents: - + + + + ; Nature of contents: + - - abstract or summary - - - bibliography - bibliography - - - catalog - - - dictionary - - - encyclopedia - - - handbook - - - legal article - - - index - - - discography - - - legislation - - - theses - - - survey of literature - - - review - - - programmed text - - - filmography - - - directory - - - statistics - - - technical report - - - legal case and case notes - - - law report or digest - - - treaty - + + abstract or summary + + + bibliography + bibliography + + + catalog + + + dictionary + + + encyclopedia + + + handbook + + + legal article + + + index + + + discography + + + legislation + + + theses + + + survey of literature + + + review + + + programmed text + + + filmography + + + directory + + + statistics + + + technical report + + + legal case and case notes + + + law report or digest + + + treaty + - - conference publication - + + conference publication + - - + + - ; Type of computer file: + ; Type of computer file: - - numeric data - - - database - - - font - - - game - + + numeric data + + + database + + + font + + + game + - - + + - ; Nature of contents: + ; Nature of contents: - patent + patent - festschrift + festschrift - biography + biography - ; Literary form: + ; Literary form: - - not fiction - - - fiction - - - essay - - - drama - - - comic strip - - - fiction - - - humor, satire - - - letter - - - novel - - - short story - - - speech - + + not fiction + + + fiction + + + essay + + + drama + + + comic strip + + + fiction + + + humor, satire + + + letter + + + novel + + + short story + + + speech + - - + + ; Literary form: - biography + biography - conference publication + conference publication - drama + drama - essay + essay - fiction + fiction - folktale + folktale - history + history - humor, satire + humor, satire - memoir + memoir - poetry + poetry - rehearsal + rehearsal - reporting + reporting - sound + sound - speech + speech - - + + ; Type of visual material: - - art original - - - kit - - - art reproduction - - - diorama - - - filmstrip - - - legal article - - - picture - - - graphic - - - technical drawing - - - motion picture - - - chart - - - flash card - - - microscope slide - - - model - - - realia - - - slide - - - transparency - - - videorecording - - - toy - + + art original + + + kit + + + art reproduction + + + diorama + + + filmstrip + + + legal article + + + picture + + + graphic + + + technical drawing + + + motion picture + + + chart + + + flash card + + + microscope slide + + + model + + + realia + + + slide + + + transparency + + + videorecording + + + toy + - + - - ; Audience: - + + ; Audience: + - Preschool; + Preschool; - Primary; + Primary; - Pre-adolescent; + Pre-adolescent; - Adolescent; + Adolescent; - Adult; + Adult; - General; + General; - Juvenile; + Juvenile; - Specialized; + Specialized; - + + + + - - - @@ -887,6 +888,18 @@ + + + c + + + + + + g + + + @@ -901,24 +914,24 @@ - - 246 - ab - results_summary - Other Title: - + + 246 + ab + results_summary + Other Title: + - + - - Other title: - - - ab - - .; - - + + Other title: + + + ab + + .; + + @@ -932,278 +945,306 @@ - - Online Access: - - - - - - - 100 - - - - y3z - - - - - - - - - Click here to access online - - - - - - - - - - - 100 - - - - y3z - - - - - - - - - Click here to access online - - - - - - - - - | - - - - - - Availability: - - - - - - - - - - - - () - - No copies available - - - - - Copies available for loan: - - - - [] - ( - - ) -. , - - - - - - - -
-
-
- - - - - Copies available for reference: - - - - [] - ( - - ) - . , - - - - + + Online Access: + + + + + + + 100 + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + + + + 100 + + + + y3z + + + + + + + + + Click here to access online + + + + + + + + + | + + + + + + Availability: + + + + + + + + + + + + () + + No copies available + + + + + + + copy available for loan at + copies available for loan at + + + + + . , + + + + + + + + + + + copy available for reference at + copies available for reference at + + + + + . , + + + + + + + + Checked out ( + + ). + + + + + Withdrawn ( + + ). + + + + Lost ( + + ). + + + + Damaged ( + + ). + + + + On order ( + + ). + + + + In transit ( + + ). + + + + On hold ( + + ). + + - - - Checked out ( - - ). - - - - - Withdrawn ( - - ). - - - - Lost ( - - ). - - - - Damaged ( - - ). - - - - On order ( - - ). - - - - In transit ( - - ). - - - - On hold ( - - ). - -
-
+ + + + Location(s): + + + + + + + + . , + + + + + + + + + + + + . , + + + + + + + +
- - - - - aq - - - - :,;/ - - - - + + + + + aq + + + + :,;/ + + + + - - - - - - - - - - - - cdn - - - + + + + + + + + + + + + cdn + + + - - - acdeq - - + + + acdeq + + - - - - - - bc - - - - - + + + + + + bc + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + +
-- 1.7.2.5