From 11ce471798722494b23522eebb7b188b5423fee6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 15 Mar 2012 10:27:12 -0400 Subject: [PATCH] Bug 7720 - Ambiguity in OPAC Details location. Currently, in opac-detail.pl, there exists a column named 'Location'. This column lists the name of the holding branch, and the item's location description. This can cause confusion to borrowers, as they may assume that the holding branch is the *owning* branch (homebranch) of an item. This could cause a situation where a borrower waits for an item to be returned to his or her library, only to find that the library never owned that item, and it was transferred back to it's homebranch. It could also lead a borrower to falsely assume that his or her home library does not own a copy of a particular item because the borrower does not see an his or her home library listed for any of the items on the record. In addition, even when the holding branch is different than the home branch, the item's shelving location is displayed, even though that branch may not use that location. This commit makes the item details table equivilent to the intranet details page by adding a "Home Library" column, which displays the item's home library, as well as the shelving location. If singleBranchMode is enabled, this column disappears and the "Location" column displays the shelving location only. This commit adds two new system preferences: OpacLocationBranchToDisplay, which defines whether to display the holding library, the home library, or both for the opac details page. OpacLocationBranchToDisplayShelving, which defines where the shelving location should be displayed, under the home library, the holding library, or both. http://bugs.koha-community.org/show_bug.cgi?id=7220 http://bugs.koha-community.org/show_bug.cgi?id=3556 --- C4/Items.pm | 11 +- installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 9 + .../prog/en/modules/admin/preferences/opac.pref | 16 ++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 224 +++++++++++--------- opac/opac-detail.pl | 5 + 6 files changed, 164 insertions(+), 103 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 9c5c89e..41827ed 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1192,7 +1192,8 @@ sub GetItemsInfo { itemtypes.notforloan as notforloan_per_itemtype, holding.branchurl, holding.branchname, - holding.opac_info as branch_opac_info + holding.opac_info as branch_opac_info, + home.branchurl AS homebranchurl FROM items LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode LEFT JOIN branches AS home ON items.homebranch=home.branchcode @@ -1244,6 +1245,14 @@ sub GetItemsInfo { if ( my $bdata = $bsth->fetchrow_hashref ) { $data->{'branchname'} = $bdata->{'branchname'}; } + $bsth = $dbh->prepare( + "SELECT * FROM branches WHERE branchcode = ? + " + ); + $bsth->execute( $data->{'homebranch'} ); + if ( my $bdata = $bsth->fetchrow_hashref ) { + $data->{'homebranchname'} = $bdata->{'branchname'}; + } $data->{'datedue'} = $datedue; # get notforloan complete status if applicable diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index c4060fe..cfbd48e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -369,3 +369,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsIntranet', '1', NULL , 'Allow holds to be suspended from the intranet.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SuspendHoldsOpac', '1', NULL , 'Allow holds to be suspended from the OPAC.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('DefaultLanguageField008','','Fill in the default language for field 008 Range 35-37 (e.g. eng, nor, ger, see MARC Code List for Languages)','','Free'); +INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplay', 'holding', 'holding|home|both', 'In the OPAC, under location show which branch for Location in the record details.', 'Choice'); +INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplayShelving', 'holding', 'holding|home|both', 'In the OPAC, display the shelving location under which which column.', 'Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 62b4372..7b1c6e6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5247,6 +5247,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +<<<<<<< HEAD $DBversion = "3.09.00.005"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { unless (TableExists('quotes')) { @@ -5343,6 +5344,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplay', 'holding', 'holding|home|both', 'In the OPAC, under location show which branch for Location in the record details.', 'Choice')"); + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplayShelving', 'holding', 'holding|home|both', 'In the OPAC, display the shelving location under which which column', 'Choice')"); + print "Upgrade to $DBversion done (Added system preference OpacLocationBranchToDisplay)\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 e4ea15b..38de4ff 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 @@ -94,6 +94,22 @@ OPAC: no: "Don't show" - the name of the patron that has an item checked out on item detail pages on the OPAC. - + - Display the + - pref: OpacLocationBranchToDisplay + choices: + home: "home library" + holding: "holding library" + both: "home and holding libraries" + - for items on the OPAC record details page. + - + - Display the shelving location under the + - pref: OpacLocationBranchToDisplayShelving + choices: + home: "home library" + holding: "holding library" + both: "home and holding libraries" + - for items on the OPAC record details page. + - - pref: OpacKohaUrl default: 0 choices: diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 776f82f..db1759b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -45,19 +45,19 @@ widgets : ['zebra'], sortList: [[0,0]] }); - [% IF ( GoogleJackets ) %] + [% IF ( GoogleJackets ) %] KOHA.Google.GetCoverFromIsbn([% covernewwindow %]); - [% END %] - [% IF OpenLibraryCovers %] - KOHA.OpenLibrary.GetCoverFromIsbn(); - [% END %] - [% IF OPACLocalCoverImages %] - KOHA.LocalCover.GetCoverFromBibnumber(true); - [% END %] + [% END %] + [% IF OpenLibraryCovers %] + KOHA.OpenLibrary.GetCoverFromIsbn(); + [% END %] + [% IF OPACLocalCoverImages %] + KOHA.LocalCover.GetCoverFromBibnumber(true); + [% END %] [% IF ( NovelistSelectProfile ) %] novSelect.loadContentForISBN('[% normalized_isbn %]','[% NovelistSelectProfile %]', '[% NovelistSelectPassword %]', function(d){}); [% END %] - [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] + [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] $(".tagbutton").click(KOHA.Tags.add_tag_button);[% END %][% END %][% END %] @@ -255,17 +255,17 @@ function renderPagination(index, total, ul, highlIndex) YAHOO.util.Event.onContentReady("furtherm", function () { $("#furtherm").css("display","block").css("visibility","hidden"); - $("#furthersearches").parent().show(); - var furthersearchesMenu = new YAHOO.widget.Menu("furtherm"); - furthersearchesMenu.render(); - furthersearchesMenu.cfg.setProperty("context", ["furthersearches", "tr", "br"]); - furthersearchesMenu.subscribe("beforeShow",positionfurthersearchesMenu); - furthersearchesMenu.subscribe("show", furthersearchesMenu.focus); + $("#furthersearches").parent().show(); + var furthersearchesMenu = new YAHOO.widget.Menu("furtherm"); + furthersearchesMenu.render(); + furthersearchesMenu.cfg.setProperty("context", ["furthersearches", "tr", "br"]); + furthersearchesMenu.subscribe("beforeShow",positionfurthersearchesMenu); + furthersearchesMenu.subscribe("show", furthersearchesMenu.focus); function positionfurthersearchesMenu() { furthersearchesMenu.align("tr", "br"); - } - YAHOO.util.Event.addListener("furthersearches", "click", furthersearchesMenu.show, null, furthersearchesMenu); - YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionfurthersearchesMenu); + } + YAHOO.util.Event.addListener("furthersearches", "click", furthersearchesMenu.show, null, furthersearchesMenu); + YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionfurthersearchesMenu); }); //]]> @@ -444,25 +444,25 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( LibraryThingForLibrariesID ) %] - [% UNLESS ( LibraryThingForLibrariesTabbedView ) %] -
-
-
- [% END %] - - Reviews from LibraryThing.com: + [% UNLESS ( LibraryThingForLibrariesTabbedView ) %] +
+
+
+ [% END %] + + Reviews from LibraryThing.com: [% END %] [% IF ( GetShelves ) %] - List(s) this item appears in: - [% FOREACH GetShelve IN GetShelves %] - [% GetShelve.shelfname %] - [% IF ( loop.last ) %][% ELSE %]|[% END %] - [% END %] - + List(s) this item appears in: + [% FOREACH GetShelve IN GetShelves %] + [% GetShelve.shelfname %] + [% IF ( loop.last ) %][% ELSE %]|[% END %] + [% END %] + [% END %] [% IF ( TagsEnabled ) %] @@ -683,20 +683,20 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( serialcollection ) %]
- - - - - - - - [% FOREACH serialcollection IN serialcollections %] - - - - - [% END %] - + + + + + + + + [% FOREACH serialcollection IN serialcollections %] + + + + + [% END %] +
LibrarySerial collection
[% serialcollection.branch %][% serialcollection.text %]
LibrarySerial collection
[% serialcollection.branch %][% serialcollection.text %]
[% END %] @@ -704,12 +704,19 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( count ) %] [% IF ( lotsofitems ) %] -

This record has many physical items. Click here to view them all.

+

This record has many physical items. Click here to view them all.

[% ELSE %] [% IF ( item_level_itypes ) %][% END %] - + [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' || singleBranchMode ) %] + + [% END %] + [% UNLESS ( singleBranchMode ) %] + [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + [% END %] [% IF ( itemdata_ccode ) %][% END %] [% IF ( itemdata_enumchron ) %][% END %] @@ -724,44 +731,57 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] - [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] - [% IF ( item_level_itypes ) %][% END %] - - [% IF ( itemdata_ccode ) %][% END %] - - [% IF ( itemdata_enumchron ) %][% END %] - [% IF ( itemdata_uri ) %][% END %] - [% IF ( itemdata_copynumber ) %][% END %] - - [% IF ( itemdata_itemnotes ) %][% END %] - - [% IF holds_count.defined || show_priority %] - [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] + [% IF ( item_level_itypes ) %][% END %] + [% UNLESS ( singleBranchMode ) %] + [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + + [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + [% ELSE %] + [% ITEM_RESULT.location_description %] [% END %] - [% END %] - - [% END %] - - [% END %] -
Item typeLocationCurrent LocationHome LibraryCollectionCall numberVol infoItem hold queue priority
[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %] - [% UNLESS ( singleBranchMode ) %] - - [% IF ( ITEM_RESULT.branchurl ) %] - [% ITEM_RESULT.branchname %] - [% ELSE %] - [% ITEM_RESULT.branchname %] - [% END %] - -
[% ITEM_RESULT.branch_opac_info %]
- [% END %] - [% ITEM_RESULT.location_description %] -
[% ITEM_RESULT.ccode %][% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse shelf)[% END %][% END %][% ITEM_RESULT.enumchron %][% ITEM_RESULT.uri %][% ITEM_RESULT.copynumber %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %][% ITEM_RESULT.itemnotes %][% ITEM_RESULT.datedue | $KohaDates %] - [% IF holds_count.defined %] [% ITEM_RESULT.holds_count %] [% END %] - [% IF ITEM_RESULT.priority %] - [% IF holds_count.defined %] - (priority [% ITEM_RESULT.priority %]) - [% ELSE %] - [% ITEM_RESULT.priority %] +
[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %] + + [% IF ( ITEM_RESULT.branchurl ) %] + [% ITEM_RESULT.branchname %] + [% ELSE %] + [% ITEM_RESULT.branchname %] + [% END %] + + + [% IF ( OpacLocationBranchToDisplayShelving == 'holding' || OpacLocationBranchToDisplayShelving == 'both' ) %] + [% ITEM_RESULT.location_description %] + [% END %] + +
[% ITEM_RESULT.branch_opac_info %]
+
+ + [% IF ( ITEM_RESULT.homebranchurl ) %] + [% ITEM_RESULT.homebranchname %] + [% ELSE %] + [% ITEM_RESULT.homebranchname %] + [% END %] + + + [% IF ( OpacLocationBranchToDisplayShelving == 'home' || OpacLocationBranchToDisplayShelving == 'both' ) %] + [% ITEM_RESULT.location_description %] + [% END %] +
+ + [% IF ( itemdata_ccode ) %][% ITEM_RESULT.ccode %][% END %] + [% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (Browse Shelf)[% END %][% END %] + [% IF ( itemdata_enumchron ) %][% ITEM_RESULT.enumchron %][% END %] + [% IF ( itemdata_uri ) %][% ITEM_RESULT.uri %][% END %] + [% IF ( itemdata_copynumber ) %][% ITEM_RESULT.copynumber %][% END %] + [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] + [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] + [% ITEM_RESULT.datedue | $KohaDates %] + + [% END %] + [% END %] [% IF holds_count.defined || priority %]
@@ -815,7 +835,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( OPACAmazonEnabled ) %][% IF ( OPACAmazonCoverImages ) %][% IF ( NEXT_SHELF_BROWS.browser_normalized_isbn ) %] [% ELSE %]No cover image available[% END %][% END %][% END %] - [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %] + [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( content_identifier_exists ) %] [% IF ( using_https ) %] [% ELSE %][% END %] @@ -916,13 +936,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% FOREACH SYNDETICS_REVIEW IN SYNDETICS_REVIEWS %] [% IF ( SYNDETICS_REVIEW.title ) %]

[% SYNDETICS_REVIEW.title %]

- [% FOREACH review IN SYNDETICS_REVIEW.reviews %] + [% FOREACH review IN SYNDETICS_REVIEW.reviews %] - [% IF ( review.content ) %] - [% review.content %] - [% END %] + [% IF ( review.content ) %] + [% review.content %] + [% END %] - [% END %] + [% END %] [% END %] [% END %]
@@ -1003,25 +1023,25 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( LibraryThingForLibrariesID ) %] [% IF ( LibraryThingForLibrariesTabbedView ) %] - -
-
- + +
+
+ - - -
- -
-
-
+ + +
+ +
+
+
- [% END %] + [% END %] [% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index eaad3e2..f12be1f 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -996,4 +996,9 @@ if (C4::Context->preference('OPACLocalCoverImages') == 1) { $template->{VARS}->{localimages} = \@images; } +$template->param( + 'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay') , + 'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'), +); + output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.2.5