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

(-)a/installer/data/mysql/atomicupdate/bug_34557.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "34557",
5
    description => "Add system preference SCOLoadCheckoutsByDefault",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        # Do you stuffs here
11
        $dbh->do(q{
12
            INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
13
            ('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo')
14
        });
15
16
        say $out "Added new system preference 'SCOLoadCheckoutsByDefault'";
17
    },
18
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 653-658 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
653
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
653
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
654
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
654
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
655
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
655
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
656
('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'),
656
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
657
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
657
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
658
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
658
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
659
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 1139-1144 Circulation: Link Here
1139
              type: textarea
1139
              type: textarea
1140
              syntax: css
1140
              syntax: css
1141
              class: code
1141
              class: code
1142
        -
1143
            - pref: SCOLoadCheckoutsByDefault
1144
              choices:
1145
                  1: Show
1146
                  0: "Don't show"
1147
            - "the patron's list of current checkouts by default when they log in to the self checkout module."
1142
        -
1148
        -
1143
            - pref: ShowPatronImageInWebBasedSelfCheck
1149
            - pref: ShowPatronImageInWebBasedSelfCheck
1144
              choices:
1150
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (+27 lines)
Lines 106-111 Link Here
106
                                    <input type="hidden" name="op" value="returnbook" />
106
                                    <input type="hidden" name="op" value="returnbook" />
107
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
107
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
108
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
108
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
109
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
109
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
110
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
110
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
111
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
111
                                </form>
112
                                </form>
Lines 116-121 Link Here
116
                                <input type="hidden" name="op" value="" />
117
                                <input type="hidden" name="op" value="" />
117
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
118
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
118
                                <input type="hidden" name="barcode" value="[% barcode | html %]" />
119
                                <input type="hidden" name="barcode" value="[% barcode | html %]" />
120
                                <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
119
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
121
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
120
                                <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
122
                                <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
121
                            </form>
123
                            </form>
Lines 135-140 Link Here
135
                                    <input type="hidden" name="op" value="returnbook" />
137
                                    <input type="hidden" name="op" value="returnbook" />
136
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
138
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
137
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
139
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
140
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
138
                                    <input type="hidden" name="confirmed" value="" />
141
                                    <input type="hidden" name="confirmed" value="" />
139
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
142
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
140
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
143
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
Lines 147-152 Link Here
147
                                    <input type="hidden" name="op" value="renew" />
150
                                    <input type="hidden" name="op" value="renew" />
148
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
151
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
149
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
152
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
153
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
150
                                    <input type="hidden" name="confirmed" value="1" />
154
                                    <input type="hidden" name="confirmed" value="1" />
151
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
155
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
152
                                    <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
156
                                    <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
Lines 157-162 Link Here
157
                                    <input type="hidden" name="op" value="renew" />
161
                                    <input type="hidden" name="op" value="renew" />
158
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
162
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
159
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
163
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
164
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
160
                                    <input type="hidden" name="confirmed" value="1" />
165
                                    <input type="hidden" name="confirmed" value="1" />
161
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
166
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
162
                                    <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
167
                                    <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
Lines 167-172 Link Here
167
                                <legend class="sr-only">Cancel</legend>
172
                                <legend class="sr-only">Cancel</legend>
168
                                <input type="hidden" name="op" value="" />
173
                                <input type="hidden" name="op" value="" />
169
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
174
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
175
                                <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
170
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
176
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
171
                                <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
177
                                <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
172
                            </form>
178
                            </form>
Lines 271-276 Link Here
271
                                            <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
277
                                            <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
272
                                            <input type="hidden" name="op" value="checkout" />
278
                                            <input type="hidden" name="op" value="checkout" />
273
                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
279
                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
280
                                            <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
274
                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
281
                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
275
                                        </div>
282
                                        </div>
276
                                    </div> <!-- /.row -->
283
                                    </div> <!-- /.row -->
Lines 307-313 Link Here
307
                    <div class="tab-content">
314
                    <div class="tab-content">
308
                        <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
315
                        <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
309
                            <div id="borrowerdetails">
316
                            <div id="borrowerdetails">
317
                                [% IF ( new_issue ) %]
318
                                    <div class="lastchecked">
319
                                        <p>
320
                                            <strong>Checked out: </strong>
321
                                            [% new_issue.item.biblio.title | html %] ([% new_issue.item.barcode | html %]).
322
323
                                            [% IF new_issue.item.is_bundle %]
324
                                                [% SET bundle_items_count = new_issue.item.bundle_items.count %]
325
                                                [% tnx('Bundle of {count} item', 'Bundle of {count} items', bundle_items_count, { count = bundle_items_count }) | html %].
326
                                            [% END %]
327
328
                                            Due on [% new_issue.date_due | $KohaDates as_due_date => 1 %]
329
                                        </p>
330
                                    </div>
331
                                [% END %]
310
                                [% IF ( issues_count ) %]
332
                                [% IF ( issues_count ) %]
333
                                    [% IF ( Koha.Preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %]
311
                                    <table id="loanTable" class="table table-bordered table-striped">
334
                                    <table id="loanTable" class="table table-bordered table-striped">
312
                                        <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
335
                                        <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
313
                                        <!-- ISSUES TABLE ROWS -->
336
                                        <!-- ISSUES TABLE ROWS -->
Lines 354-359 Link Here
354
                                                        <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
377
                                                        <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
355
                                                            <legend class="sr-only">Issue renews</legend>
378
                                                            <legend class="sr-only">Issue renews</legend>
356
                                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
379
                                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
380
                                                            <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
357
                                                            <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
381
                                                            <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
358
                                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
382
                                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
359
                                                            [% IF ISSUE.can_be_renewed %]
383
                                                            [% IF ISSUE.can_be_renewed %]
Lines 397-402 Link Here
397
                                            [% END # / FOREACH ISSUE %]
421
                                            [% END # / FOREACH ISSUE %]
398
                                        </tbody>
422
                                        </tbody>
399
                                    </table>
423
                                    </table>
424
                                    [% ELSE %]
425
                                        <a href="?load_checkouts=1">Load your checkouts</a>
426
                                    [% END # / IF ( Koha.preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %]
400
                                [% ELSE %]
427
                                [% ELSE %]
401
                                    <h3>You currently have nothing checked out.</h3>
428
                                    <h3>You currently have nothing checked out.</h3>
402
                                [% END # / IF issues_count %]
429
                                [% END # / IF issues_count %]
(-)a/opac/sco/sco-main.pl (-19 / +22 lines)
Lines 93-105 if (defined C4::Context->preference('SCOAllowCheckin')) { Link Here
93
}
93
}
94
94
95
my $issuerid = $loggedinuser;
95
my $issuerid = $loggedinuser;
96
my ($op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = (
96
my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = (
97
    $query->param("op")         || '',
97
    $query->param("op")             || '',
98
    $query->param("patronlogin")|| '',
98
    $query->param("patronlogin")    || '',
99
    $query->param("patronpw")   || '',
99
    $query->param("patronpw")       || '',
100
    $query->param("barcode")    || '',
100
    $query->param("barcode")        || '',
101
    $query->param("confirmed")  || '',
101
    $query->param("confirmed")      || '',
102
    $query->param("newissues")  || '',
102
    $query->param("newissues")      || '',
103
    $query->param("load_checkouts") || '',
103
);
104
);
104
105
105
my $jwt = $query->cookie('JWT');
106
my $jwt = $query->cookie('JWT');
Lines 245-252 elsif ( $patron && ( $op eq 'checkout' ) ) { Link Here
245
                )->count;
246
                )->count;
246
            }
247
            }
247
248
248
            AddIssue( $patron, $barcode );
249
            my $new_issue = AddIssue( $patron, $barcode );
249
            $template->param( issued => 1 );
250
            $template->param( issued => 1, new_issue => $new_issue );
250
            push @newissueslist, $barcode;
251
            push @newissueslist, $barcode;
251
252
252
            if ( $hold_existed ) {
253
            if ( $hold_existed ) {
Lines 298-312 if ( $patron && ( $op eq 'renew' ) ) { Link Here
298
299
299
if ( $patron) {
300
if ( $patron) {
300
    my $borrowername = sprintf "%s %s", ($patron->firstname || ''), ($patron->surname || '');
301
    my $borrowername = sprintf "%s %s", ($patron->firstname || ''), ($patron->surname || '');
301
    my $pending_checkouts = $patron->pending_checkouts;
302
    my @checkouts;
302
    my @checkouts;
303
    while ( my $c = $pending_checkouts->next ) {
303
    my $pending_checkouts = $patron->pending_checkouts;
304
        my $checkout = $c->unblessed_all_relateds;
304
    if ( C4::Context->preference('SCOLoadCheckoutsByDefault') || $load_checkouts ) {
305
        my ($can_be_renewed, $renew_error) = CanBookBeRenewed( $patron, $c );
305
        while ( my $c = $pending_checkouts->next ) {
306
        $checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed
306
            my $checkout = $c->unblessed_all_relateds;
307
        $checkout->{renew_error} = $renew_error;
307
            my ( $can_be_renewed, $renew_error ) = CanBookBeRenewed( $patron, $c );
308
        $checkout->{overdue} = $c->is_overdue;
308
            $checkout->{can_be_renewed} = $can_be_renewed;    # In the future this will be $checkout->can_be_renewed
309
        push @checkouts, $checkout;
309
            $checkout->{renew_error}    = $renew_error;
310
            $checkout->{overdue}        = $c->is_overdue;
311
            push @checkouts, $checkout;
312
        }
310
    }
313
    }
311
314
312
    my $show_priority;
315
    my $show_priority;
Lines 328-334 if ( $patron) { Link Here
328
    $template->param(
331
    $template->param(
329
        validuser => 1,
332
        validuser => 1,
330
        borrowername => $borrowername,
333
        borrowername => $borrowername,
331
        issues_count => scalar(@checkouts),
334
        issues_count => scalar(@checkouts) || $pending_checkouts->count(),
332
        ISSUES => \@checkouts,
335
        ISSUES => \@checkouts,
333
        HOLDS => $holds,
336
        HOLDS => $holds,
334
        newissues => join(',',@newissueslist),
337
        newissues => join(',',@newissueslist),
Lines 336-341 if ( $patron) { Link Here
336
        patronpw => $patronpw,
339
        patronpw => $patronpw,
337
        waiting_holds_count => $waiting_holds_count,
340
        waiting_holds_count => $waiting_holds_count,
338
        noitemlinks => 1 ,
341
        noitemlinks => 1 ,
342
        load_checkouts => $load_checkouts,
339
        borrowernumber => $patron->borrowernumber,
343
        borrowernumber => $patron->borrowernumber,
340
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
344
        SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
341
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
345
        AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
342
- 

Return to bug 34557