From eb25e07495dbe40a18e18314631654b256c306c7 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 the system preference OpacLocationBranchToDisplay which allows a library to control whether to display the holding library, the home library, or both for the opac details page. http://bugs.koha-community.org/show_bug.cgi?id=7220 --- C4/Items.pm | 9 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 + .../prog/en/modules/admin/preferences/opac.pref | 8 + koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 220 ++++++++++++-------- opac/opac-detail.pl | 2 + 6 files changed, 155 insertions(+), 92 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 0b2f99b..c228c6b 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1192,6 +1192,7 @@ sub GetItemsInfo { holding.branchurl, holding.branchname, 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 @@ -1243,6 +1244,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 34ac684..1a8e7b8 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -360,3 +360,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); +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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c297677..d257faa 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5139,6 +5139,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.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')"); + print "Upgrade to $DBversion done (Added system preference OpacLocationBranchToDisplay)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($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 a871399..1f9b7b0 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 @@ -84,6 +84,14 @@ 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. + - - 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 a5be324..2c5a4a4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -41,19 +41,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 %] [% IF ( busc ) %] if (arrPagination.length > 0) { @@ -203,19 +203,19 @@ 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); }); - + //]]> [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]