Bug 15923

Summary: Export records by id list impossible in export_records.pl
Product: Koha Reporter: Josef Moravec <josef.moravec>
Component: Command-line UtilitiesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: brendan, f.demians, gwilliams, jonathan.druart, josef.moravec, julian.maurice, katrin.fischer, robin, ztajoli
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 14722    
Bug Blocks:    
Attachments: Bug 15923: Take the id list file into account when exporting records
Bug 15923: Take the id list file into account when exporting records
Bug 15923: Fix --id_list_file option for misc/export_records.pl
Bug 15923: Take the id list file into account when exporting records
Bug 15923: Fix --id_list_file option for misc/export_records.pl
[PASSED QA] Bug 15923: Take the id list file into account when exporting records
[PASSED QA] Bug 15923: Fix --id_list_file option for misc/export_records.pl

Description Josef Moravec 2016-02-26 07:43:59 UTC
Trying to use export_records.pl for exporting biblios by biblionumber (through list_id_file option) fails. It exports whole catalogue instead.
Comment 1 Katrin Fischer 2016-02-28 21:20:46 UTC
Trying to export using a biblionumber file from the staff interface only gives me an empty file. Exporting the same records using the 'form bilbio nubmer' and 'to bilbio number' options works as expected.
Comment 2 Jonathan Druart 2016-02-29 08:18:33 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-02-29 08:30:55 UTC Comment hidden (obsolete)
Comment 4 Josef Moravec 2016-02-29 10:01:50 UTC
Thank for quick patch Jonathan. In user interface it works as expected, but from command line I'm still getting all the record - not filtered by id_list_file.
Comment 5 Katrin Fischer 2016-02-29 10:11:32 UTC
Hi Josef, thx for the quick testing. If you discover a problem, please feel free to set the status to 'failed qa'.
Comment 6 Josef Moravec 2016-02-29 10:22:41 UTC
Thanks Katrin, I'll try to remember it for next time ;)
Comment 7 Josef Moravec 2016-02-29 10:26:11 UTC
There is probably problem on another place too. Looking to the code: 
http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=misc/export_records.pl;h=e6c3d98dd8b62372d321d76aaa30f94b1f7184a0;hb=447b1ea93938319f42031636694a0036913cd83c#l176

 176 if ( @record_ids and my $id_list_file ) {
 177     my @filter_record_ids = <$id_list_file>;

redeclaring variable $id_list_file may be the problem?
Comment 8 Jonathan Druart 2016-02-29 10:57:34 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2016-02-29 10:58:54 UTC
I just c/p stupidly the line to the misc file, but the option was buggy.
It should work fine now;
Comment 10 Josef Moravec 2016-02-29 11:36:02 UTC Comment hidden (obsolete)
Comment 11 Josef Moravec 2016-02-29 11:36:08 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2016-03-01 23:07:08 UTC
Created attachment 48527 [details] [review]
[PASSED QA] Bug 15923: Take the id list file into account when exporting records

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>
Comment 13 Katrin Fischer 2016-03-01 23:08:08 UTC
Created attachment 48528 [details] [review]
[PASSED QA] Bug 15923: Fix --id_list_file option for misc/export_records.pl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Brendan Gallagher 2016-03-02 00:43:51 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks!
Comment 15 Julian Maurice 2016-03-07 08:25:44 UTC
Patch pushed to stable, will be in 3.22.5
Comment 16 Frédéric Demians 2016-03-15 06:54:44 UTC
Can't be backported to 3.20 due to bug 14722 not being backported to 3.20.