Bug 15719: Silence warning in C4/Language.pm during web install
authorMark Tompsett <mtompset@hotmail.com>
Mon, 1 Feb 2016 23:12:44 +0000 (18:12 -0500)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 01:55:27 +0000 (01:55 +0000)
This problem was discovered the hard way:
- Drop DB
- Create DB
- Webinstaller run until the screen is:
We are ready to do some basic configuration.
Please install basic configuration settings to continue the installation.
-- The error log file will end with an error about splitting
   an uninitialized value.

TEST PLAN
---------
0) First patch already applied
1) prove -v t/Languages.t
   -- success, but warn prints
2) Apply this patch
3) prove -v t/Languages.t
   -- success without warning messages
4) run koha qa test tools

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described. QA test tools run OK

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com

C4/Languages.pm

index 384fd7a..95bc114 100644 (file)
@@ -578,7 +578,11 @@ sub getlanguage {
     my $preference_to_check =
       $interface eq 'intranet' ? 'language' : 'opaclanguages';
     # Get the available/valid languages list
-    my @languages = split /,/, C4::Context->preference($preference_to_check);
+    my @languages;
+    my $preference_value = C4::Context->preference($preference_to_check);
+    if ($preference_value) {
+        @languages = split /,/, $preference_value;
+    }
 
     # Chose language from the URL
     $language = $cgi->param( 'language' );