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 118-124 Link Here
118
                        <div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
118
                        <div class="alert alert-warning"><h2>Please confirm the checkout:</h2>
119
                            <span class="sco-alert-warning confirm"></span>
119
                            <span class="sco-alert-warning confirm"></span>
120
                            [% IF ( confirm_renew_issue ) %]
120
                            [% IF ( confirm_renew_issue ) %]
121
                                <p>This item is already checked out to you.</p>
121
                                <p>This item is already checked out to you: <b>[% confirm | html %]</b> <i>([% barcode | html %])</i></p>
122
                            [% END %]
122
                            [% END %]
123
123
124
                            [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
124
                            [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %]
Lines 193-206 Link Here
193
                    [% END %]
193
                    [% END %]
194
194
195
                    [% IF ( issued ) %]
195
                    [% IF ( issued ) %]
196
                        [% FOREACH barcode IN newissues.split(',') %]
196
                        <span class="sco-alert-success issue"></span>
197
                        <span class="sco-alert-success issue"></span>
197
                        <div class="alert alert-info">
198
                        <div class="alert alert-info">
198
                            <p>Item checked out</p>
199
                            <p>Item checked out <i>([% barcode | html %])</i></p>
199
                        </div>
200
                        </div>
201
                        [% END %]
200
                    [% ELSIF ( renewed ) %]
202
                    [% ELSIF ( renewed ) %]
201
                        <span class="sco-alert-success renew"></span>
203
                        <span class="sco-alert-success renew"></span>
202
                        <div class="alert alert-info">
204
                        <div class="alert alert-info">
203
                            <p>Item renewed</p>
205
                            <p>Item renewed <i>([% barcode | html %])</i></p>
204
                        </div>
206
                        </div>
205
                    [% ELSIF ( renewed == 0) %]
207
                    [% ELSIF ( renewed == 0) %]
206
                        <span class="sco-alert-warning renew"></span>
208
                        <span class="sco-alert-warning renew"></span>
Lines 215-221 Link Here
215
                    [% ELSIF ( returned == 1 ) %]
217
                    [% ELSIF ( returned == 1 ) %]
216
                        <span class="sco-alert-success return"></span>
218
                        <span class="sco-alert-success return"></span>
217
                        <div class="alert alert-info">
219
                        <div class="alert alert-info">
218
                            <p>Item checked in</p>
220
                            <p>Item checked in <i>([% barcode | html %])</i></p>
219
                        </div>
221
                        </div>
220
                    [% END %]
222
                    [% END %]
221
223
Lines 251-260 Link Here
251
                                        </h2></legend>
253
                                        </h2></legend>
252
                                    <div class="row">
254
                                    <div class="row">
253
                                        <div class="col">
255
                                        <div class="col">
254
                                            <label for="barcode">Scan a new item or enter its barcode:</label>
256
                                            <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>
255
                                        </div>
257
                                        </div>
256
                                        <div class="col-3">
258
                                        <div class="col-3">
257
                                            <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
259
                                            [% IF Koha.Preference('BatchCheckouts') %]
260
                                                <textarea id="barcode" name="barcode" rows="10" cols="30" class="focus form-control"></textarea>
261
                                            [% ELSE %]
262
                                                <input id="barcode" name="barcode" size="20" type="text" class="focus form-control" autocomplete="off" />
263
                                            [% END %]
258
                                        </div>
264
                                        </div>
259
                                        <div class="col-auto">
265
                                        <div class="col-auto">
260
                                            <button type="submit" class="btn btn-primary">Submit</button>
266
                                            <button type="submit" class="btn btn-primary">Submit</button>
(-)a/opac/sco/sco-main.pl (-9 / +43 lines)
Lines 93-99 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, $barcodestr, $confirmed, $newissues) = (
97
    $query->param("op")         || '',
97
    $query->param("op")         || '',
98
    $query->param("patronlogin")|| '',
98
    $query->param("patronlogin")|| '',
99
    $query->param("patronpw")   || '',
99
    $query->param("patronpw")   || '',
Lines 109-115 if ($op eq "logout") { Link Here
109
    undef $jwt;
109
    undef $jwt;
110
}
110
}
111
111
112
$barcode = barcodedecode( $barcode ) if $barcode;
112
my $barcodes = [];
113
if ( $barcodestr ) {
114
    push @$barcodes, split( /\s\n/, $barcodestr );
115
    $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ];
116
}
113
117
114
my @newissueslist = split /,/, $newissues;
118
my @newissueslist = split /,/, $newissues;
115
my $issuenoconfirm = 1; #don't need to confirm on issue.
119
my $issuenoconfirm = 1; #don't need to confirm on issue.
Lines 139-148 my $branch = $issuer->{branchcode}; Link Here
139
my $confirm_required = 0;
143
my $confirm_required = 0;
140
my $return_only = 0;
144
my $return_only = 0;
141
145
146
if ( C4::Context->preference('BatchCheckouts') ) {
147
    my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories');
148
    my $categorycode = $issuer->{categorycode};
149
    if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) {
150
        # do nothing - logged in patron is allowed to do batch checkouts
151
    } else {
152
        # patron category not allowed to do batch checkouts, only allow first barcode
153
        while ( scalar @$barcodes > 1 ) {
154
            pop @$barcodes;
155
        }
156
    }
157
} else {
158
    # batch checkouts not enabled, only allow first barcode
159
    while ( scalar @$barcodes > 1 ) {
160
        pop @$barcodes;
161
    }
162
}
163
142
if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) {
164
if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) {
143
    my $success = 1;
165
    my $success = 1;
144
166
145
167
  foreach my $barcode ( @$barcodes ) {
146
    my $item = Koha::Items->find( { barcode => $barcode } );
168
    my $item = Koha::Items->find( { barcode => $barcode } );
147
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
169
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
148
        if ( defined($item)
170
        if ( defined($item)
Lines 162-171 if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) { Link Here
162
        ($success) = AddReturn( $barcode, $branch )
184
        ($success) = AddReturn( $barcode, $branch )
163
    }
185
    }
164
186
165
    $template->param( returned => $success );
187
    $template->param(
188
        returned => $success,
189
        barcode => $barcode
190
    );
191
  } # foreach barcode in barcodes
166
}
192
}
167
elsif ( $patron && ( $op eq 'checkout' ) ) {
193
elsif ( $patron && ( $op eq 'checkout' ) ) {
168
194
  foreach my $barcode ( @$barcodes ) {
169
    my $item = Koha::Items->find( { barcode => $barcode } );
195
    my $item = Koha::Items->find( { barcode => $barcode } );
170
    my $impossible  = {};
196
    my $impossible  = {};
171
    my $needconfirm = {};
197
    my $needconfirm = {};
Lines 208-221 elsif ( $patron && ( $op eq 'checkout' ) ) { Link Here
208
                barcode    => $barcode,
234
                barcode    => $barcode,
209
            );
235
            );
210
        }
236
        }
237
        last;
211
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
238
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
212
        $template->param(
239
        $template->param(
213
                renew               => 1,
240
                renew               => 1,
214
                barcode             => $barcode,
241
                barcode             => $barcode,
215
                confirm             => 1,
242
                confirm             => $item->biblio->title,
216
                confirm_renew_issue => 1,
243
                confirm_renew_issue => 1,
217
                hide_main           => 1,
244
                hide_main           => 1,
218
        );
245
        );
246
        last;
219
    } elsif ( $confirm_required && !$confirmed ) {
247
    } elsif ( $confirm_required && !$confirmed ) {
220
        $template->param(
248
        $template->param(
221
            impossible                => 1,
249
            impossible                => 1,
Lines 225-230 elsif ( $patron && ( $op eq 'checkout' ) ) { Link Here
225
        if ($issue_error eq 'DEBT') {
253
        if ($issue_error eq 'DEBT') {
226
            $template->param(DEBT => $needconfirm->{DEBT});
254
            $template->param(DEBT => $needconfirm->{DEBT});
227
        }
255
        }
256
        last;
228
    } else {
257
    } else {
229
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
258
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
230
            my ( $hold_existed, $item );
259
            my ( $hold_existed, $item );
Lines 247-253 elsif ( $patron && ( $op eq 'checkout' ) ) { Link Here
247
276
248
            AddIssue( $patron->unblessed, $barcode );
277
            AddIssue( $patron->unblessed, $barcode );
249
            $template->param( issued => 1 );
278
            $template->param( issued => 1 );
250
            push @newissueslist, $barcode;
279
            push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist );
251
280
252
            if ( $hold_existed ) {
281
            if ( $hold_existed ) {
253
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
282
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
Lines 273-281 elsif ( $patron && ( $op eq 'checkout' ) ) { Link Here
273
            );
302
            );
274
        }
303
        }
275
    }
304
    }
305
  } # foreach barcode in barcodes
276
} # $op
306
} # $op
277
307
278
if ( $patron && ( $op eq 'renew' ) ) {
308
if ( $patron && ( $op eq 'renew' ) ) {
309
  foreach my $barcode ( @$barcodes ) {
279
    my $item = Koha::Items->find({ barcode => $barcode });
310
    my $item = Koha::Items->find({ barcode => $barcode });
280
311
281
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
312
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
Lines 289-299 if ( $patron && ( $op eq 'renew' ) ) { Link Here
289
                }
320
                }
290
            );
321
            );
291
            push @newissueslist, $barcode;
322
            push @newissueslist, $barcode;
292
            $template->param( renewed => 1 );
323
            $template->param(
324
                renewed => 1,
325
                barcode => $barcode
326
            );
293
        }
327
        }
294
    } else {
328
    } else {
295
        $template->param( renewed => 0 );
329
        $template->param( renewed => 0 );
296
    }
330
    }
331
  } # foreach barcode in barcodes
297
}
332
}
298
333
299
if ( $patron) {
334
if ( $patron) {
300
- 

Return to bug 32256