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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (-43 / +82 lines)
Lines 319-378 Link Here
319
                                </div>
319
                                </div>
320
                            [% END %]
320
                            [% END %]
321
321
322
                            <div class="sco_entry">
322
                            <div class="row">
323
                                <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
323
                                <div id="sco_entry_checkout" class="sco_entry col" >
324
                                    [% INCLUDE 'csrf-token.inc' %]
324
                                    <h4>Check out</h4>
325
                                    <fieldset>
325
                                    <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
326
                                        <legend>Log in to your account</legend>
326
                                        [% INCLUDE 'csrf-token.inc' %]
327
                                        <div class="row">
327
                                        <fieldset>
328
                                            <div class="col-md-6">
328
                                            <legend>Log in to your account</legend>
329
                                                [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
329
                                                <div class="col-md-6">
330
                                                    <div class="row">
330
                                                    [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %]
331
                                                        <div class="col-md-12"> [% PROCESS login_label for="patronlogin" %] </div>
331
                                                        <div class="row">
332
                                                        <div class="col-md-12">
332
                                                            <div class="col-md-12"> [% PROCESS login_label for="patronlogin" %] </div>
333
                                                            <input type="text" id="patronlogin" class="form-control focus noEnterSubmit" size="20" name="patronlogin" autocomplete="off" />
333
                                                            <div class="col-md-12">
334
                                                        </div>
334
                                                                <input type="text" id="patronlogin" class="form-control focus noEnterSubmit" size="20" name="patronlogin" autocomplete="off" />
335
                                                        <div class="col-md-12">
335
                                                            </div>
336
                                                            <label for="patronpw">Password:</label>
336
                                                            <div class="col-md-12">
337
                                                        </div>
337
                                                                <label for="patronpw">Password:</label>
338
                                                        <div class="col-md-12">
338
                                                            </div>
339
                                                            <input type="password" id="patronpw" class="form-control" size="20" name="patronpw" autocomplete="off" />
339
                                                            <div class="col-md-12">
340
                                                                <input type="password" id="patronpw" class="form-control" size="20" name="patronpw" autocomplete="off" />
341
                                                            </div>
342
                                                            <div class="col-md-12">
343
                                                                <button type="submit" class="btn btn-primary">Log in</button>
344
                                                            </div>
340
                                                        </div>
345
                                                        </div>
341
                                                        <div class="col-md-12">
346
                                                        <!-- /.row -->
342
                                                            <button id="sco_patron_login" type="submit" class="btn btn-primary">Log in</button>
347
                                                    [% ELSE %]
348
                                                        <div class="row">
349
                                                            <div class="col-md-12">
350
                                                                <label for="patronid">Please enter your card number:</label>
351
                                                            </div>
352
                                                            <div class="col-md-12">
353
                                                                <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
354
                                                            </div>
355
                                                            <div class="col-md-12">
356
                                                                <button type="submit" class="btn btn-primary">Submit</button>
357
                                                            </div>
343
                                                        </div>
358
                                                        </div>
344
                                                    </div>
359
                                                        <!-- /.row -->
345
                                                    <!-- /.row -->
360
                                                    [% END %]
346
                                                [% ELSE %]
361
                                                </div>
362
                                                <!-- /.col-md-6 -->
363
                                            [% FOREACH INPUT IN INPUTS %]
364
                                                <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
365
                                            [% END %]
366
                                            <input type="hidden" name="op" value="cud-login" />
367
                                        </fieldset>
368
                                    </form>
369
                                    <!-- /#mainform -->
370
                                </div>
371
                                <!-- / #sco_entry_checkout -->
372
                                <div id="sco_entry_checkin" class="sco_entry col" >
373
                                    <h4>Check in</h4>
374
                                    <form id="barcodeform" action="/cgi-bin/koha/sco/sco-main.pl" name="barcodeform" method="post">
375
                                        [% INCLUDE 'csrf-token.inc' %]
376
                                        <fieldset>
377
                                                <div class="col-md-6">
347
                                                    <div class="row">
378
                                                    <div class="row">
348
                                                        <div class="col-md-12">
379
                                                        <div class="col-md-12">
349
                                                            <label for="patronid">Please enter your card number:</label>
380
                                                            <label for="sco_entry_barcode">Please enter barcode:</label>
350
                                                        </div>
381
                                                        </div>
351
                                                        <div class="col-md-12">
382
                                                        <div class="col-md-12">
352
                                                            <input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" />
383
                                                            [% IF ( returned == 1 || returned == 0 || empty_return ) %]
384
                                                                <input type="text" id="sco_entry_barcode"  class="form-control focus" size="20" name="sco_entry_barcode" autocomplete="off" />
385
                                                            [% ELSE %]
386
                                                                <input type="text" id="sco_entry_barcode" class="form-control" size="20" name="sco_entry_barcode" autocomplete="off" />
387
                                                            [% END %]
353
                                                        </div>
388
                                                        </div>
354
                                                        <div class="col-md-12">
389
                                                        <div class="col-md-12">
355
                                                            <button id="sco_patron_login" type="submit" class="btn btn-primary">Submit</button>
390
                                                            <button id="sco_patron_login" type="submit" class="btn btn-primary">Submit</button>
356
                                                        </div>
391
                                                        </div>
357
                                                    </div>
392
                                                    </div>
358
                                                    <!-- /.row -->
393
                                                    <!-- /.row -->
359
                                                [% END %]
394
                                                    [% FOREACH INPUT IN INPUTS %]
360
                                            </div>
395
                                                    <input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">
361
                                            <!-- /.col-md-6 -->
396
                                                    [% END %]
362
                                        </div>
397
                                                    <input type="hidden" name="op" value="cud-sco_entry_checkin" />
363
                                        <!-- /.row -->
398
                                                </div>
364
                                        [% FOREACH INPUT IN INPUTS %]
399
                                                <!-- /.col-md-6 -->
365
                                            <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
400
                                        </fieldset>
366
                                        [% END %]
401
                                    </form>
367
                                        <input type="hidden" name="op" value="cud-login" />
402
                                    <!-- /#barcodeform -->
368
                                    </fieldset>
403
                                </div>
369
                                </form>
404
                                <!-- / #sco_entry_checkin -->
370
                                <!-- /#mainform -->
405
                                [% IF ( SCOMainUserBlock ) %]
406
                                    <div id="scomainuserblock"> [% PROCESS koha_news_block news => SCOMainUserBlock %] </div>
407
                                [% END %]
371
                            </div>
408
                            </div>
372
                            <!-- / .sco_entry -->
409
                            <!-- / .row -->
373
                            [% IF ( SCOMainUserBlock ) %]
374
                                <div id="scomainuserblock"> [% PROCESS koha_news_block news => SCOMainUserBlock %] </div>
375
                            [% END %]
376
                        </div>
410
                        </div>
377
                        <!-- / .span12 -->
411
                        <!-- / .span12 -->
378
                    </div>
412
                    </div>
Lines 413-419 Link Here
413
                    }
447
                    }
414
                }
448
                }
415
                document.addEventListener("DOMContentLoaded",function(){
449
                document.addEventListener("DOMContentLoaded",function(){
416
                    if ( document.querySelector('#sco_patron_login,#logout_form') ){
450
                    if ( document.querySelector('#sco_patron_login,#logout_form,#barcode') ){
417
                        login_timeout();
451
                        login_timeout();
418
                    }
452
                    }
419
                });
453
                });
Lines 734-740 Link Here
734
        [% ELSIF ( returned == 1 ) %]
768
        [% ELSIF ( returned == 1 ) %]
735
            <span class="sco-alert-success return"></span>
769
            <span class="sco-alert-success return"></span>
736
            <div class="alert alert-info">
770
            <div class="alert alert-info">
737
                <p>Item checked in <i>([% barcode | html %])</i></p>
771
                <p>Item checked in: [% title | html %] <i>([% barcode | html %])</i>[% IF library %], [% library | html %][% END %]</p>
772
            </div>
773
        [% ELSIF ( empty_return == 1 ) %]
774
            <span class="sco-alert-success return"></span>
775
            <div class="alert alert-info">
776
                <p>Please enter barcode.</p>
738
            </div>
777
            </div>
739
        [% END %]
778
        [% END %]
740
    [% END %]
779
    [% END %]
(-)a/opac/sco/sco-main.pl (-17 / +64 lines)
Lines 34-42 use CGI qw ( -utf8 ); Link Here
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::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
36
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Reserves;
37
use C4::Reserves qw ( ModReserveAffect );
38
use C4::Output qw( output_html_with_http_headers );
38
use C4::Output qw( output_html_with_http_headers );
39
use C4::Members;
39
use C4::Members;
40
use C4::Items qw( ModItemTransfer );
40
use Koha::DateUtils qw( dt_from_string );
41
use Koha::DateUtils qw( dt_from_string );
41
use Koha::Acquisition::Currencies;
42
use Koha::Acquisition::Currencies;
42
use Koha::Items;
43
use Koha::Items;
Lines 81-94 if ( defined C4::Context->preference('SCOAllowCheckin') ) { Link Here
81
}
82
}
82
83
83
my $issuerid = $loggedinuser;
84
my $issuerid = $loggedinuser;
84
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts ) = (
85
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts, $sco_entry_barcode ) = (
85
    $query->param("op")             || '',
86
    $query->param("op")                || '',
86
    $query->param("patronlogin")    || '',
87
    $query->param("patronlogin")       || '',
87
    $query->param("patronpw")       || '',
88
    $query->param("patronpw")          || '',
88
    $query->param("barcode")        || '',
89
    $query->param("barcode")           || '',
89
    $query->param("confirmed")      || '',
90
    $query->param("confirmed")         || '',
90
    $query->param("newissues")      || '',
91
    $query->param("newissues")         || '',
91
    $query->param("load_checkouts") || '',
92
    $query->param("load_checkouts")    || '',
93
    $query->param("sco_entry_barcode") || '',
92
);
94
);
93
95
94
my $jwt = $query->cookie('JWT');
96
my $jwt = $query->cookie('JWT');
Lines 101-108 if ( $op eq "logout" ) { Link Here
101
}
103
}
102
104
103
my $barcodes = [];
105
my $barcodes = [];
104
if ($barcodestr) {
106
if ( $barcodestr || $sco_entry_barcode ) {
105
    push @$barcodes, split( /\s\n/, $barcodestr );
107
    push @$barcodes, split( /\s\n/, $barcodestr ? $barcodestr : $sco_entry_barcode );
106
    $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode($_) } @$barcodes ];
108
    $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode($_) } @$barcodes ];
107
}
109
}
108
110
Lines 149-159 if ($patron) { Link Here
149
    }
151
    }
150
}
152
}
151
153
152
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
154
if ( ( $op eq "cud-sco_entry_checkin" ) || ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) ) {
153
    my $success = 1;
155
    my $success = 1;
154
156
157
    if ( !@$barcodes ) {
158
        $template->param( empty_return => 1 );
159
    }
160
155
    foreach my $barcode (@$barcodes) {
161
    foreach my $barcode (@$barcodes) {
156
        my $item = Koha::Items->find( { barcode => $barcode } );
162
        my $item = Koha::Items->find( { barcode => $barcode } );
163
164
        my $title          = $item ? Koha::Biblios->find( { biblionumber => $item->biblionumber } )->title : undef;
165
        my $checkinlibrary = $issuer && $branch ? Koha::Libraries->find($branch)->branchname               : undef;
166
167
        if ( !$item ) {
168
            $success = 0;
169
        }
170
157
        if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
171
        if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
158
            if ( defined($item)
172
            if ( defined($item)
159
                && $item->materials )
173
                && $item->materials )
Lines 162-168 if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { Link Here
162
            }
176
            }
163
        }
177
        }
164
178
165
        if ($success) {
179
        if ( $success && ( $op ne "cud-sco_entry_checkin" ) ) {
166
180
167
            # Patron cannot checkin an item they don't own
181
            # Patron cannot checkin an item they don't own
168
            $success = 0
182
            $success = 0
Lines 170-181 if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { Link Here
170
        }
184
        }
171
185
172
        if ($success) {
186
        if ($success) {
173
            ($success) = AddReturn( $barcode, $branch );
187
188
            my $to_branch = $item->homebranch;
189
            my $messages;
190
191
            ( $success, $messages ) = AddReturn( $barcode, $branch );
192
193
            if ( $messages->{'ResFound'} ) {
194
                my $reserve          = $messages->{'ResFound'};
195
                my $reserve_id       = $reserve->{'reserve_id'};
196
                my $resborrower      = $reserve->{'borrowernumber'};
197
                my $resbranch        = $reserve->{'branchcode'};
198
                my $itemnumber       = $item->itemnumber;
199
                my $diff_branch_send = ( $branch ne $resbranch ) ? $resbranch : undef;
200
201
                if ($diff_branch_send) {
202
                    ModReserveAffect( $itemnumber, $resborrower, $diff_branch_send, $reserve_id );
203
                    ModItemTransfer( $itemnumber, $branch, $resbranch, 'ResFound' );
204
                } else {
205
                    my $set_transit = C4::Context->preference('RequireSCCheckInBeforeNotifyingPickups');
206
                    ModReserveAffect( $itemnumber, $resborrower, $set_transit, $reserve_id );
207
                }
208
            } elsif ( $messages->{'NeedsTransfer'} ) {
209
                ModItemTransfer( $item->itemnumber, $branch, $to_branch, 'NeedsTransfer' );
210
            }
211
212
            if ( $messages->{'WrongTransfer'} ) {
213
                my $item         = Koha::Items->find( $messages->{'WrongTransferItem'} );
214
                my $old_transfer = $item->get_transfer;
215
                my $new_transfer = $item->request_transfer(
216
                    { to => $old_transfer->tobranch, reason => $old_transfer->reason, replace => 'WrongTransfer' } );
217
            }
218
174
        }
219
        }
175
220
176
        $template->param(
221
        $template->param(
177
            returned => $success,
222
            SelfCheckTimeout => 10000,            #don't show returns long
178
            barcode  => $barcode
223
            returned         => $success,
224
            barcode          => $barcode,
225
            title            => $title,
226
            library          => $checkinlibrary
179
        );
227
        );
180
    }    # foreach barcode in barcodes
228
    }    # foreach barcode in barcodes
181
229
182
- 

Return to bug 22322