\CodabarNumber
Codabar (USD-4, NW-7, and 2 of 7 code) Many libraries use the following system which includes <b>13</b> digits plus a checksum; here is a description of the method used by Ameritech Library Services (Provo, Utah).
- Digit 1 indicates the type of barcode: 2 = patron, 3 = item (book)
- Digits 2-5 (4 digits) identify the institution
- Digits 6-13 (8 digits ex. 00010 586) identify the individual patron or item
- Digit 14 is the checksum
- Author: Hudhaifa Shatnawi <hudhaifa.shatnawi@gmail.com>
Synopsis
class CodabarNumber
{
- // members
- private $digit1;
- private static integer $libraryID = 1310;
- private integer $sn = 0;
- private integer $checkDigit = 0;
- // methods
- public void __construct()
- private type checkSerialNumber()
- public the getCodabar()
- public the getDigit1()
- public the getLibraryID()
- public the getSerialNumber()
- public the getCheckDigit()
- private void calculateCheckDigit()
Members
private
-
$checkDigit
Indicates the type of barcode. -
$digit1
First digit indicates the type of barcode: - 2 = patron - 3 = item (book) - etc.. -
$libraryID
Identify the institution -
$sn
Identify the individual patron or item
Methods
private
- calculateCheckDigit() — Calculates the checksum digit, start with the total set to zero and scan the 13 digits from left to right:
- checkSerialNumber() — Checks the serial number length, if its less than 8 digits add zeros to the left of the number string.
public
- __construct()
- getCheckDigit() — Returns the last (14th) digit which indicates the checksum
- getCodabar() — Returns the complete codabar code
- getDigit1() — Returns the first digit which indicates the type of barcode.
- getLibraryID() — Returns the 4 (2-5) digits which identify the institution
- getSerialNumber() — Returns the 8 (6-13) digits serial number