Bug 23006: Cannot use inventory with barcodes containing special chars
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 29 May 2019 13:46:15 +0000 (13:46 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 4 Jun 2019 08:39:43 +0000 (09:39 +0100)
If a barcode contains special characters like $, the regex in inventory
does no longer work.
This fix (as suggested by Jonathan) replaces the regex by a eq compare.

Test plan:
Pick one barcode and add a $ somewhere in the middle, say 123$456.
Include this barcode in a barcode file for inventory.
Run inventory on that file and verify that barcode was read and datelastseen
was updated. The barcode should not be reported as missing (not scanned).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

tools/inventory.pl

index 96a6bdf..934f121 100755 (executable)
@@ -328,7 +328,7 @@ if ( $compareinv2barcd ) {
         my $barcode = $item->{barcode};
         if( !$barcode ) {
             $item->{problems}->{no_barcode} = 1;
-        } elsif ( grep /^$barcode$/, @scanned_barcodes ) {
+        } elsif ( grep { $_ eq $barcode } @scanned_barcodes ) {
             next;
         } else {
             $item->{problems}->{not_scanned} = 1;