Bug 26175

Summary: Remove warn if undefined barcode in misc/export_records.pl
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: Command-line UtilitiesAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, jonathan.druart, lucas, martin.renvoize, robin
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04
Circulation function:
Bug Depends on: 16935    
Bug Blocks:    
Attachments: Bug 26175: Remove warn if undefined barcode in misc/export_records.pl
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl
Bug 26175: (QA follow-up) Add tests for previous cashups

Description Fridolin Somers 2020-08-07 08:58:09 UTC
When using misc/export_records.pl --deleted_barcodes if barcode is NULL you get warn :
Use of uninitialized value in say at /home/koha/src/misc/export_records.pl

Also exporting barcode if empty string makes no sense.
Comment 1 Fridolin Somers 2020-08-07 09:09:47 UTC
Created attachment 107947 [details] [review]
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl

When using misc/export_records.pl --deleted_barcodes if barcode is NULL you get warn :
Use of uninitialized value in say at /home/koha/src/misc/export_records.pl

Also exporting barcode if empty string makes no sense.

Test plan :
1) Delete an item with barcode = NULL
2) Run : misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/deleted_barcodes
3) Check you se no warn "Use of uninitialized value in say ..."
4) Delete an item with barcode = ''
5) Run 2)
6) Check there is no empty line in /tmp/deleted_barcodes
Comment 2 Owen Leonard 2020-08-11 12:12:34 UTC
Created attachment 108054 [details] [review]
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl

When using misc/export_records.pl --deleted_barcodes if barcode is NULL you get warn :
Use of uninitialized value in say at /home/koha/src/misc/export_records.pl

Also exporting barcode if empty string makes no sense.

Test plan :
1) Delete an item with barcode = NULL
2) Run : misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/deleted_barcodes
3) Check you se no warn "Use of uninitialized value in say ..."
4) Delete an item with barcode = ''
5) Run 2)
6) Check there is no empty line in /tmp/deleted_barcodes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Martin Renvoize (ashimema) 2020-08-13 14:13:09 UTC
Created attachment 108190 [details] [review]
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl

When using misc/export_records.pl --deleted_barcodes if barcode is NULL you get warn :
Use of uninitialized value in say at /home/koha/src/misc/export_records.pl

Also exporting barcode if empty string makes no sense.

Test plan :
1) Delete an item with barcode = NULL
2) Run : misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/deleted_barcodes
3) Check you se no warn "Use of uninitialized value in say ..."
4) Delete an item with barcode = ''
5) Run 2)
6) Check there is no empty line in /tmp/deleted_barcodes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize (ashimema) 2020-08-13 14:13:34 UTC
Logically makes sense and works as expected..

Passing QA
Comment 5 Jonathan Druart 2020-08-14 10:52:19 UTC
How is this --deleted_barcodes flag used?

I don't understand why it is in this script.

Why don't we display an empty line instead?
Imagine someone using it to know the number of deleted records (wc -l).
Comment 6 Jonathan Druart 2020-08-18 12:35:27 UTC
waiting for an answer.
Comment 7 Fridolin Somers 2020-08-21 14:56:55 UTC
(In reply to Jonathan Druart from comment #5)
> How is this --deleted_barcodes flag used?
> 
> I don't understand why it is in this script.
> 
> Why don't we display an empty line instead?
> Imagine someone using it to know the number of deleted records (wc -l).

Hi,

It is used to update a portal :
After exporting modified/created records, we exported a list of deleted barcodes to remove items from the portal (they may not be in a modified record).
Barcode is enough because other datas are fetched live via ILS-DI.

An empty line does not mean anything I think.
Comment 8 Jonathan Druart 2020-08-26 13:23:55 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 9 Lucas Gass (lukeg) 2020-09-04 20:20:42 UTC
backported to 20.05.x for 20.05.04
Comment 10 Aleisha Amohia 2020-09-10 04:43:29 UTC
enhancement, not backported to 19.11.x
Comment 11 Martin Renvoize (ashimema) 2020-10-15 13:15:08 UTC Comment hidden (obsolete)