[Bug 38452] New: Inventory tool barcodes should not be case sensitive
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Bug ID: 38452 Summary: Inventory tool barcodes should not be case sensitive Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org I say this because it doesn't appear like we honor case sensitivity for barcodes elsewhere. So, to recreate: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. If Koha treats 'ABC123' and 'abc123' the same when creating an item, it should probably treat them the same when using the inventory tool. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #1 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 174638 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=174638&action=edit Bug 38452: Add lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 ByWater Sandboxes <bws.sandboxes@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #174638|0 |1 is obsolete| | --- Comment #2 from ByWater Sandboxes <bws.sandboxes@gmail.com> --- Created attachment 175031 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175031&action=edit Bug 38452: Add lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. Signed-off-by: Kevin ONeil <kco.ipad@ipad.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Kevin ONeil <kco.ipad@icloud.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |kco.ipad@icloud.com --- Comment #3 from Kevin ONeil <kco.ipad@icloud.com> --- Laura O’Neil assisted with this sign off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Laura O'Neil <laura@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |laura@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |m.de.rooy@rijksmuseum.nl --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Not sure if this change is enough. Look at following lines: my @items = Koha::Items->search( { barcode => { -in => \@barcodes } } )->as_list; my %items = map { $_->barcode => $_ } @items; foreach my $barcode (@barcodes) { my $item = $items{ $barcode }; $barcode that is looked up in the hash comes from @barcodes which now contains only lowercase barcodes, right? But the %items hash comes from a Koha::Items search. The SQL search is case insensitive and might return uppercase barcodes. Therefore $items{ABC123} does not exist, resulting in ERR_BARCODE, right? This shows that your test plan should also cover the ABC123 barcode case. Did you check if we have similar issues further on in the script? Please clarify. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Marcel de Rooy from comment #4)
$barcode that is looked up in the hash comes from @barcodes which now contains only lowercase barcodes, right? But the %items hash comes from a Koha::Items search. The SQL search is case insensitive and might return uppercase barcodes. Therefore $items{ABC123} does not exist, resulting in ERR_BARCODE, right?
Correction: ABC123 is in items.barcode. So items{ABC123} exists. But the loop tries items{abc132}. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|Trivial patch |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Marcel de Rooy from comment #5)
Correction: ABC123 is in items.barcode. So items{ABC123} exists. But the loop tries items{abc132}.
Hmm. abc123 obviously :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- WARN tools/inventory.pl WARN tidiness The file is less tidy than before (bad/messy lines before: 170, now: 171) For changing one line :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #8 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Marcel de Rooy from comment #4)
Not sure if this change is enough. Look at following lines:
my @items = Koha::Items->search( { barcode => { -in => \@barcodes } } )->as_list; my %items = map { $_->barcode => $_ } @items; foreach my $barcode (@barcodes) { my $item = $items{ $barcode };
$barcode that is looked up in the hash comes from @barcodes which now contains only lowercase barcodes, right? But the %items hash comes from a Koha::Items search. The SQL search is case insensitive and might return uppercase barcodes. Therefore $items{ABC123} does not exist, resulting in ERR_BARCODE, right?
This shows that your test plan should also cover the ABC123 barcode case.
Did you check if we have similar issues further on in the script?
Please clarify.
Thanks Marcel, that's a valid point. The lc() conversion should be after the SQL lookup. I'll change my patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #9 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Marcel de Rooy from comment #7)
WARN tools/inventory.pl WARN tidiness The file is less tidy than before (bad/messy lines before: 170, now: 171)
For changing one line :)
In the past I haven't been tidying these lines but I can start. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #10 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 175451 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175451&action=edit Bug 38452: Use lc() for case insensitivity -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #175031|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #175451|0 |1 is obsolete| | --- Comment #11 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 175452 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175452&action=edit Bug 38452: Use lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #175452|0 |1 is obsolete| | --- Comment #12 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 175455 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175455&action=edit Bug 38452: Use lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #175455|0 |1 is obsolete| | --- Comment #13 from David Nind <david@davidnind.com> --- Created attachment 175477 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=175477&action=edit Bug 38452: Use lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Text to go in the| |This fixes the inventory release notes| |tool so that it ignores | |case sensitivity for | |barcodes, similar to other | |areas of Koha such as | |checking in and checking | |out items (for example, | |ABC123 and abc123 are | |treated the same). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #175477|0 |1 is obsolete| | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 176310 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=176310&action=edit Bug 38452: Use lc() for case insensitivity To test: 1. Create an item give it a barcode like 'abc123'; 2. Try creating a 2nd item with a barcode: 'ABC123', you get an error 'Error saving item: Barcode must be unique.' 3. Checkin the item 'ABC123', the 'abc123' item successfully checks in. 4. The case doesn't seem to matter elsewhere in Koha ( check-in, checkout, searching, batch tools ) 5. Try the inventory tool and use 'ABC123'. The barcode is not found. 6. APPLY PATCH, restart_all 7. Try the inventory tool again with both 'abc123' and 'ABC123', they should now both work. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |25.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 25.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.05.00 |25.05.00,24.11.02 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #16 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 24.11.x for 24.11.01 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|25.05.00,24.11.02 |25.05.00,24.11.02,24.05.08 released in| | CC| |alexbuckley@catalyst.net.nz --- Comment #17 from Alex Buckley <alexbuckley@catalyst.net.nz> --- Nice work everyone! Pushed to 24.05.x for 24.05.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting CC| |fridolin.somers@biblibre.co | |m --- Comment #18 from Fridolin Somers <fridolin.somers@biblibre.com> --- I prefer not to backport to "very-old-stable" 23.11.x to avoid behavior change. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com --- Comment #19 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- This feels like a bug fix and should not affect the manual. However, should we mention that barcodes are case insensitive somewhere? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 --- Comment #20 from David Nind <david@davidnind.com> --- (In reply to Caroline Cyr La Rose from comment #19)
This feels like a bug fix and should not affect the manual. However, should we mention that barcodes are case insensitive somewhere?
I think it would be a good idea. Maybe in the cataloguing guide for 952$p/995$f? https://koha-community.org/manual/latest/en/html/cataloging.html#p-995-f-bar... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs documenting |RESOLVED --- Comment #21 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- (In reply to David Nind from comment #20)
(In reply to Caroline Cyr La Rose from comment #19)
This feels like a bug fix and should not affect the manual. However, should we mention that barcodes are case insensitive somewhere?
I think it would be a good idea.
Maybe in the cataloguing guide for 952$p/995$f? https://koha-community.org/manual/latest/en/html/cataloging.html#p-995-f- barcode
Thanks David! Good idea for the section. I added the note there. https://gitlab.com/koha-community/koha-manual/-/merge_requests/1032 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38452 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jacob.omara@openfifth.co.uk | |, | |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org