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>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2024-12-13 16:27:51 +00:00 committed by Katrin Fischer
parent eecb123bd5
commit 70ea004f02
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 2 deletions

View File

@ -216,9 +216,9 @@ if ( $op eq 'cud-inventory'
err_data => $err_data );
}
my @items = Koha::Items->search( { barcode => { -in => \@barcodes } } )->as_list;
my %items = map { $_->barcode => $_ } @items;
my %items = map { lc($_->barcode) => $_ } @items;
foreach my $barcode (@barcodes) {
my $item = $items{ $barcode };
my $item = $items{ lc($barcode) };
if ( $item ) {
if ( $item->withdrawn ) {
push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 };