Non alphanumeric barcodes

Issue #2 resolved
Micah Stetson
repo owner created an issue

Some users want the ability to have punctuation and other non alphanumeric characters in their barcodes. We should probably allow a limited set of punctuation, say -/. and _.

Comments (7)

  1. Anonymous

    I really need the ability to add dashes as our barcodes already contain dashes. Can you please tell me if this is possible and how to do it?

  2. Anonymous

    I really need non alphanumeric characters as our barcodes already contain dashes. Can you please tell me if this is possible and how to do it?

  3. Micah Stetson reporter

    The quick workaround is to remove the checks that make sure barcodes are alphanumeric. I think there are only two places that need to change, but it's been a while since I've worked with this code.

    In classes/BiblioCopy.php , lines 49, 50, and 51 should look like this:

          } else if (!ctypeAlnum($this->_barcodeNmbr)) {
            $valid = false;
            $this->_barcodeNmbrError = $this->_loc->getText("biblioCopyError2");
    

    Simply delete those lines, and the system should let you use any characters you want in an item barcode.

    In classes/Member.php , lines 47, 48, and 49 should look like this:

        } else if (!ctypeAlnum($this->_barcodeNmbr)) {
          $valid = FALSE;
          $this->_barcodeNmbrError = "Card number must be all alphabetic and numeric characters.";
    

    Delete those lines, and the system should let you use any characters you want in a member barcode.

    Hope that helps,

    Micah

  4. Anonymous

    Same problem, we have barcodes with a "-" I updated both of the files above, but the shelving cart and the member checkout page are not working

  5. Anonymous

    Fixed with the following changes:

    Checkout.php line 78 - 86 commented out Beginning with: if (!ctypeAlnum(trim($barcode))) { Ending with

    1. }

    shelving_cart.php line 38-46 commented out Beginning with: if (!ctypeAlnum($barcode)) { Ending with:

    1. }
  6. Hans van der Weij

    Micah's fix completely removes the alphanumeric check for barcodes on circulation pages, and that's OK (tested). For copy new and edit pages, the restriction on barcode characters is relaxed - thats fine when barcodes are printed using the OpenBiblio reports system. But it's still too restrictive when items are labeled with barcodes produced outside OpenBiblio. I know this can can be a lock-in problem for libraries that are evaluating OpenBiblio to replace another system. Some systems print characters that OpenBiblio's barcode font can't print. I've prepared optional validation for barcodes on copy new and edit pages in my repository: jgvdweij .

  7. Log in to comment