From f52c54eb358ffd86d3701fb00fb5873c6662b16f Mon Sep 17 00:00:00 2001 From: Jane Wagner Date: Fri, 30 Oct 2009 09:44:38 -0400 Subject: [PATCH] Bug 3738 Automate login to web-based self-check system 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. Signed-off-by: Galen Charlton --- admin/systempreferences.pl | 3 +++ .../data/mysql/en/mandatory/sysprefs.sql | 3 +++ .../unimarc_standard_systemprefs.sql | 3 +++ .../mandatory/system_preferences_optimal.sql | 3 +++ installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ opac/sco/sco-main.pl | 7 +++++++ 6 files changed, 39 insertions(+) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index bc74b2e56c..fad0b074ba 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -330,6 +330,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 704fe5cfd0..fc795040fa 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -279,3 +279,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' ); INSERT INTO systempreferences VALUES ('ImageLimit',5,'','Limit images stored in the database by the Patron Card image manager to this number.','Integer'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SpineLabelShowPrintOnBibDetails', '0', '', 'If turned on, a "Print Label" link will appear for each item on the bib details page in the staff interface.', '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 1cd4a8b8f5..376653e596 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 @@ -282,3 +282,6 @@ INSERT INTO systempreferences VALUES ('ImageLimit',5,'','Limiter le nombre d''i INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','Si désactivé, l''affichage détaillé des données adhérents est désactivé à l''OPAC.','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','Si désactivé, l''onglet Amende est désactivé à l''OPAC.','','YesNo'); INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SpineLabelShowPrintOnBibDetails', '0', '', 'If turned on, a "Print Label" link will appear for each item on the bib details page in the staff interface.', '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 8bb90f058a..a33f79313b 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal.sql @@ -239,3 +239,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 bc7f3e1ee8..7738f05aeb 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3412,6 +3412,26 @@ 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) diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index f496e3bd6e..af9d996b7a 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, -- 2.39.2