From 797ebc65e800a333b5c3432429ff128454e7efaf Mon Sep 17 00:00:00 2001 From: Andrew Nugged Date: Fri, 26 Nov 2021 13:45:37 +0200 Subject: [PATCH] Bug 31000: Warn removal: param record_type can be undef Uninitialized value warning on /tools/export.pl when $record_type is undef Use of uninitialized value $record_type in string eq at /home/vagrant/kohaclone/tools/export.pl line 43. This warning in koha-testing-docker appears in: /var/log/koha/kohadev/intranet-error.log This patch fixes it by working when $record_type is Undef. The functionality still remains the same but warning doesn't flood error log. To reproduce: 1. Go to export data tool page (/tools/export.pl). 2. Check the error log and find the upper mentioned warning, check the timestamp to ensure that it was added when you loaded the page. 3. Apply the patch. 4. Load the page again, ensure that the same warning doesn't get added to the log file again. Signed-off-by: David Nind Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Tomas Cohen Arazi --- tools/export.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/export.pl b/tools/export.pl index 4fe6ce5cc5..b738afc60b 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -40,7 +40,7 @@ my $op = $query->param("op") || ''; my $output_format = $query->param("format") || $query->param("output_format") || 'iso2709'; my $backupdir = C4::Context->config('backupdir'); my $filename; -if ( $record_type eq 'auths' ) { +if ( $record_type && $record_type eq 'auths' ) { $filename = $query->param("filename_auth") || ( $output_format eq 'xml' ? 'koha.xml' : 'koha.mrc' ); } else { $filename = $query->param("filename") || ( $output_format eq 'csv' ? 'koha.csv' : 'koha.mrc' ); -- 2.39.5