[Koha-patches] [PATCH] Bug 3738 Automate login to web-based self-check system

Jane Wagner jwagner at ptfs.com
Fri Oct 30 14:44:38 CET 2009


Some small, single-branch corporate and special libraries use unattended self-checkout stations, and would like to automate the staff login, so that just going to the sco/sco-main.pl URL would bring the self-check up ready for patron use.  This patch create three sysprefs, AutoSelfCheckAllowed, and AutoSelfCheckID/AutoSelfCheckPass. If the site wants to allow automated login, staff would then need to create the selfcheck user record and enter that login ID and password into the sysprefs.  The kohaclone/opac/sco/sco-main.pl script has been modified to check these sysprefs and pass values (if present and allowed) into the self-check URL.  The URL then bypasses the staff login page and comes up ready for checkout, waiting for the first patron barcode.
---
 admin/systempreferences.pl                         |    3 ++
 installer/data/mysql/en/mandatory/sysprefs.sql     |    3 ++
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    3 ++
 .../ru-RU/mandatory/system_preferences_optimal.sql |    3 ++
 installer/data/mysql/updatedatabase.pl             |   21 ++++++++++++++++++++
 opac/sco/sco-main.pl                               |    7 ++++++
 6 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index e96c109..7532493 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -323,6 +323,9 @@ $tabsysprefs{OPACAllowHoldDateInFuture}  = "OPAC";
 $tabsysprefs{OPACPatronDetails}  = "OPAC";
 $tabsysprefs{OPACFinesTab}  = "OPAC";
 $tabsysprefs{DisplayOPACiconsXSLT}	 = "OPAC";
+$tabsysprefs{AutoSelfCheckAllowed}	 = "OPAC";
+$tabsysprefs{AutoSelfCheckID}		 = "OPAC";
+$tabsysprefs{AutoSelfCheckPass}		 = "OPAC";
 
 # OPAC
 $tabsysprefs{SearchMyLibraryFirst} = "OPAC";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 6f60fa7..f01aa74 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -262,3 +262,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'If ON, displays patron image when a patron uses web-based self-checkout', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('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');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckID','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckPass','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index bee360a..bb137c3 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -261,3 +261,6 @@ INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('H
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'Si activé, affiche le format, le type de public et les icônes de type en XSLT (MARC21)).', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('AutoSelfCheckAllowed', '0', 'Pour les bibliothèques d'entreprise qui veulent du prêt auto-contrôlé de n'importe quel PC sans le besoin de recourir à un login de bibliothécaire.', '', 'YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckID','','Identifiant Bibliothécaire avec droits de circulation qui sera utilisé pour les prêt auto-contré. Ne s'applique que dans les cas de l'activation de la préférence AutoSelfCheckout.'70|10','Textarea');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckPass','','Mot de passe utilisé pour le prêt autocontrôlé. Ne s'applique que dans le cas de l'activation de la préférence AutoSelfCheckout',.'70|10','Textarea');
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
index 61318c0..e090152 100644
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql
@@ -238,3 +238,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('MergeAuthoritiesOnUpdate', '1', 'if ON, Updating authorities will automatically updates biblios',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowNotForLoanOverride', '0', 'if ON, enables the librarian to choose when they want to check out a notForLoan regular item',NULL,'YesNo');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('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');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckID','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckPass','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 10c3451..627b687 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2675,6 +2675,27 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.062';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('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')");
+	print "Upgrade to $DBversion done ( Added AutoSelfCheckAllowed system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.01.00.063';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckID','','Staff ID with circulation rights to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea')");
+	print "Upgrade to $DBversion done ( Added AutoSelfCheckID system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.01.00.064';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AutoSelfCheckPass','','Password to be used for automatic web-based self-check. Only applies if AutoSelfCheckAllowed syspref is turned on.','70|10','Textarea')");
+	print "Upgrade to $DBversion done ( Added AutoSelfCheckPass system preference )\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index f496e3b..af9d996 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -31,6 +31,13 @@ use C4::Biblio;
 use C4::Items;
 
 my $query = new CGI;
+if (C4::Context->preference('AutoSelfCheckAllowed')) 
+{
+	my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
+	my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
+	$query->param(-name=>'userid',-values=>[$AutoSelfCheckID]),
+	$query->param(-name=>'password',-values=>[$AutoSelfCheckPass]),
+}
 my ($template, $loggedinuser, $cookie) = get_template_and_user({
     template_name   => "sco/sco-main.tmpl",
     authnotrequired => 0,
-- 
1.5.6.5




More information about the Koha-patches mailing list