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

(-)a/installer/data/mysql/atomicupdate/bug_30444-edit_SelfCheckoutByLogin_syspref.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30444",
5
    description => "Edit existing system preference SelfCheckoutByLogin",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        # Update existing values
11
	$dbh->do(q{UPDATE systempreferences SET value = 'cardnumber' WHERE variable = "SelfCheckoutByLogin" AND value = 0});
12
        $dbh->do(q{UPDATE systempreferences SET value = 'username' WHERE variable = "SelfCheckoutByLogin" AND value = 1});
13
14
        $dbh->do(q{UPDATE systempreferences SET explanation = "Have patrons login into the web-based self checkout system with their username/password, their cardnumber, or using shibboleth" WHERE variable = "SelfCheckoutByLogin"});
15
    },
16
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 606-612 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
606
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
606
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
607
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
607
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
608
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
608
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
609
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
609
('SelfCheckoutByLogin','username','username|cardnumber|shibboleth','Have patrons login into the web-based self checkout system with their username/password, their cardnumber, or using shibboleth','Choice'),
610
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
610
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
611
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
611
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
612
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
612
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
(-)a/opac/sco/sco-main.pl (-5 / +20 lines)
Lines 33-38 use Modern::Perl; Link Here
33
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
34
34
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
36
use C4::Auth_with_shibboleth;
36
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Reserves;
38
use C4::Reserves;
38
use C4::Output qw( output_html_with_http_headers );
39
use C4::Output qw( output_html_with_http_headers );
Lines 117-124 my $issuer = Koha::Patrons->find( $issuerid )->unblessed; Link Here
117
118
118
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
unless ( $patronid ) {
120
unless ( $patronid ) {
120
    if ( C4::Context->preference('SelfCheckoutByLogin') ) {
121
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
121
        my $dbh = C4::Context->dbh;
122
	# Do Shibboleth login 
123
	my ($shib, $shib_login, $patron, $value);
124
        $shib = C4::Context->config('useshibboleth') && shib_ok();     
125
        $shib_login = $shib ? get_login_shib() : undef;
126
        $patron = Koha::Patrons->find({ email => $shib_login }) if $shib_login;
127
        if ($patron) {
128
           $patronid = $patron->userid;
129
        } else {
130
          undef $patronid;
131
        }
132
    } elsif ( C4::Context->preference('SelfCheckoutByLogin') eq 'username' ) {
133
    	my $dbh = C4::Context->dbh;
122
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
134
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
123
    }
135
    }
124
    else {    # People should not do that unless they know what they are doing!
136
    else {    # People should not do that unless they know what they are doing!
Lines 130-137 unless ( $patronid ) { Link Here
130
142
131
my $patron;
143
my $patron;
132
if ( $patronid ) {
144
if ( $patronid ) {
133
    Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
145
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
134
    $patron = Koha::Patrons->find( { cardnumber => $patronid } );
146
    	$patron = Koha::Patrons->find( { userid => $patronid } );
147
    } else {
148
    	Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
149
    	$patron = Koha::Patrons->find( { cardnumber => $patronid } );
150
    }
135
}
151
}
136
152
137
undef $jwt unless $patron;
153
undef $jwt unless $patron;
138
- 

Return to bug 30444