Handle new-style licenses as patron barcodes
authorJeff Godin <jgodin@tadl.org>
Mon, 21 May 2012 20:26:57 +0000 (16:26 -0400)
committerJeff Godin <jgodin@tadl.org>
Tue, 22 May 2012 15:34:14 +0000 (11:34 -0400)
Handle new-style drivers licenses when used as patron barcodes by
using the first 13 characters (lowercased) when the "raw" barcode
is either 25 or 27 characters long. Previously we only handled 25
character barcodes.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
Open-ILS/xul/staff_client/server/patron/barcode_entry.xul

index abf100e..ca89650 100644 (file)
@@ -85,9 +85,10 @@ sub new {
             if ($patron_id =~ /^[A-Z].*/i) {
                 syslog("LOG_WARNING", "Trying lowercased/transformed value for barcode: $patron_id");
                 my $bc = lc($patron_id);
-                if (length($bc) == 25) {
+                my $bclen = length($bc);
+                if ($bclen == 25 || $bclen == 27) {
                     $bc = substr($bc, 0, 13);
-                } elsif (length($bc) == 23) {
+                } elsif ($bclen == 23) {
                     $bc = substr($bc, 0, 12);
                 }
                 $card = $e->search_actor_card([{barcode => $bc, active => 't'}, $usr_flesh])->[0];
index f693059..474b998 100644 (file)
                 barcode = String( barcode ).replace( /\s+/g, '' );
 
                 if (!barcode) { sound.bad(); add_msg($("patronStrings").getString('staff.patron.barcode_entry.no_barcode')); tb.select(); tb.focus(); return; }
-               // MIEG: Michigan ID voodo
-                if (barcode.length == 25) { var bcode = barcode.substring(0,13); barcode = bcode.toLowerCase(); }
+
+                if (barcode.length == 27 || barcode.length == 25) {
+                    var bcode = barcode.substring(0,13); barcode = bcode.toLowerCase();
+                }
                 if (barcode.length == 23) { var bcode = barcode.substring(0,11); barcode = bcode.toLowerCase(); }
 
                 JSAN.use('util.network'); var net = new util.network();