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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (-6 / +12 lines)
Lines 131-137 Link Here
131
                        <div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
131
                        <div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
132
                            <span class="sco-alert-warning confirm"></span>
132
                            <span class="sco-alert-warning confirm"></span>
133
                            [% IF ( confirm_renew_issue ) %]
133
                            [% IF ( confirm_renew_issue ) %]
134
                                <p>This item is already checked out to you.</p>
134
                                <p>This item is already checked out to you: <b>[% confirm | html %]</b> <i>([% barcode | html %])</i></p>
135
                            [% END %]
135
                            [% END %]
136
136
137
                            [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
137
                            [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
Lines 213-226 Link Here
213
                    [% END %]
213
                    [% END %]
214
214
215
                    [% IF ( issued ) %]
215
                    [% IF ( issued ) %]
216
                        [% FOREACH barcode IN newissues.split(',') %]
216
                        <span class="sco-alert-success issue"></span>
217
                        <span class="sco-alert-success issue"></span>
217
                        <div class="alert alert-info">
218
                        <div class="alert alert-info">
218
                            <p>Item checked out</p>
219
                            <p>Item checked out <i>([% barcode | html %])</i></p>
219
                        </div>
220
                        </div>
221
                        [% END %]
220
                    [% ELSIF ( renewed ) %]
222
                    [% ELSIF ( renewed ) %]
221
                        <span class="sco-alert-success renew"></span>
223
                        <span class="sco-alert-success renew"></span>
222
                        <div class="alert alert-info">
224
                        <div class="alert alert-info">
223
                            <p>Item renewed</p>
225
                            <p>Item renewed <i>([% barcode | html %])</i></p>
224
                        </div>
226
                        </div>
225
                    [% ELSIF ( renewed == 0) %]
227
                    [% ELSIF ( renewed == 0) %]
226
                        <span class="sco-alert-warning renew"></span>
228
                        <span class="sco-alert-warning renew"></span>
Lines 235-241 Link Here
235
                    [% ELSIF ( returned == 1 ) %]
237
                    [% ELSIF ( returned == 1 ) %]
236
                        <span class="sco-alert-success return"></span>
238
                        <span class="sco-alert-success return"></span>
237
                        <div class="alert alert-info">
239
                        <div class="alert alert-info">
238
                            <p>Item checked in</p>
240
                            <p>Item checked in <i>([% barcode | html %])</i></p>
239
                        </div>
241
                        </div>
240
                    [% END %]
242
                    [% END %]
241
243
Lines 272-281 Link Here
272
                                        </h2></legend>
274
                                        </h2></legend>
273
                                    <div class="row">
275
                                    <div class="row">
274
                                        <div class="col">
276
                                        <div class="col">
275
                                            <label for="barcode">Scan a new item or enter its barcode:</label>
277
                                            <label for="barcode">Scan a new item or enter its barcode[% IF Koha.Preference('BatchCheckouts') %]<br>(or enter a barcode list, one barcode per line)[% END %]:</label>
276
                                        </div>
278
                                        </div>
277
                                        <div class="col-3">
279
                                        <div class="col-3">
278
                                            <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
280
                                            [% IF Koha.Preference('BatchCheckouts') %]
281
                                                <textarea id="barcode" name="barcode" rows="10" cols="30" class="focus form-control"></textarea>
282
                                            [% ELSE %]
283
                                                <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
284
                                            [% END %]
279
                                        </div>
285
                                        </div>
280
                                        <div class="col-auto">
286
                                        <div class="col-auto">
281
                                            <button type="submit" class="btn btn-primary">Submit</button>
287
                                            <button type="submit" class="btn btn-primary">Submit</button>
(-)a/opac/sco/sco-main.pl (-9 / +44 lines)
Lines 94-100 if (defined C4::Context->preference('SCOAllowCheckin')) { Link Here
94
}
94
}
95
95
96
my $issuerid = $loggedinuser;
96
my $issuerid = $loggedinuser;
97
my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = (
97
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts ) = (
98
    $query->param("op")             || '',
98
    $query->param("op")             || '',
99
    $query->param("patronlogin")    || '',
99
    $query->param("patronlogin")    || '',
100
    $query->param("patronpw")       || '',
100
    $query->param("patronpw")       || '',
Lines 112-118 if ($op eq "logout") { Link Here
112
    undef $jwt;
112
    undef $jwt;
113
}
113
}
114
114
115
$barcode = barcodedecode( $barcode ) if $barcode;
115
my $barcodes = [];
116
if ( $barcodestr ) {
117
    push @$barcodes, split( /\s\n/, $barcodestr );
118
    $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ];
119
}
116
120
117
my @newissueslist = split /,/, $newissues;
121
my @newissueslist = split /,/, $newissues;
118
my $issuenoconfirm = 1; #don't need to confirm on issue.
122
my $issuenoconfirm = 1; #don't need to confirm on issue.
Lines 142-151 my $branch = $issuer->{branchcode}; Link Here
142
my $confirm_required = 0;
146
my $confirm_required = 0;
143
my $return_only = 0;
147
my $return_only = 0;
144
148
149
if ( C4::Context->preference('BatchCheckouts') ) {
150
    my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories');
151
    my $categorycode = $issuer->{categorycode};
152
    if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) {
153
        # do nothing - logged in patron is allowed to do batch checkouts
154
    } else {
155
        # patron category not allowed to do batch checkouts, only allow first barcode
156
        while ( scalar @$barcodes > 1 ) {
157
            pop @$barcodes;
158
        }
159
    }
160
} else {
161
    # batch checkouts not enabled, only allow first barcode
162
    while ( scalar @$barcodes > 1 ) {
163
        pop @$barcodes;
164
    }
165
}
166
145
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
167
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
146
    my $success = 1;
168
    my $success = 1;
147
169
148
170
  foreach my $barcode ( @$barcodes ) {
149
    my $item = Koha::Items->find( { barcode => $barcode } );
171
    my $item = Koha::Items->find( { barcode => $barcode } );
150
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
172
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
151
        if ( defined($item)
173
        if ( defined($item)
Lines 165-174 if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { Link Here
165
        ($success) = AddReturn( $barcode, $branch )
187
        ($success) = AddReturn( $barcode, $branch )
166
    }
188
    }
167
189
168
    $template->param( returned => $success );
190
    $template->param(
191
        returned => $success,
192
        barcode => $barcode
193
    );
194
  } # foreach barcode in barcodes
169
}
195
}
170
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
171
196
197
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
198
  foreach my $barcode ( @$barcodes ) {
172
    my $item = Koha::Items->find( { barcode => $barcode } );
199
    my $item = Koha::Items->find( { barcode => $barcode } );
173
    my $impossible  = {};
200
    my $impossible  = {};
174
    my $needconfirm = {};
201
    my $needconfirm = {};
Lines 211-224 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
211
                barcode    => $barcode,
238
                barcode    => $barcode,
212
            );
239
            );
213
        }
240
        }
241
        last;
214
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
242
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
215
        $template->param(
243
        $template->param(
216
                renew               => 1,
244
                renew               => 1,
217
                barcode             => $barcode,
245
                barcode             => $barcode,
218
                confirm             => 1,
246
                confirm             => $item->biblio->title,
219
                confirm_renew_issue => 1,
247
                confirm_renew_issue => 1,
220
                hide_main           => 1,
248
                hide_main           => 1,
221
        );
249
        );
250
        last;
222
    } elsif ( $confirm_required && !$confirmed ) {
251
    } elsif ( $confirm_required && !$confirmed ) {
223
        $template->param(
252
        $template->param(
224
            impossible                => 1,
253
            impossible                => 1,
Lines 228-233 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
228
        if ($issue_error eq 'DEBT') {
257
        if ($issue_error eq 'DEBT') {
229
            $template->param(DEBT => $needconfirm->{DEBT});
258
            $template->param(DEBT => $needconfirm->{DEBT});
230
        }
259
        }
260
        last;
231
    } else {
261
    } else {
232
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
262
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
233
            my ( $hold_existed, $item );
263
            my ( $hold_existed, $item );
Lines 250-256 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
250
280
251
            my $new_issue = AddIssue( $patron, $barcode );
281
            my $new_issue = AddIssue( $patron, $barcode );
252
            $template->param( issued => 1, new_issue => $new_issue );
282
            $template->param( issued => 1, new_issue => $new_issue );
253
            push @newissueslist, $barcode;
283
            push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist );
254
284
255
            if ( $hold_existed ) {
285
            if ( $hold_existed ) {
256
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
286
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
Lines 276-284 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
276
            );
306
            );
277
        }
307
        }
278
    }
308
    }
309
  } # foreach barcode in barcodes
279
} # $op
310
} # $op
280
311
281
if ( $patron && ( $op eq 'cud-renew' ) ) {
312
if ( $patron && ( $op eq 'cud-renew' ) ) {
313
  foreach my $barcode ( @$barcodes ) {
282
    my $item = Koha::Items->find({ barcode => $barcode });
314
    my $item = Koha::Items->find({ barcode => $barcode });
283
315
284
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
316
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
Lines 292-302 if ( $patron && ( $op eq 'cud-renew' ) ) { Link Here
292
                }
324
                }
293
            );
325
            );
294
            push @newissueslist, $barcode;
326
            push @newissueslist, $barcode;
295
            $template->param( renewed => 1 );
327
            $template->param(
328
                renewed => 1,
329
                barcode => $barcode
330
            );
296
        }
331
        }
297
    } else {
332
    } else {
298
        $template->param( renewed => 0 );
333
        $template->param( renewed => 0 );
299
    }
334
    }
335
  } # foreach barcode in barcodes
300
}
336
}
301
337
302
if ( $patron) {
338
if ( $patron) {
303
- 

Return to bug 32256