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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead-sco-self.inc (+35 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
3
<!-- <div id="wrap"> -->
4
    <div class="navbar navbar-inverse navbar-static-top navbar-black">
5
        <div class="navbar-inner navbar-black">
6
            <div class="container-fluid navbar-black">
7
                <a class="brand" href="/cgi-bin/koha/sco/sco-main.pl"><img src="[% interface %]/[% theme %]/images/koha-logo-navbar.png" alt=""></a>
8
                <div id="checkouthelp">
9
                    <ul class="nav pull-right">
10
                        <li><a href="/cgi-bin/koha/sco/help.pl"><i class="icon help"></i> Help</a></li>
11
                    </ul>
12
                </div>
13
14
                [% IF ( opaclanguagesdisplay ) %]
15
                    <div id="members">
16
                        <ul class="nav pull-right">
17
                            [% INCLUDE 'masthead-langmenu.inc' %]
18
                        </ul>
19
                    </div> <!-- /members -->
20
                [% END # / IF opaclanguagedisplay %]
21
22
            </div> <!-- /container-fluid -->
23
        </div> <!-- /navbar-inner -->
24
    </div> <!-- /navbar -->
25
<!-- </div> -->
26
27
    [% IF ( opacheader ) %]
28
        <div class="container-fluid">
29
            <div class="row-fluid">
30
                <div id="opacheader">
31
                   [% opacheader %]
32
                </div>
33
            </div>
34
        </div>
35
    [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/help.tt (-1 / +1 lines)
Lines 18-24 Link Here
18
[% Asset.js("lib/modernizr.min.js") | $raw %]
18
[% Asset.js("lib/modernizr.min.js") | $raw %]
19
</head>
19
</head>
20
<body id="sco_help" class="sco">
20
<body id="sco_help" class="sco">
21
    [% INCLUDE 'masthead-sco.inc' %]
21
[% INCLUDE 'masthead-sco-self.inc' %]
22
22
23
    <div class="main">
23
    <div class="main">
24
        <div class="container-fluid">
24
        <div class="container-fluid">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (-35 / +94 lines)
Lines 36-44 Link Here
36
[% Asset.js("lib/modernizr.min.js") | $raw %]
36
[% Asset.js("lib/modernizr.min.js") | $raw %]
37
</head>
37
</head>
38
<body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
38
<body id="sco_main" class="sco" onload="dofocus();" onunload="mungeHistory();">
39
    [% INCLUDE 'masthead-sco.inc' %]
39
[% INCLUDE 'masthead-sco.inc' %]
40
40
41
    <div class="main">
41
   <div class="main">
42
        <div class="container-fluid">
42
        <div class="container-fluid">
43
            <div class="row">
43
            <div class="row">
44
                [% IF ( display_patron_image ) %]
44
                [% IF ( display_patron_image ) %]
Lines 397-442 Link Here
397
                        </div>
397
                        </div>
398
                    </div>
398
                    </div>
399
                        [% ELSE # IF validuser %]
399
                        [% ELSE # IF validuser %]
400
                            <div class="sco_entry" >
400
                            <div class="sco_entry">
401
                                <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
401
                                <table>
402
                                    <fieldset>
402
                                    <tr>
403
                                        [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
403
                                        <th><h4>Check out</h4></th>
404
                                            <legend>Log in to your account</legend>
404
                                        <th><h4>Check in</h4></th>
405
                                            <label for="patronlogin">Login:</label>
405
                                    </tr>
406
                                            <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" />
406
                                    <tr>
407
                                            <label for="patronpw">Password:</label>
407
                                        <td>
408
                                            <input type="password" id="patronpw" size="20" name="patronpw" />
408
                                            <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
409
                                            <fieldset class="action">
409
                                                <fieldset>
410
                                                <button type="submit" class="btn btn-primary">Log in</button>
410
                                                    [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
411
                                            </fieldset>
411
                                                        <legend>Log in to your account</legend>
412
                                        [% ELSE %]
412
                                                        <label for="patronlogin">Login:</label>
413
                                            <div class="form-row">
413
                                                        <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" />
414
                                                <div class="col-auto">
414
                                                        <label for="patronpw">Password:</label>
415
                                                    <label for="patronid">Please enter your card number:</label>
415
                                                        <input type="password" id="patronpw" size="20" name="patronpw" />
416
                                                </div>
416
                                                        <fieldset class="action">
417
                                                <div class="col-3">
417
                                                            <button type="submit" class="btn btn-primary">Log in</button>
418
                                                    <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
418
                                                        </fieldset>
419
                                                </div>
419
                                                    [% ELSE %]
420
                                                <div class="col-auto">
420
                                                        <div class="form-row">
421
                                                    <button type="submit" class="btn btn-primary">Submit</button>
421
                                                            <div class="col-auto">
422
                                                </div>
422
                                                                <label for="patronid">Please enter your card number:</label>
423
                                            </div> <!-- /.form-row -->
423
                                                            </div>
424
                                        [% END %]
424
                                                            <div class="col-3">
425
                                                                [% IF ( checkinmessage )%]
426
                                                                    <input type="text" id="patronid" size="20" name="patronid" autocomplete="off" />
427
                                                                [% ELSE %]
428
                                                                    <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
429
                                                                [% END %]
430
                                                            </div>
431
                                                            <div class="col-auto">
432
                                                                <button type="submit" class="btn btn-primary">Submit</button>
433
                                                            </div>
434
                                                        </div> <!-- /.form-row -->
435
                                                    [% END %]
425
436
426
                                        [% FOREACH INPUT IN INPUTS %]
437
                                                    [% FOREACH INPUT IN INPUTS %]
427
                                            <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]">
438
                                                        <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]">
428
                                        [% END %]
439
                                                    [% END %]
429
                                        <input type="hidden" name="op" value="login" />
440
                                                    <input type="hidden" name="op" value="login" />
430
                                    </fieldset>
441
                                                </fieldset>
431
                                </form>
442
                                            </form>
443
                                        </td>
444
                                        <td>
445
                                            <form id="barcodeform" action="/cgi-bin/koha/sco/sco-main.pl" name="barcodeform" method="post">
446
                                                <fieldset>
447
                                                    [% IF ( !Koha.Preference('SelfCheckoutByLogin') ) %]    
448
                                                        <div class="form-row">
449
                                                            <div class="col-auto">
450
                                                                <label for="uibarcode">Please enter barcode:</label>
451
                                                            </div>
452
                                                            <div class="col-3">
453
                                                                [% IF ( checkinmessage ) %]
454
                                                                    <input type="text" id="uibarcode"  class="form-control focus" size="20" name="uibarcode" autocomplete="off" />
455
                                                                [% ELSE %]
456
                                                                    <input type="text" id="uibarcode" class="form-control" size="20" name="uibarcode" autocomplete="off" />
457
                                                                [% END %]
458
                                                            </div>
459
                                                            <div class="col-auto">
460
                                                                <button type="submit" class="btn btn-primary">Submit</button>
461
                                                            </div>
462
                                                        </div>
463
                                                    [% END # / IF SelfCheckoutByLogin %]
464
465
                                                    [% FOREACH INPUT IN INPUTS %]
466
                                                    <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">
467
                                                    [% END %]
468
                                                    <input type="hidden" name="op" value="checkin" />
469
                                                </fieldset>
470
                                            </form>
471
                                        </td>
472
                                    </tr>
473
                               </table>
432
                            </div> <!-- / .sco_entry -->
474
                            </div> <!-- / .sco_entry -->
433
                        [% END # / IF validuser %]
475
                        [% END # / IF validuser %]
434
                    [% END # / UNLESS ( hide_main %]
476
                    [% END # / UNLESS ( hide_main %]
477
                    <b>[% checkinmessage %]</b>
435
                    [% IF ( Koha.Preference('SCOMainUserBlock' ) ) %]<div id="scomainuserblock">[% Koha.Preference('SCOMainUserBlock' ) | $raw %]</div>[% END %]
478
                    [% IF ( Koha.Preference('SCOMainUserBlock' ) ) %]<div id="scomainuserblock">[% Koha.Preference('SCOMainUserBlock' ) | $raw %]</div>[% END %]
436
                </div> <!-- / .span12 -->
479
                </div> <!-- / .span12 -->
437
            </div> <!-- / .row -->
480
            </div> <!-- / .row -->
438
        </div> <!-- / .container-fluid -->
481
        </div> <!-- / .container-fluid -->
439
    </div> <!-- / .main -->
482
      </div> <!-- / .main -->
440
    <span id="audio-alert"></span>
483
    <span id="audio-alert"></span>
441
484
442
[% INCLUDE 'opac-bottom.inc' %]
485
[% INCLUDE 'opac-bottom.inc' %]
Lines 498-504 Link Here
498
541
499
        $(document).ready(function() {
542
        $(document).ready(function() {
500
            dofocus();
543
            dofocus();
501
            [% IF ( patronid ) %]sco_init();[% END %]
544
            [% IF ( patronid || uibarcode ) %]sco_init();[% END %]
502
            $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
545
            $("#loanTable").dataTable($.extend(true, {}, dataTablesDefaults, {
503
                "dom": "t",
546
                "dom": "t",
504
                "order": [ 0 ],
547
                "order": [ 0 ],
Lines 509-514 Link Here
509
                ]
552
                ]
510
            }));
553
            }));
511
554
555
512
            $("#logout_form").on("click", function(e){
556
            $("#logout_form").on("click", function(e){
513
                e.preventDefault(e);
557
                e.preventDefault(e);
514
                clearTimeout(mainTimeout);
558
                clearTimeout(mainTimeout);
Lines 525-531 Link Here
525
                [% ELSE %]
569
                [% ELSE %]
526
                    location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
570
                    location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
527
                [% END %]
571
                [% END %]
572
                return true;
573
            });
528
574
575
            $("#logout_form_vara").on("click", function() {
576
                clearTimeout(mainTimeout);
577
                [% IF Koha.Preference('SelfCheckReceiptPrompt') %]
578
                var confirmStart = Date.now();
579
                if(confirm(_("Would you like to print a receipt?"))){
580
                    if ( (Date.now() - confirmStart) < [% SelfCheckTimeout %] ) {
581
                        window.open("/cgi-bin/koha/sco/printslip.pl?borrowernumber=[% borrowernumber %]&amp;print=qslip");
582
                    }
583
                    else {
584
                        alert(_("Timeout while waiting for print confirmation"));
585
                    }
586
                }
587
                [% END %]
529
                return true;
588
                return true;
530
            });
589
            });
531
    });
590
    });
(-)a/opac/sco/sco-main.pl (-8 / +79 lines)
Lines 36-45 use Modern::Perl; Link Here
36
use CGI qw ( -utf8 );
36
use CGI qw ( -utf8 );
37
37
38
use C4::Auth qw( in_iprange get_template_and_user checkpw );
38
use C4::Auth qw( in_iprange get_template_and_user checkpw );
39
use C4::Circulation qw( AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
39
use C4::Circulation qw( AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal updateWrongTransfer );
40
use C4::Reserves;
40
use C4::Reserves qw( ModReserveAffect );
41
use C4::Output qw( output_html_with_http_headers );
41
use C4::Output qw( output_html_with_http_headers );
42
use C4::Members;
42
use C4::Members;
43
use C4::Biblio qw( GetBiblioData );
44
use C4::Items qw( ModItemTransfer );
43
use Koha::DateUtils qw( dt_from_string );
45
use Koha::DateUtils qw( dt_from_string );
44
use Koha::Acquisition::Currencies;
46
use Koha::Acquisition::Currencies;
45
use Koha::Items;
47
use Koha::Items;
Lines 47-52 use Koha::Patrons; Link Here
47
use Koha::Patron::Images;
49
use Koha::Patron::Images;
48
use Koha::Patron::Messages;
50
use Koha::Patron::Messages;
49
use Koha::Token;
51
use Koha::Token;
52
use Koha::Calendar;
50
53
51
my $query = CGI->new;
54
my $query = CGI->new;
52
55
Lines 75-83 $query->param(-name=>'sco_user_login',-values=>[1]); Link Here
75
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
78
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
76
    {
79
    {
77
        template_name   => "sco/sco-main.tt",
80
        template_name   => "sco/sco-main.tt",
81
        authnotrequired => 0,
78
        flagsrequired   => { self_check => "self_checkout_module" },
82
        flagsrequired   => { self_check => "self_checkout_module" },
79
        query           => $query,
83
        query           => $query,
80
        type            => "opac",
84
        type            => "opac",
85
        debug => 1,
81
    }
86
    }
82
);
87
);
83
88
Lines 95-101 if (defined C4::Context->preference('SCOAllowCheckin')) { Link Here
95
}
100
}
96
101
97
my $issuerid = $loggedinuser;
102
my $issuerid = $loggedinuser;
98
my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = (
103
my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $uibarcode, $checkinmessage) = (
99
    $query->param("op")         || '',
104
    $query->param("op")         || '',
100
    $query->param("patronid")   || '',
105
    $query->param("patronid")   || '',
101
    $query->param("patronlogin")|| '',
106
    $query->param("patronlogin")|| '',
Lines 103-114 my ($op, $patronid, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = Link Here
103
    $query->param("barcode")    || '',
108
    $query->param("barcode")    || '',
104
    $query->param("confirmed")  || '',
109
    $query->param("confirmed")  || '',
105
    $query->param("newissues")  || '',
110
    $query->param("newissues")  || '',
111
    $query->param("uibarcode")  || '',
112
    $query->param("checkinmessage") || undef,
106
);
113
);
107
114
108
my @newissueslist = split /,/, $newissues;
115
my @newissueslist = split /,/, $newissues;
109
my $issuenoconfirm = 1; #don't need to confirm on issue.
116
my $issuenoconfirm = 1; #don't need to confirm on issue.
110
my $issuer   = Koha::Patrons->find( $issuerid )->unblessed;
117
my $issuer   = Koha::Patrons->find( $issuerid )->unblessed;
111
my $item     = Koha::Items->find({ barcode => $barcode });
118
my $item     = Koha::Items->find({ barcode => $barcode });
119
120
my $checkinitem;
121
my $checkinbranchcode;
122
my $userenv = C4::Context->userenv;
123
my $userenv_branch = $userenv->{'branch'} // '';
124
my $daysmode = Koha::CirculationRules->get_effective_daysmode(
125
    {
126
        branchcode   => $userenv_branch,
127
    }
128
);
129
my $calendar    = Koha::Calendar->new( branchcode => $userenv_branch, days_mode => $daysmode );
130
my $today       = DateTime->now( time_zone => C4::Context->tz());
131
#my $dropboxdate = $calendar->addDays($today, -1);
132
#my $returndate = $calendar->addDays($today);
133
112
if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
134
if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
113
    my $dbh = C4::Context->dbh;
135
    my $dbh = C4::Context->dbh;
114
    my $resval;
136
    my $resval;
Lines 130-137 if ($op eq "logout") { Link Here
130
    $template->param( loggedout => 1 );
152
    $template->param( loggedout => 1 );
131
    $query->param( patronid => undef, patronlogin => undef, patronpw => undef );
153
    $query->param( patronid => undef, patronlogin => undef, patronpw => undef );
132
}
154
}
133
elsif ( $op eq "returnbook" && $allowselfcheckreturns ) {
155
elsif ( ($op eq "checkin" && $uibarcode) || $op eq "returnbook" && $allowselfcheckreturns ) {
134
    my $success        = 0;
156
    #my $success        = 0;
135
    my $human_required = 0;
157
    my $human_required = 0;
136
    if ( C4::Context->preference("CircConfirmItemParts") ) {
158
    if ( C4::Context->preference("CircConfirmItemParts") ) {
137
        my $item = Koha::Items->find( { barcode => $barcode } );
159
        my $item = Koha::Items->find( { barcode => $barcode } );
Lines 142-149 elsif ( $op eq "returnbook" && $allowselfcheckreturns ) { Link Here
142
        }
164
        }
143
    }
165
    }
144
166
145
    ($success) = AddReturn( $barcode, $branch )
167
    $uibarcode =~ s/^\s+|\s+$//g;
146
      unless $human_required;
168
    $checkinitem = Koha::Items->find({ barcode => $uibarcode });
169
    if( !$checkinitem ){
170
        $checkinmessage = "Item not found.";
171
    }
172
    my $tobranch = $checkinitem->homebranch;
173
    my ($success,$messages,$issueinformation,$borrower) = AddReturn($uibarcode,$branch,undef,$today) unless $human_required;
174
    my $needstransfer = $messages->{'NeedsTransfer'};
175
    if($messages->{'ResFound'}) {
176
        my $reserve = $messages->{'ResFound'};
177
        my $reserve_id = $reserve->{'reserve_id'};
178
        my $resborrower = $reserve->{'borrowernumber'};
179
        my $diffBranchReturned = $reserve->{'branchcode'};
180
        my $itemnumber = $checkinitem->itemnumber;
181
        my $diffBranchSend = ($branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
182
        if($diffBranchSend) {
183
            ModReserveAffect( $itemnumber, $resborrower, $diffBranchSend, $reserve_id);
184
            ModItemTransfer($itemnumber,$branch,$diffBranchReturned, 'ResFound');
185
        }
186
        else {
187
            my $settransit = C4::Context->preference('RequireSCCheckInBeforeNotifyingPickups') ? 1 : 0;
188
            ModReserveAffect( $itemnumber, $resborrower, $settransit, $reserve_id);
189
        }
190
        $borrower = Koha::Patrons->find({ cardnumber => $patronid });
191
    }
192
    else {
193
         if($needstransfer) {
194
             ModItemTransfer($checkinitem->itemnumber, $branch, $tobranch, 'NeedsTransfer');
195
         }
196
    }
197
198
    if($messages->{'WrongTransfer'}) {
199
       updateWrongTransfer($checkinitem->itemnumber,$tobranch,$branch);
200
    }
201
202
    my $biblio = Koha::Biblios->find({ biblionumber => $checkinitem->biblionumber });
203
    if ( $biblio && $success ) {
204
        $checkinmessage = "Returned ".$biblio->title;
205
    }
206
207
    if ( $issuer ) {
208
        $checkinbranchcode = $issuer->{branchcode};
209
        #home branch of item
210
        if ($checkinbranchcode) {
211
            my $checkinlibrary = Koha::Libraries->find( $checkinbranchcode );
212
            $checkinmessage.=", ".$checkinlibrary->branchname;
213
        }
214
    }
215
216
    $template->param(checkinmessage => $checkinmessage || undef);
217
    $template->param(SelfCheckTimeout => 10000); #don't show returns long
218
    $template->param(uibarcode => $uibarcode);
147
    $template->param( returned => $success );
219
    $template->param( returned => $success );
148
}
220
}
149
elsif ( $patron && ( $op eq 'checkout' ) ) {
221
elsif ( $patron && ( $op eq 'checkout' ) ) {
150
- 

Return to bug 22322