Bugzilla – Attachment 18374 Details for
Bug 10325
Allow system preferences to be overridable from koha-httpd.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10325 - Allow system preferences to be overridable from koha-httpd.conf
Bug-10325---Allow-system-preferences-to-be-overrid.patch (text/plain), 2.71 KB, created by
Kyle M Hall (khall)
on 2013-05-24 11:09:57 UTC
(
hide
)
Description:
Bug 10325 - Allow system preferences to be overridable from koha-httpd.conf
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-05-24 11:09:57 UTC
Size:
2.71 KB
patch
obsolete
>From 8e92a7882955d02d5cc2640231c2872ad6dba6ed Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 24 May 2013 06:56:50 -0400 >Subject: [PATCH] Bug 10325 - Allow system preferences to be overridable from koha-httpd.conf > >For Koha installations with multiple OPAC URLs, It would be nice to be >able to override systeprefs from the http conf file. Case in point, >a library wants to have two separate opacs, one the is only viewable >from within the library that allows patrons to place holds, and a second >public one that does not. In this case, overriding the system preference >RequestOnOpac would accomplish this simply, and with no ill affects. > >This feature would of course be should only be used to override >cosmetic effects on the system, and should not be used for system >preferences such as CircControl, but would be great for preferences >such as OpacStarRatings, opacuserjs, OpacHighlightedWords and many >others! > >Test Plan: >1) Apply this patch >2) Disable the system pref OpacHighlightedWords >3) Do a seach in the OPAC, not the term is not highlighted >4) Edit your koha-http.conf file, add the line > SetEnv OVERRIDE_SYSPREF_OpacHighlightedWords "1" > to your koha-http.conf file's OPAC section. >5) Restart your web server, or just reload it's config >6) Do a seach, now your search term should be highlighted! >--- > C4/Context.pm | 27 +++++++++++++++++---------- > 1 files changed, 17 insertions(+), 10 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 7709f7e..7bc7097 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -540,7 +540,7 @@ my $use_syspref_cache = 1; > > sub preference { > my $self = shift; >- my $var = lc(shift); # The system preference to return >+ my $var = shift; # The system preference to return > > if ($use_syspref_cache && exists $sysprefs{$var}) { > return $sysprefs{$var}; >@@ -548,15 +548,22 @@ sub preference { > > my $dbh = C4::Context->dbh or return 0; > >- # Look up systempreferences.variable==$var >- my $sql = <<'END_SQL'; >- SELECT value >- FROM systempreferences >- WHERE variable=? >- LIMIT 1 >-END_SQL >- $sysprefs{$var} = $dbh->selectrow_array( $sql, {}, $var ); >- return $sysprefs{$var}; >+ my $value; >+ if ( defined $ENV{"OVERRIDE_SYSPREF_$var"} ) { >+ $value = $ENV{"OVERRIDE_SYSPREF_$var"}; >+ } else { >+ # Look up systempreferences.variable==$var >+ my $sql = q{ >+ SELECT value >+ FROM systempreferences >+ WHERE variable = ? >+ LIMIT 1 >+ }; >+ $value = $dbh->selectrow_array( $sql, {}, $var ); >+ } >+ >+ $sysprefs{$var} = $value; >+ return $value; > } > > sub boolean_preference { >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10325
:
18374
|
20228
|
20229
|
20230
|
20360
|
20361
|
20375
|
20376
|
20377