From 42723f2e1245d37eff125f9d3c966233a57e0359 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Tue, 4 Nov 2014 12:42:27 -0500
Subject: [PATCH] Bug 13197 - Export.pl errors out on command line if --id_list_file is not provided

If one attempts to run export.pl from the command line without the
--id_list_file switch, it errors out with the following message:

cannot open 0: No such file or directory at
/usr/share/koha/intranet/cgi-bin/tools/export.pl line 209.

Test Plan:
1) Run tools/export.pl from the command line without the --id_list_file option
2) Note the error
3) Apply this patch
4) Repeat step 1
5) Note the error does not occur
---
 tools/export.pl |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/export.pl b/tools/export.pl
index 658aef7..c6414b5 100755
--- a/tools/export.pl
+++ b/tools/export.pl
@@ -206,8 +206,11 @@ if ( $op eq "export" ) {
         my $authtype        = $query->param('authtype');
         my $filefh;
         if ($commandline) {
-            open $filefh,"<", $id_list_file or die "cannot open $id_list_file: $!" if $id_list_file;
-        } else {
+            if ($id_list_file) {
+                open $filefh, "<", $id_list_file or die "cannot open $id_list_file: $!" if $id_list_file;
+            }
+        }
+        else {
             $filefh = $query->upload("id_list_file");
         }
         my %id_filter;
-- 
1.7.2.5