From: Katrin Fischer Date: Mon, 9 Apr 2012 19:27:16 +0000 (+0200) Subject: Bug 7935: Introduce sys pref to control 'browse results' in OPAC X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=47fac215afbedab7bdad9172d1f002488cd35df1;p=koha.git Bug 7935: Introduce sys pref to control 'browse results' in OPAC Patch introduces a new system preference "OpacBrowseResults" to control the feature for browsing and paging through results shown on top of the left menu on detail pages in OPAC. Preference is activated by default and can be deactivated using the system preference. To test: - Check database update works correctly - Check that browsing and paging still works with after database update - Deactivate the feature by setting 'OpacBrowseResults' to 'Disable' - Check the feature does no longer show up in OPAC - Check that a new installation also has the system preference with correct default Signed-off-by: Chris Cormack --- diff --git a/C4/Auth.pm b/C4/Auth.pm index df97408c6b..ffee1bbcd8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -372,7 +372,7 @@ sub get_template_and_user { $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; # clean up the busc param in the session if the page is not opac-detail - if ($in->{'template_name'} =~ /opac-(.+)\.(?:tt|tmpl)$/ && $1 !~ /^(?:MARC|ISBD)?detail$/) { + if (C4::Context->preference("OpacBrowseResults") && $in->{'template_name'} =~ /opac-(.+)\.(?:tt|tmpl)$/ && $1 !~ /^(?:MARC|ISBD)?detail$/) { my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID")); $sessionSearch->clear(["busc"]) if ($sessionSearch->param("busc")); } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index b16b40fa54..7a3731c7d8 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -361,3 +361,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES 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,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 25e35433c1..4c18dacbf9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5089,7 +5089,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $DBversion = "3.07.00.041"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("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')"); - print "Upgrade to $DBversion done (Add System Preferences SubscriptionDuplicateDroppedInput)\n"; + print "Upgrade to $DBversion done (Add system preference SubscriptionDuplicateDroppedInput)\n"; SetVersion($DBversion); } @@ -5189,6 +5189,13 @@ q /INSERT INTO systempreferences (variable,value,explanation,options,type) VALUE SetVersion($DBversion); } +$DBversion = "3.07.00.049"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo')"); + print "Upgrade to $DBversion done (Add system preference OpacBrowseResults ))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS 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 1fd5234715..eb74d81118 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 @@ -323,6 +323,14 @@ OPAC: yes: Enable no: Disable - social network links in opac detail pages + - + - pref: OpacBrowseResults + default: 1 + choices: + yes: Enable + no: Disable + - browsing and paging search results from the OPAC detail page. + Policy: - - pref: singleBranchMode 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 4520c90fab..cc59fb2ef1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -14,7 +14,8 @@