Summary: | Can't use inventory tool with barcodes that contain regex reserved characters ($,...) | ||
---|---|---|---|
Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
Component: | Tools | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart, lucas, m.de.rooy, marjorie.barry-vila, martin.renvoize, mtj |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23084 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
19.11.00,19.05.01
|
|
Attachments: |
Bug 23006: Cannot use inventory with barcodes containing special chars
Bug 23006: Cannot use inventory with barcodes containing special chars Bug 23006: Cannot use inventory with barcodes containing special chars |
Description
Katrin Fischer
2019-05-29 09:36:45 UTC
Suggested fix (thx mtj!) } elsif ( grep /^\Q$barcode\E$/, @scanned_barcodes ) { (In reply to Katrin Fischer from comment #1) > Suggested fix (thx mtj!) > > } elsif ( grep /^\Q$barcode\E$/, @scanned_barcodes ) { https://perldoc.perl.org/functions/quotemeta.html Also working on bug 22908 (slightly) related in using regexs for separating barcodes. (In reply to Marcel de Rooy from comment #3) > Also working on bug 22908 (slightly) related in using regexs for separating > barcodes. Oops, bug 22996 A more readable grep would be: } elsif ( grep { $_ eq $barcode } @scanned_barcodes ) { Will submit a patch. Created attachment 90188 [details] [review] Bug 23006: Cannot use inventory with barcodes containing special chars 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> Created attachment 90217 [details] [review] Bug 23006: Cannot use inventory with barcodes containing special chars 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> Created attachment 90237 [details] [review] Bug 23006: Cannot use inventory with barcodes containing special chars 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> Thx all! Nice work! Pushed to master for 19.11.00 Pushed to 19.05.x for 19.05.01 backported to 18.11.x for 18.11.07 |