[Koha-bugs] [Bug 23006] New: Can't use inventory tool with barcodes that contain regex relevant characters ($, ...)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 29 11:36:45 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23006

            Bug ID: 23006
           Summary: Can't use inventory tool with barcodes that contain
                    regex relevant characters ($,...)
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Tools
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: katrin.fischer at bsz-bw.de
        QA Contact: testopia at bugs.koha-community.org
  Target Milestone: ---

If your barcodes contain characters like $ (and possible others), it's not
possible to use the inventory tool with a barcode file as they will report as
'not scanned', while the datelastseen is still updated.

We have a library system that uses barcodes with the following schema:
LOCATION_CODE$DIGITS

When uploading a file with such barcodes in the inventory tool, they all report
as missing. Exceptions are items that are on the wrong place on the shelf, they
report correctly. The datelastseen is updated for all items anyway.

To test:
1) Create an item with the following barcode: LOC$00001
2) Create a file with the same barcode on the first line.
3) Go to the inventory tool
4) Upload barcode file
   Check "Compare barcodes list to results"
   Check "Do not check in items scanned during inventory"
   Check "Skip items on loan"
   You might want to pick additional limits for a smaller result set depending
   on your sample db size, make sure it matches the item catalogued
5) Verify the scanned item is in the list, but the status reads "Missing (not
scanned)".

I found this regex in the perl code:

         if( !$barcode ) {
             $item->{problems}->{no_barcode} = 1;
         } elsif ( grep /^$barcode$/, @scanned_barcodes ) {
             next;
         } else {
             $item->{problems}->{not_scanned} = 1;
         }

I assume that grep /^$barcode$/ fails because of the unescaped $. 

Is there a good way to make sure all problematic characters are escaped? 
Is the grep really necessary here? 

Later on we make the comparisons differently which is why the "wrongplace"
still appears correctly and probably also why the datelastseen is updated as
well.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list