Bug 15752: (follow-up) Search for patrons only if param barcode is defined
authorJosef Moravec <josef.moravec@gmail.com>
Fri, 18 Aug 2017 10:20:40 +0000 (12:20 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Feb 2018 20:38:57 +0000 (17:38 -0300)
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
circ/circulation.pl

index 3a18190..3df7b1e 100755 (executable)
@@ -81,14 +81,15 @@ if (!C4::Context->userenv){
     }
 }
 
-if (C4::Context->preference("AutoSwitchPatron") ) {
-    if (Koha::Patrons->search( { cardnumber => $query->param('barcode')} )->count() > 0) {
-        print $query->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=".$query->param('barcode'));
+my $barcodes = [];
+my $barcode =  $query->param('barcode');
+
+if (C4::Context->preference("AutoSwitchPatron") && $barcode) {
+    if (Koha::Patrons->search( { cardnumber => $barcode} )->count() > 0) {
+        print $query->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=".$barcode);
     }
 }
 
-my $barcodes = [];
-my $barcode =  $query->param('barcode');
 # Barcode given by user could be '0'
 if ( $barcode || ( defined($barcode) && $barcode eq '0' ) ) {
     $barcodes = [ $barcode ];