| 1 |
import { session } from "@web/session"; |
| 2 |
import { patch } from "@web/core/utils/patch"; |
| 3 |
import { barcodeService } from '@barcodes/barcode_service'; |
| 4 |
|
| 5 |
import { FNC1_CHAR } from "@barcodes_gs1_nomenclature/js/barcode_parser"; |
| 6 |
|
| 7 |
|
| 8 |
patch(barcodeService, { |
| 9 |
// Use the regex given by the session, else use an impossible one |
| 10 |
gs1SeparatorRegex: new RegExp(session.gs1_group_separator_encodings || '.^', 'g'), |
| 11 |
|
| 12 |
cleanBarcode(barcode) { |
| 13 |
barcode = barcode.replace(barcodeService.gs1SeparatorRegex, FNC1_CHAR); |
| 14 |
return super.cleanBarcode(barcode); |
| 15 |
}, |
| 16 |
}); |