From 09ce37d349340f9af4b7bb565381718f5c182e18 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 11 Feb 2013 09:12:07 -0500 Subject: [PATCH] Bug 7720: add options for controlling display of an item's home and/or holdings 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 its 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 equivalent 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. Signed-off-by: Bernardo Gonzalez Kriegel Comment: Work as described. Tested all variations. No koha-qa errors. Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton --- C4/Items.pm | 11 +++- installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 8 +++ .../en/modules/admin/preferences/opac.pref | 16 +++++ .../opac-tmpl/prog/en/modules/opac-detail.tt | 62 ++++++++++++++----- opac/opac-detail.pl | 5 ++ 6 files changed, 89 insertions(+), 15 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index c183644b6c..a252ba1e64 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1270,7 +1270,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 @@ -1322,6 +1323,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 fd88466e3e..f730a766f0 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -246,6 +246,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('opaclanguagesdisplay','0','','If ON, enables display of Change Language feature on OPAC','YesNo'), ('opaclayoutstylesheet','opac.css','','Enter the name of the layout CSS stylesheet to use in the OPAC','free'), ('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'), +('OpacLocationBranchToDisplay','holding','holding|home|both','In the OPAC, under location show which branch for Location in the record details.','Choice'), +('OpacLocationBranchToDisplayShelving','holding','holding|home|both','In the OPAC, display the shelving location under which which column.', 'Choice'), ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMainUserBlock','Welcome to Koha...\r\n
','70|10','A user-defined block of HTML in the main content area of the opac main page','Textarea'), ('OpacMainUserBlockMobile','',NULL,'Show the following HTML in its own column on the main page of the OPAC (mobile version):','free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 4da5af9b03..14996b19a1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8536,6 +8536,14 @@ if (CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($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 (Bug 7720 - Ambiguity in OPAC Details location.)\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 0c2aa58364..839daa89e4 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 @@ -109,6 +109,22 @@ OPAC: yes: Show 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 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 57bbd013f6..2e3f1ad352 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1504,7 +1504,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% 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 %] @@ -1528,21 +1535,48 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] [% IF ( item_level_itypes ) %][% END %] - + [% END %] + + [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] [% ELSE %] - [% ITEM_RESULT.branchname %] + [% END %] -
[% ITEM_RESULT.branch_opac_info %]
- - [% END %] - [% ITEM_RESULT.location_description %] - [% IF ( itemdata_ccode ) %][% END %]
Item typeLocationCurrent LocationHome LibraryCollectionCall numberVol info
[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %] - - - [% UNLESS ( singleBranchMode ) %] -
- [% IF ( ITEM_RESULT.branchurl ) %] - [% ITEM_RESULT.branchname %] + [% UNLESS ( singleBranchMode ) %] + [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] +
+ + + + [% 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 %] + [% ITEM_RESULT.location_description %][% ITEM_RESULT.ccode %] [% IF ( ITEM_RESULT.itemcallnumber ) %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 01c801f371..0712707eef 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1100,4 +1100,9 @@ if ( C4::Context->preference('UseCourseReserves') ) { } } +$template->param( + 'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay') , + 'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'), +); + output_html_with_http_headers $query, $cookie, $template->output; -- 2.20.1