Bugzilla – Attachment 62905 Details for
Bug 18291
Remove SQL from preferences.pl administrative script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18291 - Implemented call to C4::Context->preference($name) in admin/preferences.pl which uses cached preference values
Bug-18291---Implemented-call-to-C4Context-preferen.patch (text/plain), 3.14 KB, created by
Alex Buckley
on 2017-05-01 09:50:24 UTC
(
hide
)
Description:
Bug 18291 - Implemented call to C4::Context->preference($name) in admin/preferences.pl which uses cached preference values
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-05-01 09:50:24 UTC
Size:
3.14 KB
patch
obsolete
>From 28004dffefc859ea5d29514bb2ef1d9437dce16a Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 1 May 2017 08:58:49 +0000 >Subject: [PATCH] Bug 18291 - Implemented call to > C4::Context->preference($name) in admin/preferences.pl which uses cached > preference values > >--- > Koha/Config/SysPref.pm | 13 ------------- > admin/preferences.pl | 6 +++--- > t/db_dependent/sysprefs.t | 13 +------------ > 3 files changed, 4 insertions(+), 28 deletions(-) > >diff --git a/Koha/Config/SysPref.pm b/Koha/Config/SysPref.pm >index 54011cd..1e71b8c 100644 >--- a/Koha/Config/SysPref.pm >+++ b/Koha/Config/SysPref.pm >@@ -67,19 +67,6 @@ sub delete { > return $deleted; > } > >-=head3 select_systempreferences >-my $row = Koha::Config::SysPref->select_systempreferences($name); >- >-This subroutine retrieves the value and type values for systempreference records with a specific variable value >-=cut >- >-sub select_systempreferences { >- my ($self, $name) = @_; >- my $dbh = C4::Context->dbh; >- my $row = $dbh->selectrow_hashref( "SELECT value, type FROM systempreferences WHERE variable = ?", {}, $name ); >- return $row; >-} >- > =head3 type > > =cut >diff --git a/admin/preferences.pl b/admin/preferences.pl >index b776b3f..c16b933 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -158,12 +158,12 @@ sub TransformPrefsToHTML { > my $name = $piece->{'pref'}; > > if ( $name ) { >- my $row = Koha::Config::SysPref->select_systempreferences($name); >+ my $row = C4::Context->preference($name); > my $value; >- if ( ( !defined( $row ) || ( !defined( $row->{'value'} ) && $row->{'type'} ne 'YesNo' ) ) && defined( $piece->{'default'} ) ) { >+ if ( ( !defined( $row ) || ( !defined( $piece->{'value'} ) && $piece->{'type'} ne 'YesNo' ) ) && defined( $piece->{'default'} ) ) { > $value = $piece->{'default'}; > } else { >- $value = $row->{'value'}; >+ $value = $piece->{'value'}; > } > my $chunk = _get_chunk( $value, %$piece ); > >diff --git a/t/db_dependent/sysprefs.t b/t/db_dependent/sysprefs.t >index 58aea5b..f90d461 100755 >--- a/t/db_dependent/sysprefs.t >+++ b/t/db_dependent/sysprefs.t >@@ -19,7 +19,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 9; >+use Test::More tests => 8; > use C4::Context; > use Koha::Database; > >@@ -61,15 +61,4 @@ is(C4::Context->preference('testpreference'), 'def', 'caching preferences'); > C4::Context->clear_syspref_cache(); > is(C4::Context->preference('testpreference'), undef, 'clearing preference cache'); > >-sub select_systempreferences { >- my ($name) = @_; >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->selectrow_hashref( "SELECT value, type FROM systempreferences WHERE variable = ?", {}, $name ); >- return $sth; >-} >- >-my $syspref = select_systempreferences('OPACHEADER'); >-is( $syspref->{'type'}, "Textarea", 'correct number of syspref found'); >- >- > $dbh->rollback; >-- >2.1.4
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 18291
:
61235
|
61236
|
62517
|
62518
|
62905
|
62906