Bug 17389: Clear logs
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 3 Oct 2016 14:23:39 +0000 (15:23 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Tue, 11 Oct 2016 16:18:10 +0000 (16:18 +0000)
Logs are full of:
Use of uninitialized value in substitution (s///) at
C4/ImportExportFramework.pm line 282.
Use of uninitialized value in concatenation (.) or string at
C4/ImportExportFramework.pm line 283.

Some field are NULL in DB, we need to init the value to an empty string
to avoid these warnings.

Note: This fix is not related to the original bug
Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Warnings avoided

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
C4/ImportExportFramework.pm

index 2d3bf07..bc02cca 100644 (file)
@@ -278,9 +278,10 @@ sub _export_table_csv
         $sth->execute($frameworkcode);
         my $data;
         while (my $hashRef = $sth->fetchrow_hashref) {
-            for (@fields) {
-                $hashRef->{$_} =~ s/[\r\n]//g;
-                $$strCSV .= '"' . $hashRef->{$_} . '",';
+            for my $field (@fields) {
+                my $value = $hashRef->{$field} // q||;
+                $value =~ s/[\r\n]//g;
+                $$strCSV .= '"' . $value . '",';
             }
             chop $$strCSV;
             $$strCSV .= chr(10);