Branchify Doug Kyle's patch on Launchpad bug 874603. collab/dyrcona/lp874603
authorDoug Kyle <dkyle@grpl.org>
Fri, 14 Oct 2011 21:01:46 +0000 (17:01 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 14 Oct 2011 21:01:46 +0000 (17:01 -0400)
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm

index c638e1c..bef250f 100644 (file)
@@ -672,7 +672,11 @@ sub patron_search {
 
        my $card = '';
        if ($cv) {
-           $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE evergreen.lowercase(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
+                if ( $cv =~ /[A-Za-z]/) {
+                        $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE evergreen.lowercase(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
+                } else {
+                        $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE barcode LIKE ?||\'%\') AS card ON (card.usr = users.id)';
+                }
            unshift(@usrv, $cv);
        }