Bug 15752: Automatically switch to patron when cardnumber is read during circulation
authorChad Billman <chad@pennmanor.net>
Thu, 21 Jan 2016 15:59:01 +0000 (10:59 -0500)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 12 Feb 2018 20:38:57 +0000 (17:38 -0300)
With this syspref enabled scanning a patron barcode into the item
barcode field during circulation will redirect you to the patron's
circulation page.

This allows circulation with only a barcode scanner.

Testing:

- Enable the AutoSwitchPatron syspref
- Navigate to a patron's check out screen
- Enter a patron barcode into the "Enter item barcode" field

Result
- Browser should be redirected to the entered patron

Signed-off-by: Joel <aloi54@live.fr>

Followed test plan, patch works as described
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
installer/data/mysql/atomicupdate/Bug15752_CircAutoSwitchPatron.sql [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref

index ceccef1..3a18190 100755 (executable)
@@ -81,6 +81,12 @@ 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');
 # Barcode given by user could be '0'
diff --git a/installer/data/mysql/atomicupdate/Bug15752_CircAutoSwitchPatron.sql b/installer/data/mysql/atomicupdate/Bug15752_CircAutoSwitchPatron.sql
new file mode 100644 (file)
index 0000000..620c659
--- /dev/null
@@ -0,0 +1,2 @@
+INSERT INTO systempreferences (variable,value,options,explanation,type)
+VALUES ('AutoSwitchPatron', '0', '', 'Auto switch to patron', 'YesNo');
index 68881d0..8e6887c 100644 (file)
@@ -68,6 +68,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('AutoSelfCheckAllowed','0','','For corporate and special libraries which want web-based self-check available from any PC without the need for a manual staff login. Most libraries will want to leave this turned off. If on, requires self-check ID and password to be entered in AutoSelfCheckID and AutoSelfCheckPass sysprefs.','YesNo'),
 ('AutoSelfCheckID','','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
 ('AutoSelfCheckPass','','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','free'),
+('AutoSwitchPatron', '0', '', 'Auto switch to patron', 'YesNo'),
 ('Babeltheque','0','','Turn ON Babeltheque content  - See babeltheque.com to subscribe to this service','YesNo'),
 ('Babeltheque_url_js','','','Url for Babeltheque javascript (e.g. http://www.babeltheque.com/bw_XX.js)','Free'),
 ('Babeltheque_url_update','','','Url for Babeltheque update (E.G. http://www.babeltheque.com/.../file.csv.bz2)','Free'),
index 6589e3e..178a048 100644 (file)
@@ -8,6 +8,13 @@ Circulation:
                   no: Deactivate
             - the navigation sidebar on all Circulation pages.
         -
+            - pref: AutoSwitchPatron
+              choices:
+                  yes: "Enable"
+                  no: "Don't enable"
+            - the automatic redirection to another patron when a patron barcode is scanned instead of a book.
+            - This should not be enabled if you have overlapping patron and book barcodes.
+        -
             - pref: CircAutocompl
               choices:
                   yes: Try