Bug 15923: Take the id list file into account when exporting records
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 29 Feb 2016 08:10:59 +0000 (08:10 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 2 Mar 2016 00:43:11 +0000 (00:43 +0000)
When exporting records (tools/export.pl or misc/export_records.pl), a
file of ids (authid or biblionumber) can be passed to filter the
results.
Bug 14722 has broken this behavior.

Test plan:
Export records and specify a list of records to filter the results.
Prior to this patch, the record with the id 1 was exported.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
misc/export_records.pl
tools/export.pl

index e6c3d98..b411425 100755 (executable)
@@ -175,7 +175,7 @@ elsif ( $record_type eq 'auths' ) {
 @record_ids = uniq @record_ids;
 if ( @record_ids and my $id_list_file ) {
     my @filter_record_ids = <$id_list_file>;
-    @filter_record_ids = map { my $id = $_; $id =~ s/[\r\n]*$// } @filter_record_ids;
+    @filter_record_ids = map { my $id = $_; $id =~ s/[\r\n]*$//; $id } @filter_record_ids;
     # intersection
     my %record_ids = map { $_ => 1 } @record_ids;
     @record_ids = grep $record_ids{$_}, @filter_record_ids;
index 2e8b044..efcd544 100755 (executable)
@@ -178,7 +178,7 @@ if ( $op eq "export" ) {
         @record_ids = uniq @record_ids;
         if ( @record_ids and my $filefh = $query->upload("id_list_file") ) {
             my @filter_record_ids = <$filefh>;
-            @filter_record_ids = map { my $id = $_; $id =~ s/[\r\n]*$// } @filter_record_ids;
+            @filter_record_ids = map { my $id = $_; $id =~ s/[\r\n]*$//; $id } @filter_record_ids;
             # intersection
             my %record_ids = map { $_ => 1 } @record_ids;
             @record_ids = grep $record_ids{$_}, @filter_record_ids;