Bugzilla – Attachment 52889 Details for
Bug 16813
OPACBaseURL cannot be emptied
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16813: Allow empty string for OPACBaseURL
Bug-16813-Allow-empty-string-for-OPACBaseURL.patch (text/plain), 1.70 KB, created by
Jonathan Druart
on 2016-06-27 12:34:37 UTC
(
hide
)
Description:
Bug 16813: Allow empty string for OPACBaseURL
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-06-27 12:34:37 UTC
Size:
1.70 KB
patch
obsolete
>From 83cfe3ab1217dd849c990b4a6468db91a8fb1c24 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 27 Jun 2016 13:32:31 +0100 >Subject: [PATCH] Bug 16813: Allow empty string for OPACBaseURL > >The pref is prefixed by 'http://', but it should not when the pref is >set to an empty string. >This will fix the bug raised on bug 14790 comment 14. > >Test plan: >Empty OPACBaseURL and confirm that it's save as it in DB >--- > C4/Context.pm | 2 +- > t/db_dependent/Context.t | 4 ++++ > 2 files changed, 5 insertions(+), 1 deletion(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index c80647a..4a0f483 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -616,7 +616,7 @@ sub set_preference { > $value = 0 if ( $type && $type eq 'YesNo' && $value eq '' ); > > # force explicit protocol on OPACBaseURL >- if ( $variable eq 'opacbaseurl' && substr( $value, 0, 4 ) !~ /http/ ) { >+ if ( $variable eq 'opacbaseurl' && $value && substr( $value, 0, 4 ) !~ /http/ ) { > $value = 'http://' . $value; > } > >diff --git a/t/db_dependent/Context.t b/t/db_dependent/Context.t >index b5a050f..bce0cef 100755 >--- a/t/db_dependent/Context.t >+++ b/t/db_dependent/Context.t >@@ -39,6 +39,10 @@ C4::Context->clear_syspref_cache(); > $OPACBaseURL = C4::Context->preference('OPACBaseURL'); > is($OPACBaseURL,'http://junk2','OPACBaseURL saved with http:// as specified'); > >+C4::Context->set_preference('OPACBaseURL', ''); >+$OPACBaseURL = C4::Context->preference('OPACBaseURL'); >+is($OPACBaseURL,'','OPACBaseURL saved empty as specified'); >+ > C4::Context->set_preference('SillyPreference','random'); > C4::Context->clear_syspref_cache(); > my $SillyPeference = C4::Context->preference('SillyPreference'); >-- >2.8.1
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 16813
:
52889
|
53032
|
53288