$$usr_flesh{flesh} += 1;
$$usr_flesh{flesh_fields}{ac} = ['usr'];
- my $card = $e->search_actor_card([{barcode => $patron_id}, $usr_flesh])->[0];
+ my $card = $e->search_actor_card([{barcode => $patron_id, active => 't'}, $usr_flesh])->[0];
+
+ if(!$card) {
+ if ($patron_id =~ /^[A-Z].*/i) {
+ syslog("LOG_WARNING", "Trying lowercased/transformed value for barcode: $patron_id");
+ my $bc = lc($patron_id);
+ my $bclen = length($bc);
+ if ($bclen == 25 || $bclen == 27) {
+ $bc = substr($bc, 0, 13);
+ } elsif ($bclen == 23) {
+ $bc = substr($bc, 0, 12);
+ }
+ $card = $e->search_actor_card([{barcode => $bc, active => 't'}, $usr_flesh])->[0];
+ }
+ }
+
- if(!$card or !$U->is_true($card->active)) {
+ if(!$card) {
syslog("LOG_WARNING", "No such patron barcode: $patron_id");
return undef;
}