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 640-645 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
640
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
640
('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'),
641
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
641
('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'),
642
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
642
('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'),
643
('SCOLoadCheckoutsByDefault','1','','If enabled, load the list of a patrons checkouts when they log in to the Self Checkout','YesNo'),
643
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
644
('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'),
644
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
645
('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded <style> tag.','free'),
645
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
646
('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 1128-1133 Circulation: Link Here
1128
              type: textarea
1128
              type: textarea
1129
              syntax: css
1129
              syntax: css
1130
              class: code
1130
              class: code
1131
        -
1132
            - pref: SCOLoadCheckoutsByDefault
1133
              choices:
1134
                  1: Show
1135
                  0: "Don't show"
1136
            - "the patron's list of current checkouts by default when they log in to the self checkout module."
1131
        -
1137
        -
1132
            - pref: ShowPatronImageInWebBasedSelfCheck
1138
            - pref: ShowPatronImageInWebBasedSelfCheck
1133
              choices:
1139
              choices:
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (+27 lines)
Lines 98-103 Link Here
98
                                    <input type="hidden" name="op" value="returnbook" />
98
                                    <input type="hidden" name="op" value="returnbook" />
99
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
99
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
100
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
100
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
101
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
101
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
102
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
102
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
103
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
103
                                </form>
104
                                </form>
Lines 108-113 Link Here
108
                                <input type="hidden" name="op" value="" />
109
                                <input type="hidden" name="op" value="" />
109
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
110
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
110
                                <input type="hidden" name="barcode" value="[% barcode | html %]" />
111
                                <input type="hidden" name="barcode" value="[% barcode | html %]" />
112
                                <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
111
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
113
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
112
                                <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
114
                                <input type="submit" name= "confirm" value="Return to account summary" class="btn btn-info back focus" />
113
                            </form>
115
                            </form>
Lines 127-132 Link Here
127
                                    <input type="hidden" name="op" value="returnbook" />
129
                                    <input type="hidden" name="op" value="returnbook" />
128
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
130
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
129
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
131
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
132
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
130
                                    <input type="hidden" name="confirmed" value="" />
133
                                    <input type="hidden" name="confirmed" value="" />
131
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
134
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
132
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
135
                                    <button type="submit" name="returnbook" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i> Return this item</button>
Lines 139-144 Link Here
139
                                    <input type="hidden" name="op" value="renew" />
142
                                    <input type="hidden" name="op" value="renew" />
140
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
143
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
141
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
144
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
145
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
142
                                    <input type="hidden" name="confirmed" value="1" />
146
                                    <input type="hidden" name="confirmed" value="1" />
143
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
147
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
144
                                    <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
148
                                    <button type="submit" name="confirm" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
Lines 149-154 Link Here
149
                                    <input type="hidden" name="op" value="renew" />
153
                                    <input type="hidden" name="op" value="renew" />
150
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
154
                                    <input type="hidden" name="patronid" value="[% patronid | html %]" />
151
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
155
                                    <input type="hidden" name="barcode" value="[% barcode | html %]" />
156
                                    <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
152
                                    <input type="hidden" name="confirmed" value="1" />
157
                                    <input type="hidden" name="confirmed" value="1" />
153
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
158
                                    <input type="hidden" name="newissues" value="[% newissues | html %]" />
154
                                    <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
159
                                    <button type="submit" class="btn btn-primary"><i class="fa-solid fa-rotate" aria-hidden="true"></i> Renew item</button>
Lines 159-164 Link Here
159
                                <legend class="sr-only">Cancel</legend>
164
                                <legend class="sr-only">Cancel</legend>
160
                                <input type="hidden" name="op" value="" />
165
                                <input type="hidden" name="op" value="" />
161
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
166
                                <input type="hidden" name="patronid" value="[% patronid | html %]" />
167
                                <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
162
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
168
                                <input type="hidden" name="newissues" value="[% newissues | html %]" />
163
                                <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
169
                                <button type="submit" class="btn btn-primary"><i class="fa fa-cancel" aria-hidden="true"></i> Cancel</button>
164
                            </form>
170
                            </form>
Lines 263-268 Link Here
263
                                            <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
269
                                            <button type="button" id="logout_form" class="btn btn-info"><i class="fa fa-check" aria-hidden="true"></i> Finish</button>
264
                                            <input type="hidden" name="op" value="checkout" />
270
                                            <input type="hidden" name="op" value="checkout" />
265
                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
271
                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
272
                                            <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
266
                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
273
                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
267
                                        </div>
274
                                        </div>
268
                                    </div> <!-- /.row -->
275
                                    </div> <!-- /.row -->
Lines 299-305 Link Here
299
                    <div class="tab-content">
306
                    <div class="tab-content">
300
                        <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
307
                        <div id="checkouts-tab" class="tab-pane show active" aria-labelledby="checkouts">
301
                            <div id="borrowerdetails">
308
                            <div id="borrowerdetails">
309
                                [% IF ( new_issue ) %]
310
                                    <div class="lastchecked">
311
                                        <p>
312
                                            <strong>Checked out: </strong>
313
                                            [% new_issue.item.biblio.title | html %] ([% new_issue.item.barcode | html %]).
314
315
                                            [% IF new_issue.item.is_bundle %]
316
                                                [% SET bundle_items_count = new_issue.item.bundle_items.count %]
317
                                                [% tnx('Bundle of {count} item', 'Bundle of {count} items', bundle_items_count, { count = bundle_items_count }) | html %].
318
                                            [% END %]
319
320
                                            Due on [% new_issue.date_due | $KohaDates as_due_date => 1 %]
321
                                        </p>
322
                                    </div>
323
                                [% END %]
302
                                [% IF ( issues_count ) %]
324
                                [% IF ( issues_count ) %]
325
                                    [% IF ( Koha.Preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %]
303
                                    <table id="loanTable" class="table table-bordered table-striped">
326
                                    <table id="loanTable" class="table table-bordered table-striped">
304
                                        <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
327
                                        <caption>Checkouts for [% borrowername | html %] <span class="count">([% issues_count | html %] total)</span></caption>
305
                                        <!-- ISSUES TABLE ROWS -->
328
                                        <!-- ISSUES TABLE ROWS -->
Lines 345-350 Link Here
345
                                                        <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
368
                                                        <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
346
                                                            <legend class="sr-only">Issue renews</legend>
369
                                                            <legend class="sr-only">Issue renews</legend>
347
                                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
370
                                                            <input type="hidden" name="patronid" value="[% patronid | html %]" />
371
                                                            <input type="hidden" name="load_checkouts" value="[% load_checkouts | html %]" />
348
                                                            <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
372
                                                            <input type="hidden" name="barcode" value="[% ISSUE.barcode | html %]" />
349
                                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
373
                                                            <input type="hidden" name="newissues" value="[% newissues | html %]" />
350
                                                            [% IF ISSUE.can_be_renewed %]
374
                                                            [% IF ISSUE.can_be_renewed %]
Lines 384-389 Link Here
384
                                            [% END # / FOREACH ISSUE %]
408
                                            [% END # / FOREACH ISSUE %]
385
                                        </tbody>
409
                                        </tbody>
386
                                    </table>
410
                                    </table>
411
                                    [% ELSE %]
412
                                        <a href="?load_checkouts=1">Load your checkouts</a>
413
                                    [% END # / IF ( Koha.preference('SCOLoadCheckoutsByDefault') || load_checkouts ) %]
387
                                [% ELSE %]
414
                                [% ELSE %]
388
                                    <h3>You currently have nothing checked out.</h3>
415
                                    <h3>You currently have nothing checked out.</h3>
389
                                [% END # / IF issues_count %]
416
                                [% 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->unblessed, $barcode );
249
            my $new_issue = AddIssue( $patron->unblessed, $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