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

            Bug ID: 44087
           Summary: EAN-13 autoBarcode computes the next barcode from
                    barcodes that are not valid EAN-13
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Cataloging
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
  Target Milestone: ---

With autoBarcode set to "generated in the form <EAN13>", the next barcode is
computed from the highest numeric barcode in items, without checking that it is
a valid EAN-13. When barcodes from other formats are kept (after a migration
from another system, a change of autoBarcode, or numeric barcodes entered by
hand), the generated barcodes are no longer valid EAN-13, or a barcode already
in use is suggested.

There are two code paths:

- C4::Barcodes::ValueBuilder::EAN13 (cataloguing barcode plugin and the REST
API) takes the highest 13-digit barcode. Bug 42221 added the length filter, but
a 13-digit barcode with a wrong check digit can still be the highest one.
get_barcode then warns "invalid EAN-13 ..., using increment" and returns that
barcode + 1, and the plugin's incrementEAN13 recomputes the check digit from
its first 12 digits.
- C4::Barcodes::EAN13 (used by acqui/addorder.pl when items are created while
ordering) inherits db_max from C4::Barcodes, which takes the highest numeric
barcode of any length ("Possible problem if multiple barcode types populated"),
so it can even generate barcodes longer than 13 digits.

To reproduce:
1. Set autoBarcode to "generated in the form <EAN13>".
2. Create items with these barcodes: 2000000000008 and 2000000000015 (valid
EAN-13) and 2000000000016 (13 digits, not a valid EAN-13).
3. Add a new item to any record and click in the barcode field.
4. The suggested barcode is 2000000000015, which is already in use. The
expected one is 2000000000022.

With the same barcodes plus a 14-digit one such as 30000000000000,
C4::Barcodes->new('EAN13') generates 300000000000014 (15 digits).

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to