From 693443eaa2e7eefcbe79faf1d2402bea9ae2b60c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 16 Mar 2012 12:56:58 -0400 Subject: [PATCH] Bug 7720 - Ambiguity in OPAC Details location - Followup - Add System Preference 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 --- installer/data/mysql/sysprefs.sql | 3 +- installer/data/mysql/updatedatabase.pl | 7 +++ .../prog/en/modules/admin/preferences/opac.pref | 8 +++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 52 ++++++++++++------- opac/opac-detail.pl | 2 + 5 files changed, 52 insertions(+), 20 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d16ff81..88759d7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -347,4 +347,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('LinkerKeepStale',0,'If ON the authority linker will keep existing authority links for headings where it is unable to find a match.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogModuleRelink',0,'If OFF the linker will never replace the authids that are set in the cataloging module.',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelay', '0', '', 'Enabling this allows holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay', 'YesNo'); -INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', 'free') +INSERT INTO systempreferences` (variable,value,options,explanation,type) VALUES ('ExpireReservesMaxPickUpDelayCharge', '0', NULL , 'If ExpireReservesMaxPickUpDelay is enabled, and this field has a non-zero value, than a borrower whose waiting hold has expired will be charged this amount.', '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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3ade8bf..ff50915 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4910,6 +4910,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 1acc414..a7c2d72 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 @@ -86,6 +86,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 44bdff5..de388b0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -580,8 +580,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( item_level_itypes ) %][% END %] - - [% UNLESS ( singleBranchMode ) %][% END %] + [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + [% UNLESS ( singleBranchMode ) %] + [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + [% END %] [% IF ( itemdata_ccode ) %][% END %] [% IF ( itemdata_enumchron ) %][% END %] @@ -593,29 +599,37 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] [% IF ( item_level_itypes ) %][% END %] - + [% END %] + + [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] + + [% END %] + [% ELSE %] + - - [% UNLESS ( singleBranchMode ) %] - [% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 27684d4..24372a7 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -944,4 +944,6 @@ if (C4::Context->preference('OPACLocalCoverImages') == 1) { $template->{VARS}->{localimages} = \@images; } +$template->param('OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay') ); + output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.2.5
Item typeCurrent LocationHome LibraryCurrent LocationHome LibraryCollectionCall NumberVol Info
[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %] - [% UNLESS ( singleBranchMode ) %] + [% UNLESS ( singleBranchMode ) %] + [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' ) %] + + [% IF ( ITEM_RESULT.branchurl ) %] + [% ITEM_RESULT.branchname %] + [% ELSE %] + [% ITEM_RESULT.branchname %] + [% END %] + + + [% IF ( ITEM_RESULT.homebranchurl ) %] + [% ITEM_RESULT.homebranchname %] + [% ELSE %] + [% ITEM_RESULT.homebranchname %] + [% END %] + + [% ITEM_RESULT.location_description %] + [% IF ( ITEM_RESULT.branchurl ) %] [% ITEM_RESULT.branchname %] [% ELSE %] [% ITEM_RESULT.branchname %] [% END %] - [% END %] - - [% IF ( singleBranchMode ) %] - [% ITEM_RESULT.location_description %] - [% END %] - - [% IF ( ITEM_RESULT.homebranchurl ) %] - [% ITEM_RESULT.homebranchname %] - [% ELSE %] - [% ITEM_RESULT.homebranchname %] - [% END %] - [% ITEM_RESULT.location_description %]