Bug 31930: Ignore whitespace before and after barcodes

Decoded the barcode in add items to collection.

Test plan:
1. Go to Tools -> Rotating collections
2. Create a rotating collection
3. Chose Actions -> Manage items
4. Paste a barcode and put some spaces around it, for example "          39999000010053             "
5. Click Submit => Shown an error, no item with matching barcode found, though the barcode is printed without all the whitespace
6. Apply patch
7. Repeat steps 1 - 5, barcode should be accepted

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Yvonne Waterman 2025-07-17 23:42:31 +00:00 committed by Lucas Gass
parent 20085be7fb
commit 2c730040b1
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 6 additions and 4 deletions

View File

@ -18,8 +18,9 @@
use Modern::Perl;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use C4::Circulation qw( barcodedecode );
use C4::Context;
use C4::RotatingCollections;
@ -42,8 +43,9 @@ if ( defined $op
and $op eq 'cud-add' )
{
## Add the given item to the collection
my $colId = $query->param('colId');
my $barcode = $query->param('barcode');
my $colId = $query->param('colId');
my $barcode = $query->param('barcode');
$barcode = barcodedecode($barcode);
my $removeItem = $query->param('removeItem');
my $item = Koha::Items->find( { barcode => $barcode } );
my $itemnumber = $item ? $item->itemnumber : undef;