View | Details | Raw Unified | Return to bug 5578
Collapse All | Expand All

(-)a/C4/Circulation.pm (-11 / +18 lines)
Lines 14-22 package C4::Circulation; Link Here
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
16
#
17
# You should have received a copy of the GNU General Public License along
17
# You should have received a copy of the GNU General Public License along with
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
# Suite 330, Boston, MA  02111-1307 USA
20
20
21
21
22
use strict;
22
use strict;
Lines 2691-2696 C<$startdate> = C4::Dates object representing start date of loan period (assum Link Here
2691
C<$itemtype>  = itemtype code of item in question
2691
C<$itemtype>  = itemtype code of item in question
2692
C<$branch>  = location whose calendar to use
2692
C<$branch>  = location whose calendar to use
2693
C<$borrower> = Borrower object
2693
C<$borrower> = Borrower object
2694
2694
=cut
2695
=cut
2695
2696
2696
sub CalcDateDue { 
2697
sub CalcDateDue { 
Lines 2698-2711 sub CalcDateDue { Link Here
2698
	my $datedue;
2699
	my $datedue;
2699
        my $loanlength = GetLoanLength($borrower->{'categorycode'},$itemtype, $branch);
2700
        my $loanlength = GetLoanLength($borrower->{'categorycode'},$itemtype, $branch);
2700
2701
2701
	if(C4::Context->preference('useDaysMode') eq 'Days') {  # ignoring calendar
2702
	# if globalDueDate ON the datedue is set to that date
2702
		my $timedue = time + ($loanlength) * 86400;
2703
	if ( C4::Context->preference('globalDueDate')
2703
	#FIXME - assumes now even though we take a startdate 
2704
             && ( C4::Context->preference('globalDueDate') =~ C4::Dates->regexp('syspref') ) ) {
2704
		my @datearr  = localtime($timedue);
2705
            $datedue = C4::Dates->new( C4::Context->preference('globalDueDate') );
2705
		$datedue = C4::Dates->new( sprintf("%04d-%02d-%02d", 1900 + $datearr[5], $datearr[4] + 1, $datearr[3]), 'iso');
2706
	} else {
2706
	} else {
2707
		my $calendar = C4::Calendar->new(  branchcode => $branch );
2707
	# otherwise, calculate the datedue as normal
2708
		$datedue = $calendar->addDate($startdate, $loanlength);
2708
		if(C4::Context->preference('useDaysMode') eq 'Days') {  # ignoring calendar
2709
			my $timedue = time + ($loanlength) * 86400;
2710
		#FIXME - assumes now even though we take a startdate 
2711
			my @datearr  = localtime($timedue);
2712
			$datedue = C4::Dates->new( sprintf("%04d-%02d-%02d", 1900 + $datearr[5], $datearr[4] + 1, $datearr[3]), 'iso');
2713
		} else {
2714
			my $calendar = C4::Calendar->new(  branchcode => $branch );
2715
			$datedue = $calendar->addDate($startdate, $loanlength);
2716
		}
2709
	}
2717
	}
2710
2718
2711
	# if Hard Due Dates are used, retreive them and apply as necessary
2719
	# if Hard Due Dates are used, retreive them and apply as necessary
Lines 2729-2735 sub CalcDateDue { Link Here
2729
	    $datedue = C4::Dates->new( $borrower->{dateexpiry}, 'iso' );
2737
	    $datedue = C4::Dates->new( $borrower->{dateexpiry}, 'iso' );
2730
	}
2738
	}
2731
2739
2732
2733
	return $datedue;
2740
	return $datedue;
2734
}
2741
}
2735
2742
(-)a/circ/circulation.pl (-3 / +3 lines)
Lines 16-24 Link Here
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18
#
18
#
19
# You should have received a copy of the GNU General Public License along
19
# You should have received a copy of the GNU General Public License along with
20
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Suite 330, Boston, MA  02111-1307 USA
22
22
23
use strict;
23
use strict;
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
(-)a/installer/data/mysql/de-DE/mandatory/sysprefs.sql (+3 lines)
Lines 137-142 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
137
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
137
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
138
-- LDAP ? required fields?
138
-- LDAP ? required fields?
139
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
139
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
140
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');
141
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
142
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');
140
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');
143
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');
141
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');
144
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');
142
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');
145
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');
(-)a/installer/data/mysql/en/mandatory/sysprefs.sql (+3 lines)
Lines 138-143 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
138
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
138
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
139
-- LDAP ? required fields?
139
-- LDAP ? required fields?
140
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
140
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
141
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');
142
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
143
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');
141
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');
144
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');
142
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');
145
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');
143
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');
146
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');
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql (+3 lines)
Lines 139-144 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
139
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');
139
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');
140
140
141
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');
141
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');
142
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');
143
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
144
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');
142
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');
145
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');
143
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');
146
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');
144
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');
147
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');
(-)a/installer/data/mysql/it-IT/necessari/sysprefs.sql (+3 lines)
Lines 210-215 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, Link Here
210
---
210
---
211
--- Add from eng
211
--- Add from eng
212
---
212
---
213
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');
214
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
215
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');
213
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');
216
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');
214
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
217
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','YesNo');
215
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');
218
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');
(-)a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql (+3 lines)
Lines 136-141 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
136
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
136
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
137
-- LDAP ? required fields?
137
-- LDAP ? required fields?
138
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
138
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
139
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');
140
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
141
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');
139
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');
142
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');
140
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');
143
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');
141
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');
144
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');
(-)a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql (+3 lines)
Lines 165-170 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
165
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
165
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
166
-- LDAP ? required fields?
166
-- LDAP ? required fields?
167
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
167
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
168
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');
169
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
170
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');
168
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');
171
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');
169
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');
172
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');
170
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');
173
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');
(-)a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql (+3 lines)
Lines 164-169 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
164
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
164
-- need AddressType to distinguish between US and other, telephone numbers, maori stuff, sex, nationality, etc.
165
-- LDAP ? required fields?
165
-- LDAP ? required fields?
166
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
166
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
167
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');
168
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo');
169
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');
167
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');
170
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');
168
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');
171
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');
169
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');
172
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');
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 4166-4171 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4166
    SetVersion ($DBversion);
4166
    SetVersion ($DBversion);
4167
}
4167
}
4168
4168
4169
$DBversion = '3.03.00.XXX';
4170
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4171
    $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')");
4172
    $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')");
4173
    $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')");
4174
    print "Upgrade to $DBversion done ( Add Self-checkout by Login system preferences )\n";
4175
    SetVersion ($DBversion);
4176
}
4177
4169
=head1 FUNCTIONS
4178
=head1 FUNCTIONS
4170
4179
4171
=head2 DropAllForeignKeys($table)
4180
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+22 lines)
Lines 321-326 Circulation: Link Here
321
                  no: "Don't enable"
321
                  no: "Don't enable"
322
            - "the web-based self checkout system. (available at: /cgi-bin/koha/sco/sco-main.pl)"
322
            - "the web-based self checkout system. (available at: /cgi-bin/koha/sco/sco-main.pl)"
323
        -
323
        -
324
            - Have patrons login into the web-based self checkout system with their 
325
            - pref: SelfCheckoutByLogin
326
              choices:
327
                  yes: Username and Password
328
                  no: Barcode
329
        -
330
            - "Time out the current patron's web-based self checkout system login after"
331
            - pref: SelfCheckTimeout
332
              class: integer
333
            - seconds.
334
        -
335
            - pref: AllowSelfCheckReturns
336
              choices:
337
                  yes: Allow
338
                  no: "Don't allow"
339
            - patrons to return items through web-based self checkout system. 
340
        -
341
            - "Include the following HTML in the Help page of the web-based self checkout system:"
342
            - pref: SelfCheckHelpMessage
343
              type: textarea
344
              class: code
345
        -
324
            - pref: AutoSelfCheckAllowed
346
            - pref: AutoSelfCheckAllowed
325
              choices:
347
              choices:
326
                  yes: Allow
348
                  yes: Allow
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/sco/help.tmpl (-2 / +11 lines)
Lines 12-23 Link Here
12
12
13
<h1>Self Checkout Help</h1>
13
<h1>Self Checkout Help</h1>
14
14
15
<!-- TMPL_IF NAME="SelfCheckHelpMessage" -->
16
<div id="selfcheckhelpmessage">
17
<!-- TMPL_VAR NAME="SelfCheckHelpMessage" -->
18
</div>
19
<!-- /TMPL_IF -->
20
15
<p>If this is your first time using the self checkout system, or if the system
21
<p>If this is your first time using the self checkout system, or if the system
16
is not behaving as expected, you may want to refer to this guide to get
22
is not behaving as expected, you may want to refer to this guide to get
17
yourself started.</p>
23
yourself started.</p>
18
24
19
<h3>Step One: Enter your user id</h3>
25
<h3>Step One: Enter your user id<!-- TMPL_IF name="SelfCheckoutByLogin" --> and password<!-- /TMPL_IF --></h3>
20
<p>Enter your User ID, and click the submit button (or press the enter key).</p>
26
<p>Enter your User ID<!-- TMPL_IF name="SelfCheckoutByLogin" --> and password<!-- /TMPL_IF -->, and click the 
27
submit button (or press the enter key).</p>
21
28
22
<h3>Step Two: Scan the barcode for each item, one at a time</h3>
29
<h3>Step Two: Scan the barcode for each item, one at a time</h3>
23
<p>Scan each item and wait for the page to reload before scanning the next item.
30
<p>Scan each item and wait for the page to reload before scanning the next item.
Lines 25-30 The checked-out item should appear in your checkouts list. Link Here
25
The Submit button only needs to be clicked if you enter the barcode manually.</p>
32
The Submit button only needs to be clicked if you enter the barcode manually.</p>
26
33
27
<h3>Step Three: Click the 'Finish' button</h3>
34
<h3>Step Three: Click the 'Finish' button</h3>
35
<p>If you do not click the 'Finish' button, your session will automatically expire in
36
<!-- TMPL_VAR name="SelfCheckTimeout" --> seconds.</p>
28
37
29
    <div class="button">
38
    <div class="button">
30
        <a href="javascript:history.go(-1)">Return to the Self-Checkout</a>
39
        <a href="javascript:history.go(-1)">Return to the Self-Checkout</a>
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl (-4 / +21 lines)
Lines 7-13 Link Here
7
<script type="text/javascript">//<![CDATA[
7
<script type="text/javascript">//<![CDATA[
8
function sco_init(valid_session) {
8
function sco_init(valid_session) {
9
    if (valid_session == 1) {
9
    if (valid_session == 1) {
10
        setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",120000); // TODO: syspref for timeout
10
        setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",<!-- TMPL_VAR name="SelfCheckTimeout" -->); 
11
    }
11
    }
12
}
12
}
13
function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
13
function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
Lines 110-124 $(document).ready(function() { Link Here
110
<input type="hidden" name="op" value="login" />
110
<input type="hidden" name="op" value="login" />
111
<input type="hidden" name="patronid" value="<!-- TMPL_VAR NAME="patronid" -->" />
111
<input type="hidden" name="patronid" value="<!-- TMPL_VAR NAME="patronid" -->" />
112
<!-- TMPL_IF NAME="returnitem" -->
112
<!-- TMPL_IF NAME="returnitem" -->
113
<!-- TMPL_IF NAME="AllowSelfCheckReturns" -->
113
<input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
114
<input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
114
<input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
115
<input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
115
<!-- /TMPL_IF -->
116
<!-- /TMPL_IF -->
117
<!-- /TMPL_IF -->
116
<input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
118
<input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
117
</form>
119
</form>
118
<!-- /TMPL_IF -->
120
<!-- /TMPL_IF -->
119
<!-- TMPL_IF NAME="confirm" --><!-- We need to confirm the issue.. -->
121
<!-- TMPL_IF NAME="confirm" --><!-- We need to confirm the issue.. -->
120
<div class="dialog alert"><h3>Please confirm the checkout:</h3>
122
<div class="dialog alert"><h3>Please confirm the checkout:</h3>
121
<p><!-- TMPL_IF NAME="confirm_renew_issue" -->This item is already checked out to you.  Return it?<!-- /TMPL_IF --></p>
123
<p><!-- TMPL_IF NAME="confirm_renew_issue" -->This item is already checked out to you.<!-- /TMPL_IF --></p>
122
124
123
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
125
<form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
124
<input type="hidden" name="op" value="checkout" />
126
<input type="hidden" name="op" value="checkout" />
Lines 126-133 $(document).ready(function() { Link Here
126
<input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
128
<input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
127
<input type="hidden" name="confirmed" value="" />
129
<input type="hidden" name="confirmed" value="" />
128
<!-- TMPL_IF NAME="renew" -->
130
<!-- TMPL_IF NAME="renew" -->
131
<!-- TMPL_IF NAME="AllowSelfCheckReturns" -->
129
<input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
132
<input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
130
<!-- /TMPL_IF -->
133
<!-- /TMPL_IF -->
134
<!-- /TMPL_IF -->
131
<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();" />
135
<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();" />
132
<input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
136
<input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
133
</form>
137
</form>
Lines 175-181 Sorry, This Self-Checkout Station has lost authentication. Please contact the a Link Here
175
	<!-- TMPL_IF NAME="validuser" -->
179
	<!-- TMPL_IF NAME="validuser" -->
176
	<div id="newcheckout" class="sco_entry">
180
	<div id="newcheckout" class="sco_entry">
177
	<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' -->');">
181
	<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' -->');">
178
	<fieldset><legend> Check out or return an item: </legend>
182
	<fieldset><legend> Check out<!--TMPL_IF NAME="AllowSelfCheckReturns" -->, return<!--/TMPL_IF --> or renew an item: </legend>
179
	<label for="barcode">Scan a new item or enter its barcode:</label>
183
	<label for="barcode">Scan a new item or enter its barcode:</label>
180
	<input id="barcode" name="barcode" size="20" class="focus" />
184
	<input id="barcode" name="barcode" size="20" class="focus" />
181
	<input type="hidden" name="op" value="checkout" />
185
	<input type="hidden" name="op" value="checkout" />
Lines 209-215 Sorry, This Self-Checkout Station has lost authentication. Please contact the a Link Here
209
    <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
213
    <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
210
    <input type="hidden" name="confirmed" value=""  />
214
    <input type="hidden" name="confirmed" value=""  />
211
        <!-- TMPL_IF NAME="norenew" -->
215
        <!-- TMPL_IF NAME="norenew" -->
212
        <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
216
          <!-- TMPL_IF NAME="AllowSelfCheckReturns" -->
217
          <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
218
          <!-- TMPL_ELSE -->
219
          <span>No renewals allowed</span>
220
          <!-- /TMPL_IF -->
213
        <!-- TMPL_ELSE  -->
221
        <!-- TMPL_ELSE  -->
214
        <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();" />
222
        <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();" />
215
        <!-- /TMPL_IF -->
223
        <!-- /TMPL_IF -->
Lines 227-234 Sorry, This Self-Checkout Station has lost authentication. Please contact the a Link Here
227
	<!-- TMPL_ELSE --><!-- not validuser -->
235
	<!-- TMPL_ELSE --><!-- not validuser -->
228
	<div class="sco_entry" >
236
	<div class="sco_entry" >
229
	<form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
237
	<form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
238
       <!-- TMPL_IF NAME="authbylogin" -->
239
	<fieldset class="checkout">
240
       <legend>Please login with your username and password</legend>
241
       <label for="patronlogin">Username:</label>
242
	<input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
243
       <label for="patronpw">Password:</label>
244
	<input type="password" id="patronpw" size="20" name="patronpw" />
245
       <!-- TMPL_ELSE -->
230
	<fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
246
	<fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
231
	<input type="text" id="patronid" class="focus" size="20" name="patronid" />
247
	<input type="text" id="patronid" class="focus" size="20" name="patronid" />
248
	<!-- /TMPL_IF -->
232
249
233
 	<!-- TMPL_LOOP NAME="INPUTS" --><input type="hidden" name="<!-- TMPL_VAR ESCAPE=HTML NAME="name" -->" value="<!-- TMPL_VAR ESCAPE=HTML NAME="value" -->"><!-- /TMPL_LOOP -->
250
 	<!-- TMPL_LOOP NAME="INPUTS" --><input type="hidden" name="<!-- TMPL_VAR ESCAPE=HTML NAME="name" -->" value="<!-- TMPL_VAR ESCAPE=HTML NAME="value" -->"><!-- /TMPL_LOOP -->
234
	<input type="hidden" name="op" value="login" />
251
	<input type="hidden" name="op" value="login" />
(-)a/opac/sco/help.pl (+14 lines)
Lines 22-26 my ($template, $borrowernumber, $cookie) = get_template_and_user({ Link Here
22
      flagsrequired => {circulate => "circulate_remaining_permissions"},
22
      flagsrequired => {circulate => "circulate_remaining_permissions"},
23
});
23
});
24
24
25
if (C4::Context->preference('SelfCheckoutByLogin')) {
26
    $template->param(SelfCheckoutByLogin => 1);
27
}
28
my $selfchecktimeout = 120;
29
if (C4::Context->preference('SelfCheckTimeout')) {
30
   $selfchecktimeout = C4::Context->preference('SelfCheckTimeout');
31
}
32
33
$template->param(SelfCheckTimeout => $selfchecktimeout);
34
35
if (C4::Context->preference('SelfCheckHelpMessage')) {
36
    $template->param(SelfCheckHelpMessage => C4::Context->preference('SelfCheckHelpMessage'));
37
}
38
25
output_html_with_http_headers $query, $cookie, $template->output;
39
output_html_with_http_headers $query, $cookie, $template->output;
26
40
(-)a/opac/sco/sco-main.pl (-7 / +34 lines)
Lines 18-25 use strict; Link Here
18
use warnings;
18
use warnings;
19
19
20
use CGI;
20
use CGI;
21
use Digest::MD5 qw(md5_base64);
21
22
22
use C4::Auth;
23
use C4::Auth qw(get_template_and_user checkpw);
23
use C4::Koha;
24
use C4::Koha;
24
use C4::Dates qw/format_date/;
25
use C4::Dates qw/format_date/;
25
use C4::Circulation;
26
use C4::Circulation;
Lines 54-88 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
54
    type  => "opac",
55
    type  => "opac",
55
    debug => 1,
56
    debug => 1,
56
});
57
});
58
if (C4::Context->preference('SelfCheckoutByLogin'))
59
{
60
    $template->param(authbylogin  => 1);
61
}
62
63
# Get the self checkout timeout preference, or use 120 seconds as a default
64
my $selfchecktimeout = 120000;
65
if (C4::Context->preference('SelfCheckTimeout')) { 
66
    $selfchecktimeout = C4::Context->preference('SelfCheckTimeout') * 1000;
67
}
68
$template->param(SelfCheckTimeout => $selfchecktimeout);
69
70
# Checks policy laid out by AllowSelfCheckReturns, defaults to 'on' if preference is undefined
71
my $allowselfcheckreturns = 1;
72
if (defined C4::Context->preference('AllowSelfCheckReturns')) {
73
    $allowselfcheckreturns = C4::Context->preference('AllowSelfCheckReturns');
74
}
75
$template->param(AllowSelfCheckReturns => $allowselfcheckreturns);
76
57
77
58
my $issuerid = $loggedinuser;
78
my $issuerid = $loggedinuser;
59
my ($op, $patronid, $barcode, $confirmed, $timedout) = (
79
my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $timedout) = (
60
    $query->param("op")         || '',
80
    $query->param("op")         || '',
61
    $query->param("patronid")   || '',
81
    $query->param("patronid")   || '',
82
    $query->param("patronlogin")|| '',
83
    $query->param("patronpw")   || '',
62
    $query->param("barcode")    || '',
84
    $query->param("barcode")    || '',
63
    $query->param("confirmed")  || '',
85
    $query->param("confirmed")  || '',
64
    $query->param("timedout")   || '', #not actually using this...
86
    $query->param("timedout")   || '', #not actually using this...
65
);
87
);
66
88
67
my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you.  Return it?", );
68
my $issuenoconfirm = 1; #don't need to confirm on issue.
89
my $issuenoconfirm = 1; #don't need to confirm on issue.
69
#warn "issuerid: " . $issuerid;
90
#warn "issuerid: " . $issuerid;
70
my $issuer   = GetMemberDetails($issuerid);
91
my $issuer   = GetMemberDetails($issuerid);
71
my $item     = GetItem(undef,$barcode);
92
my $item     = GetItem(undef,$barcode);
93
if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
94
    my $dbh = C4::Context->dbh;
95
    my $resval, $patronid = checkpw($dbh, $patronlogin, $patronpw);
96
}
72
my $borrower = GetMemberDetails(undef,$patronid);
97
my $borrower = GetMemberDetails(undef,$patronid);
73
98
99
74
my $branch = $issuer->{branchcode};
100
my $branch = $issuer->{branchcode};
75
my $confirm_required = 0;
101
my $confirm_required = 0;
76
my $return_only = 0;
102
my $return_only = 0;
77
#warn "issuer cardnumber: " .   $issuer->{cardnumber};
103
#warn "issuer cardnumber: " .   $issuer->{cardnumber};
78
#warn "patron cardnumber: " . $borrower->{cardnumber};
104
#warn "patron cardnumber: " . $borrower->{cardnumber};
79
if ($op eq "logout") {
105
if ($op eq "logout") {
80
    $query->param( patronid => undef );
106
    $query->param( patronid => undef, patronlogin => undef, patronpw => undef );
81
}
107
}
82
elsif ( $op eq "returnbook" ) {
108
elsif ( $op eq "returnbook" && $allowselfcheckreturns ) {
83
    my ($doreturn) = AddReturn( $barcode, $branch );
109
    my ($doreturn) = AddReturn( $barcode, $branch );
84
    #warn "returnbook: " . $doreturn;
110
    #warn "returnbook: " . $doreturn;
85
    $borrower = GetMemberDetails( undef, $patronid );   # update borrower
111
    $borrower = GetMemberDetails(undef,$patronid);
86
}
112
}
87
elsif ( $op eq "checkout" ) {
113
elsif ( $op eq "checkout" ) {
88
    my $impossible  = {};
114
    my $impossible  = {};
Lines 180-185 if ($borrower->{cardnumber}) { Link Here
180
        issues_count => scalar(@issues),
206
        issues_count => scalar(@issues),
181
        ISSUES => \@issues,
207
        ISSUES => \@issues,
182
        patronid => $patronid,
208
        patronid => $patronid,
209
        patronlogin => $patronlogin,
210
        patronpw => $patronpw,
183
        noitemlinks => 1 ,
211
        noitemlinks => 1 ,
184
    );
212
    );
185
    my $inputfocus = ($return_only      == 1) ? 'returnbook' :
213
    my $inputfocus = ($return_only      == 1) ? 'returnbook' :
186
- 

Return to bug 5578