Browse Source

Bug 19585: Inventory: Allow additional separators in a barcode file

This patch makes \n, \r, |, comma, semicolon and hyphen ('-') all valid
separators between barcodes passed to inventory.
An additional grep removes empty barcodes. (Note: The grep looks for at
least one non-whitespace character. We could be more specific, but this
allows for more flexibility like testing with alphanumeric barcodes etc.)

Test plan:
Upload a barcode file that contains various allowed separators.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jenny Way <jwayway@hotmail.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
18.05.x
Marcel de Rooy 5 years ago
committed by Jonathan Druart
parent
commit
2c4974cc12
  1. 5
      tools/inventory.pl

5
tools/inventory.pl

@ -154,10 +154,7 @@ if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) {
my $lines_read=0;
binmode($uploadbarcodes, ":encoding(UTF-8)");
while (my $barcode=<$uploadbarcodes>) {
$barcode =~ s/\r/\n/g;
$barcode =~ s/\n\n/\n/g;
my @data = split(/\n/,$barcode);
push @uploadedbarcodes, @data;
push @uploadedbarcodes, grep { /\S/ } split( /[\n\r,;|-]/, $barcode );
}
for my $barcode (@uploadedbarcodes) {
next unless $barcode;

Loading…
Cancel
Save