Bugzilla – Attachment 3543 Details for
Bug 5578
SCO using login for authentication
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
bug5578.patch (text/plain), 33.12 KB, created by
Nicole C. Engard
on 2011-03-30 20:41:13 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Nicole C. Engard
Created:
2011-03-30 20:41:13 UTC
Size:
33.12 KB
patch
obsolete
>From: Ian Walls <ian.walls@bywatersolutions.com> >To: dev@bywatersolutions.com >Cc: Ian Walls <ian.walls@bywatersolutions.com> >Subject: [PATCH] Bug 5578: Self checkout by Login enhancement >Date: Wed, 30 Mar 2011 15:02:33 -0400 >Message-Id: <1301511753-16866-1-git-send-email-ian.walls@bywatersolutions.com> >X-Mailer: git-send-email 1.5.6.5 >X-Original-Sender: ian.walls@bywatersolutions.com >X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best > guess record for domain of koha@dev.bywatersolutions.com designates > 174.143.239.187 as permitted sender) smtp.mail=koha@dev.bywatersolutions.com >Precedence: list >Mailing-list: list dev@bywatersolutions.com; contact dev+owners@bywatersolutions.com >List-ID: <dev.bywatersolutions.com> >X-Google-Group-Id: 274270250429 >List-Help: <http://www.google.com/support/a/bywatersolutions.com/bin/static.py?hl=en_US&page=groups.cs>, > <mailto:dev+help@bywatersolutions.com> >Content-Type: text/plain; charset="utf-8" > >Enables the library to choose whether to have patrons scan their barcodes for self checkout, or login >with username and password. Uses 'checkpw' for compatibility with LDAP authentication. > >Also introduces a few new system preferences to make Self Checkout more secure and manageable: > > SelfCheckTimeOut: the number of seconds before the self-checkout login times out for a patron > AllowSelfCheckReturns: indicate whether or not patrons can return materials via self-checkout > SelfCheckHelpMessage: user-configurable HTML to show specific text on the Help page. > >Thank you to Marlboro College in Marlboro, VT for sponsoring and testing this development! >--- > C4/Circulation.pm | 29 +++++++++----- > circ/circulation.pl | 6 +- > installer/data/mysql/de-DE/mandatory/sysprefs.sql | 3 + > installer/data/mysql/en/mandatory/sysprefs.sql | 3 + > .../1-Obligatoire/unimarc_standard_systemprefs.sql | 3 + > installer/data/mysql/it-IT/necessari/sysprefs.sql | 3 + > installer/data/mysql/pl-PL/mandatory/sysprefs.sql | 3 + > ...m_preferences_full_optimal_for_install_only.sql | 3 + > ...m_preferences_full_optimal_for_install_only.sql | 3 + > installer/data/mysql/updatedatabase.pl | 9 ++++ > .../en/modules/admin/preferences/circulation.pref | 22 +++++++++++ > koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl | 13 +++++- > .../opac-tmpl/prog/en/modules/sco/sco-main.tmpl | 25 ++++++++++-- > opac/sco/help.pl | 14 +++++++ > opac/sco/sco-main.pl | 40 +++++++++++++++++--- > 15 files changed, 153 insertions(+), 26 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index dad54e3..584589e 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -14,9 +14,9 @@ package C4::Circulation; > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License along with >+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA > > > use strict; >@@ -2691,6 +2691,7 @@ C<$startdate> = C4::Dates object representing start date of loan period (assum > C<$itemtype> = itemtype code of item in question > C<$branch> = location whose calendar to use > C<$borrower> = Borrower object >+ > =cut > > sub CalcDateDue { >@@ -2698,14 +2699,21 @@ sub CalcDateDue { > my $datedue; > my $loanlength = GetLoanLength($borrower->{'categorycode'},$itemtype, $branch); > >- if(C4::Context->preference('useDaysMode') eq 'Days') { # ignoring calendar >- my $timedue = time + ($loanlength) * 86400; >- #FIXME - assumes now even though we take a startdate >- my @datearr = localtime($timedue); >- $datedue = C4::Dates->new( sprintf("%04d-%02d-%02d", 1900 + $datearr[5], $datearr[4] + 1, $datearr[3]), 'iso'); >+ # if globalDueDate ON the datedue is set to that date >+ if ( C4::Context->preference('globalDueDate') >+ && ( C4::Context->preference('globalDueDate') =~ C4::Dates->regexp('syspref') ) ) { >+ $datedue = C4::Dates->new( C4::Context->preference('globalDueDate') ); > } else { >- my $calendar = C4::Calendar->new( branchcode => $branch ); >- $datedue = $calendar->addDate($startdate, $loanlength); >+ # otherwise, calculate the datedue as normal >+ if(C4::Context->preference('useDaysMode') eq 'Days') { # ignoring calendar >+ my $timedue = time + ($loanlength) * 86400; >+ #FIXME - assumes now even though we take a startdate >+ my @datearr = localtime($timedue); >+ $datedue = C4::Dates->new( sprintf("%04d-%02d-%02d", 1900 + $datearr[5], $datearr[4] + 1, $datearr[3]), 'iso'); >+ } else { >+ my $calendar = C4::Calendar->new( branchcode => $branch ); >+ $datedue = $calendar->addDate($startdate, $loanlength); >+ } > } > > # if Hard Due Dates are used, retreive them and apply as necessary >@@ -2729,7 +2737,6 @@ sub CalcDateDue { > $datedue = C4::Dates->new( $borrower->{dateexpiry}, 'iso' ); > } > >- > return $datedue; > } > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index e521e19..1e7d42e 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -16,9 +16,9 @@ > # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR > # A PARTICULAR PURPOSE. See the GNU General Public License for more details. > # >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+# You should have received a copy of the GNU General Public License along with >+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA > > use strict; > #use warnings; FIXME - Bug 2505 >diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql >index 2e1069e..814c41c 100644 >--- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql >+++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql >@@ -137,6 +137,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > -- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc. > -- LDAP ? required fields? > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql >index 9f47292..89eb0f3 100644 >--- a/installer/data/mysql/en/mandatory/sysprefs.sql >+++ b/installer/data/mysql/en/mandatory/sysprefs.sql >@@ -138,6 +138,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > -- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc. > -- LDAP ? required fields? > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >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 c58f69c..69b7897 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 >@@ -139,6 +139,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ThingISBN',0,'Utilisé avec ''FRBRizeEditions''. Si activé, Koha utilisera le service ''ThingISBN'' dans l''onglet supplémentaire de la page de détail de notice.','','YesNo'); > > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'Si activé, permet le système de prêt auto-controlé à partir de l''opac (/cgi-bin/koha/sco/sco-main.pl',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Spécifie le nombre maximum de réponses à afficher sur les pages de résultats',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Spécifie le nombre maximum de réponses à afficher sur les pages de résultats',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Spécifie le champ utilisé par défaut pour le tri','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql >index 3c3d3c8..5072b89 100644 >--- a/installer/data/mysql/it-IT/necessari/sysprefs.sql >+++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql >@@ -210,6 +210,9 @@ insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, > --- > --- Add from eng > --- >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AcqCreateItem','cataloguing','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'); > 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 ('AllowHoldDateInFuture','0','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','','YesNo'); >diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >index 70ad079..6fa4b2a 100644 >--- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >+++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql >@@ -136,6 +136,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > -- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc. > -- LDAP ? required fields? > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >index 448e617..8def7a4 100644 >--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql >@@ -165,6 +165,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > -- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc. > -- LDAP ? required fields? > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >index f8b1ea0..1d2161e 100644 >--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql >@@ -164,6 +164,9 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > -- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc. > -- LDAP ? required fields? > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index f2d6776..fca7bc1 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4166,6 +4166,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = '3.03.00.XXX'; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer')"); >+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo')"); >+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea')"); >+ print "Upgrade to $DBversion done ( Add Self-checkout by Login system preferences )\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 6670dee..9e74e4a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -321,6 +321,28 @@ Circulation: > no: "Don't enable" > - "the web-based self checkout system. (available at: /cgi-bin/koha/sco/sco-main.pl)" > - >+ - Have patrons login into the web-based self checkout system with their >+ - pref: SelfCheckoutByLogin >+ choices: >+ yes: Username and Password >+ no: Barcode >+ - >+ - "Time out the current patron's web-based self checkout system login after" >+ - pref: SelfCheckTimeout >+ class: integer >+ - seconds. >+ - >+ - pref: AllowSelfCheckReturns >+ choices: >+ yes: Allow >+ no: "Don't allow" >+ - patrons to return items through web-based self checkout system. >+ - >+ - "Include the following HTML in the Help page of the web-based self checkout system:" >+ - pref: SelfCheckHelpMessage >+ type: textarea >+ class: code >+ - > - pref: AutoSelfCheckAllowed > choices: > yes: Allow >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl >index 5af86f9..1f56727 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl >@@ -12,12 +12,19 @@ > > <h1>Self Checkout Help</h1> > >+<!-- TMPL_IF NAME="SelfCheckHelpMessage" --> >+<div id="selfcheckhelpmessage"> >+<!-- TMPL_VAR NAME="SelfCheckHelpMessage" --> >+</div> >+<!-- /TMPL_IF --> >+ > <p>If this is your first time using the self checkout system, or if the system > is not behaving as expected, you may want to refer to this guide to get > yourself started.</p> > >-<h3>Step One: Enter your user id</h3> >-<p>Enter your User ID, and click the submit button (or press the enter key).</p> >+<h3>Step One: Enter your user id<!-- TMPL_IF name="SelfCheckoutByLogin" --> and password<!-- /TMPL_IF --></h3> >+<p>Enter your User ID<!-- TMPL_IF name="SelfCheckoutByLogin" --> and password<!-- /TMPL_IF -->, and click the >+submit button (or press the enter key).</p> > > <h3>Step Two: Scan the barcode for each item, one at a time</h3> > <p>Scan each item and wait for the page to reload before scanning the next item. >@@ -25,6 +32,8 @@ The checked-out item should appear in your checkouts list. > The Submit button only needs to be clicked if you enter the barcode manually.</p> > > <h3>Step Three: Click the 'Finish' button</h3> >+<p>If you do not click the 'Finish' button, your session will automatically expire in >+<!-- TMPL_VAR name="SelfCheckTimeout" --> seconds.</p> > > <div class="button"> > <a href="javascript:history.go(-1)">Return to the Self-Checkout</a> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl >index bf5b33d..bb260e2 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl >@@ -7,7 +7,7 @@ > <script type="text/javascript">//<![CDATA[ > function sco_init(valid_session) { > if (valid_session == 1) { >- setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",120000); // TODO: syspref for timeout >+ setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",<!-- TMPL_VAR name="SelfCheckTimeout" -->); > } > } > function dofocus() { // named function req'd for body onload event by some FF and IE7 security models >@@ -110,15 +110,17 @@ $(document).ready(function() { > <input type="hidden" name="op" value="login" /> > <input type="hidden" name="patronid" value="<!-- TMPL_VAR NAME="patronid" -->" /> > <!-- TMPL_IF NAME="returnitem" --> >+<!-- TMPL_IF NAME="AllowSelfCheckReturns" --> > <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" /> > <input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();" /> > <!-- /TMPL_IF --> >+<!-- /TMPL_IF --> > <input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" /> > </form> > <!-- /TMPL_IF --> > <!-- TMPL_IF NAME="confirm" --><!-- We need to confirm the issue.. --> > <div class="dialog alert"><h3>Please confirm the checkout:</h3> >-<p><!-- TMPL_IF NAME="confirm_renew_issue" -->This item is already checked out to you. Return it?<!-- /TMPL_IF --></p> >+<p><!-- TMPL_IF NAME="confirm_renew_issue" -->This item is already checked out to you.<!-- /TMPL_IF --></p> > > <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post"> > <input type="hidden" name="op" value="checkout" /> >@@ -126,8 +128,10 @@ $(document).ready(function() { > <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" /> > <input type="hidden" name="confirmed" value="" /> > <!-- TMPL_IF NAME="renew" --> >+<!-- TMPL_IF NAME="AllowSelfCheckReturns" --> > <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();" /> > <!-- /TMPL_IF --> >+<!-- /TMPL_IF --> > <input type="button" value="Renew Item" <!-- TMPL_UNLESS NAME="renew" --> name="confirm"<!-- /TMPL_UNLESS --> class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" /> > <input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;" /> > </form> >@@ -175,7 +179,7 @@ Sorry, This Self-Checkout Station has lost authentication. Please contact the a > <!-- TMPL_IF NAME="validuser" --> > <div id="newcheckout" class="sco_entry"> > <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('<!-- TMPL_VAR NAME='patronid' -->');"> >- <fieldset><legend> Check out or return an item: </legend> >+ <fieldset><legend> Check out<!--TMPL_IF NAME="AllowSelfCheckReturns" -->, return<!--/TMPL_IF --> or renew an item: </legend> > <label for="barcode">Scan a new item or enter its barcode:</label> > <input id="barcode" name="barcode" size="20" class="focus" /> > <input type="hidden" name="op" value="checkout" /> >@@ -209,7 +213,11 @@ Sorry, This Self-Checkout Station has lost authentication. Please contact the a > <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" /> > <input type="hidden" name="confirmed" value="" /> > <!-- TMPL_IF NAME="norenew" --> >- <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();" /> >+ <!-- TMPL_IF NAME="AllowSelfCheckReturns" --> >+ <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();" /> >+ <!-- TMPL_ELSE --> >+ <span>No renewals allowed</span> >+ <!-- /TMPL_IF --> > <!-- TMPL_ELSE --> > <input type="button" value="Renew Item" <!-- TMPL_UNLESS NAME="renew" --> name="confirm"<!-- /TMPL_UNLESS --> class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" /> > <!-- /TMPL_IF --> >@@ -227,8 +235,17 @@ Sorry, This Self-Checkout Station has lost authentication. Please contact the a > <!-- TMPL_ELSE --><!-- not validuser --> > <div class="sco_entry" > > <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post"> >+ <!-- TMPL_IF NAME="authbylogin" --> >+ <fieldset class="checkout"> >+ <legend>Please login with your username and password</legend> >+ <label for="patronlogin">Username:</label> >+ <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" /> >+ <label for="patronpw">Password:</label> >+ <input type="password" id="patronpw" size="20" name="patronpw" /> >+ <!-- TMPL_ELSE --> > <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> > <input type="text" id="patronid" class="focus" size="20" name="patronid" /> >+ <!-- /TMPL_IF --> > > <!-- TMPL_LOOP NAME="INPUTS" --><input type="hidden" name="<!-- TMPL_VAR ESCAPE=HTML NAME="name" -->" value="<!-- TMPL_VAR ESCAPE=HTML NAME="value" -->"><!-- /TMPL_LOOP --> > <input type="hidden" name="op" value="login" /> >diff --git a/opac/sco/help.pl b/opac/sco/help.pl >index b2cbd00..fbc182d 100755 >--- a/opac/sco/help.pl >+++ b/opac/sco/help.pl >@@ -22,5 +22,19 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ > flagsrequired => {circulate => "circulate_remaining_permissions"}, > }); > >+if (C4::Context->preference('SelfCheckoutByLogin')) { >+ $template->param(SelfCheckoutByLogin => 1); >+} >+my $selfchecktimeout = 120; >+if (C4::Context->preference('SelfCheckTimeout')) { >+ $selfchecktimeout = C4::Context->preference('SelfCheckTimeout'); >+} >+ >+$template->param(SelfCheckTimeout => $selfchecktimeout); >+ >+if (C4::Context->preference('SelfCheckHelpMessage')) { >+ $template->param(SelfCheckHelpMessage => C4::Context->preference('SelfCheckHelpMessage')); >+} >+ > output_html_with_http_headers $query, $cookie, $template->output; > >diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl >index 9895892..b36ff64 100755 >--- a/opac/sco/sco-main.pl >+++ b/opac/sco/sco-main.pl >@@ -18,8 +18,9 @@ use strict; > use warnings; > > use CGI; >+use Digest::MD5 qw(md5_base64); > >-use C4::Auth; >+use C4::Auth qw(get_template_and_user checkpw); > use C4::Koha; > use C4::Dates qw/format_date/; > use C4::Circulation; >@@ -54,35 +55,60 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ > type => "opac", > debug => 1, > }); >+if (C4::Context->preference('SelfCheckoutByLogin')) >+{ >+ $template->param(authbylogin => 1); >+} >+ >+# Get the self checkout timeout preference, or use 120 seconds as a default >+my $selfchecktimeout = 120000; >+if (C4::Context->preference('SelfCheckTimeout')) { >+ $selfchecktimeout = C4::Context->preference('SelfCheckTimeout') * 1000; >+} >+$template->param(SelfCheckTimeout => $selfchecktimeout); >+ >+# Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined >+my $allowselfcheckreturns = 1; >+if (defined C4::Context->preference('AllowSelfCheckReturns')) { >+ $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns'); >+} >+$template->param(AllowSelfCheckReturns => $allowselfcheckreturns); >+ > > my $issuerid = $loggedinuser; >-my ($op, $patronid, $barcode, $confirmed, $timedout) = ( >+my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $timedout) = ( > $query->param("op") || '', > $query->param("patronid") || '', >+ $query->param("patronlogin")|| '', >+ $query->param("patronpw") || '', > $query->param("barcode") || '', > $query->param("confirmed") || '', > $query->param("timedout") || '', #not actually using this... > ); > >-my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you. Return it?", ); > my $issuenoconfirm = 1; #don't need to confirm on issue. > #warn "issuerid: " . $issuerid; > my $issuer = GetMemberDetails($issuerid); > my $item = GetItem(undef,$barcode); >+if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) { >+ my $dbh = C4::Context->dbh; >+ my $resval, $patronid = checkpw($dbh, $patronlogin, $patronpw); >+} > my $borrower = GetMemberDetails(undef,$patronid); > >+ > my $branch = $issuer->{branchcode}; > my $confirm_required = 0; > my $return_only = 0; > #warn "issuer cardnumber: " . $issuer->{cardnumber}; > #warn "patron cardnumber: " . $borrower->{cardnumber}; > if ($op eq "logout") { >- $query->param( patronid => undef ); >+ $query->param( patronid => undef, patronlogin => undef, patronpw => undef ); > } >-elsif ( $op eq "returnbook" ) { >+elsif ( $op eq "returnbook" && $allowselfcheckreturns ) { > my ($doreturn) = AddReturn( $barcode, $branch ); > #warn "returnbook: " . $doreturn; >- $borrower = GetMemberDetails( undef, $patronid ); # update borrower >+ $borrower = GetMemberDetails(undef,$patronid); > } > elsif ( $op eq "checkout" ) { > my $impossible = {}; >@@ -180,6 +206,8 @@ if ($borrower->{cardnumber}) { > issues_count => scalar(@issues), > ISSUES => \@issues, > patronid => $patronid, >+ patronlogin => $patronlogin, >+ patronpw => $patronpw, > noitemlinks => 1 , > ); > my $inputfocus = ($return_only == 1) ? 'returnbook' : >-- >1.5.6.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5578
: 3543