From: Ian Walls To: dev@bywatersolutions.com Cc: Ian Walls 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: X-Google-Group-Id: 274270250429 List-Help: , 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 @@

Self Checkout Help

+ +
+ +
+ +

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.

-

Step One: Enter your user id

-

Enter your User ID, and click the submit button (or press the enter key).

+

Step One: Enter your user id and password

+

Enter your User ID and password, and click the +submit button (or press the enter key).

Step Two: Scan the barcode for each item, one at a time

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.

Step Three: Click the 'Finish' button

+

If you do not click the 'Finish' button, your session will automatically expire in + seconds.

Return to the Self-Checkout 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 @@