[Koha] Barcode

Paul Hoffman paul at flo.org
Thu Oct 11 07:49:42 NZDT 2018


On Mon, Oct 08, 2018 at 08:40:46AM +0800, Ma. Victoria H. Silva-Manuel wrote:
> Is there a way for Koha to disregard extra zeros at the beginning of the
> barcode?

I doubt that this is possible.  In any case, a better solution would be 
to fix the barcodes in Koha.

> Example, the barcode is 00112495d. Can Koha just read it as 112495d?
> When we encode our barcodes in Koha we did not place extra zeros but
> because we acquire another library system and it cannot accept barcodes
> with different lengths we need to add extra zeros at the beginning of the
> barcode numbers.

Let me make sure I understand correctly: are you saying that the barcode 
in Koha is "112495d" but the barcode that you scan is "00112495d"?

Also, are you talking about item barcodes, patron barcodes, or both?

If you have access to your Koha server, you might be able to fix 
barcodes using SQL something like this (assuming you're talking about 
items):

    UPDATE items
    SET    barcode = concat("00", barcode)  -- prepend "00"
    WHERE  barcode LIKE "11_____"           -- five "_" characters
    ;

Please don't run this query as is!  Instead, use this is inspiration for 
a SQL query that fits your particular needs.  And check first -- for 
example, if you think most of your item barcodes are seven characters 
long, and begin with "11" or "12", see what numbers you get from a query 
like this:

    SELECT count(*), '11XXXXX'
    FROM   items
    WHERE  barcode LIKE "11_____"
    UNION ALL
    SELECT count(*), '12XXXXX'
    FROM   items
    WHERE  barcode LIKE "12_____"
    UNION ALL
    SELECT count(*), 'other'
    FROM   items
    WHERE  barcode NOT LIKE "11_____"
    AND    barcode NOT LIKE "12_____"
    ;

Good luck!

Paul.

-- 
Paul Hoffman <paul at flo.org>
Software Services Manager
Fenway Library Organization
550 Huntington Ave.
Boston, MA 02115
(617) 442-2384


More information about the Koha mailing list