Generic patron barcode generation (OpenSRF and DB)
authorDan Scott <dscott@laurentian.ca>
Thu, 10 Jan 2013 19:17:33 +0000 (14:17 -0500)
committerDan Scott <dscott@laurentian.ca>
Sun, 13 May 2018 14:25:10 +0000 (10:25 -0400)
commit8c4bf4c51b711f99af1a3142a9cc33a168847f54
tree4d719f7d3e2f6f603de3d9f15e96d7b223c99270
parent77cefba281c01ceaa9f8e3ab18ac662b698075b6
Generic patron barcode generation (OpenSRF and DB)

Laurentian University needed the ability to generate barcodes as part of
its LDAP integration work, and the first generation (so to speak) of the
was specific to LU - including hard-coded prefixes and database
functions that include the "lu" name.

This commit makes the functionality much more generic and thus more
likely to be able to be adopted by other institutions. The principle
components are:

Database functions:

evergreen.actor_generate_barcode([prefix TEXT]) - returns a 14-digit
  barcode from the evergreen.actor_barcode_seq sequence with a prefix of
  'AUTOBC' or the specific prefix of up to 6 characters. If the
  resulting barcode is all digits, then the 14th character will be a
  mod10 check digit; otherwise the 14th digit will be '0'.

evergreen.actor_update_barcode(usr_id INTEGER[, prefix TEXT]) -
  generates a new barcode for the specified user, with the optional
  barcode prefix.

evergreen.mod10(barcode TEXT) - given a barcode, generates a mod10
  check digit and returns the barcode with the appended check digit

OpenSRF method:

open-ils.actor.generate_patron_barcode([usr_id INT[, prefix TEXT]]) -
  generates a new barcode for the patron

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
Open-ILS/src/sql/Pg/upgrade/XXXX.generate_patron_barcodes.sql [new file with mode: 0644]