Generic patron barcode generation (OpenSRF and DB) feature/barcode_generator_2_7
authorDan Scott <dscott@laurentian.ca>
Thu, 10 Jan 2013 19:17:33 +0000 (14:17 -0500)
committerDan Scott <dscott@laurentian.ca>
Tue, 11 Nov 2014 16:44:44 +0000 (11:44 -0500)
commit3f634689b7953a83f71f98dd2252550f9a9eb2ec
tree57f9db66680836cbc04c755a8cbb19f62775981d
parent56a0fd01fbb94a8c057392b0f6e03e831195dd1a
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]