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 86-92 if (defined C4::Context->preference('SCOAllowCheckin')) { Link Here
86
}
86
}
87
87
88
my $issuerid = $loggedinuser;
88
my $issuerid = $loggedinuser;
89
my ( $op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues, $load_checkouts ) = (
89
my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_checkouts ) = (
90
    $query->param("op")             || '',
90
    $query->param("op")             || '',
91
    $query->param("patronlogin")    || '',
91
    $query->param("patronlogin")    || '',
92
    $query->param("patronpw")       || '',
92
    $query->param("patronpw")       || '',
Lines 104-110 if ($op eq "logout") { Link Here
104
    undef $jwt;
104
    undef $jwt;
105
}
105
}
106
106
107
$barcode = barcodedecode( $barcode ) if $barcode;
107
my $barcodes = [];
108
if ( $barcodestr ) {
109
    push @$barcodes, split( /\s\n/, $barcodestr );
110
    $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ];
111
}
108
112
109
my @newissueslist = split /,/, $newissues;
113
my @newissueslist = split /,/, $newissues;
110
my $issuenoconfirm = 1; #don't need to confirm on issue.
114
my $issuenoconfirm = 1; #don't need to confirm on issue.
Lines 134-143 my $branch = $issuer->{branchcode}; Link Here
134
my $confirm_required = 0;
138
my $confirm_required = 0;
135
my $return_only = 0;
139
my $return_only = 0;
136
140
141
if ( C4::Context->preference('BatchCheckouts') ) {
142
    my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories');
143
    my $categorycode = $issuer->{categorycode};
144
    if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) {
145
        # do nothing - logged in patron is allowed to do batch checkouts
146
    } else {
147
        # patron category not allowed to do batch checkouts, only allow first barcode
148
        while ( scalar @$barcodes > 1 ) {
149
            pop @$barcodes;
150
        }
151
    }
152
} else {
153
    # batch checkouts not enabled, only allow first barcode
154
    while ( scalar @$barcodes > 1 ) {
155
        pop @$barcodes;
156
    }
157
}
158
137
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
159
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {
138
    my $success = 1;
160
    my $success = 1;
139
161
140
162
  foreach my $barcode ( @$barcodes ) {
141
    my $item = Koha::Items->find( { barcode => $barcode } );
163
    my $item = Koha::Items->find( { barcode => $barcode } );
142
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
164
    if ( $success && C4::Context->preference("CircConfirmItemParts") ) {
143
        if ( defined($item)
165
        if ( defined($item)
Lines 157-166 if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) { Link Here
157
        ($success) = AddReturn( $barcode, $branch )
179
        ($success) = AddReturn( $barcode, $branch )
158
    }
180
    }
159
181
160
    $template->param( returned => $success );
182
    $template->param(
183
        returned => $success,
184
        barcode => $barcode
185
    );
186
  } # foreach barcode in barcodes
161
}
187
}
162
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
163
188
189
elsif ( $patron && ( $op eq 'cud-checkout' ) ) {
190
  foreach my $barcode ( @$barcodes ) {
164
    my $item = Koha::Items->find( { barcode => $barcode } );
191
    my $item = Koha::Items->find( { barcode => $barcode } );
165
    my $impossible  = {};
192
    my $impossible  = {};
166
    my $needconfirm = {};
193
    my $needconfirm = {};
Lines 203-216 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
203
                barcode    => $barcode,
230
                barcode    => $barcode,
204
            );
231
            );
205
        }
232
        }
233
        last;
206
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
234
    } elsif ( $needconfirm->{RENEW_ISSUE} ){
207
        $template->param(
235
        $template->param(
208
                renew               => 1,
236
                renew               => 1,
209
                barcode             => $barcode,
237
                barcode             => $barcode,
210
                confirm             => 1,
238
                confirm             => $item->biblio->title,
211
                confirm_renew_issue => 1,
239
                confirm_renew_issue => 1,
212
                hide_main           => 1,
240
                hide_main           => 1,
213
        );
241
        );
242
        last;
214
    } elsif ( $confirm_required && !$confirmed ) {
243
    } elsif ( $confirm_required && !$confirmed ) {
215
        $template->param(
244
        $template->param(
216
            impossible                => 1,
245
            impossible                => 1,
Lines 220-225 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
220
        if ($issue_error eq 'DEBT') {
249
        if ($issue_error eq 'DEBT') {
221
            $template->param(DEBT => $needconfirm->{DEBT});
250
            $template->param(DEBT => $needconfirm->{DEBT});
222
        }
251
        }
252
        last;
223
    } else {
253
    } else {
224
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
254
        if ( $confirmed || $issuenoconfirm ) {    # we'll want to call getpatroninfo again to get updated issues.
225
            my ( $hold_existed, $item );
255
            my ( $hold_existed, $item );
Lines 242-248 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
242
272
243
            my $new_issue = AddIssue( $patron, $barcode );
273
            my $new_issue = AddIssue( $patron, $barcode );
244
            $template->param( issued => 1, new_issue => $new_issue );
274
            $template->param( issued => 1, new_issue => $new_issue );
245
            push @newissueslist, $barcode;
275
            push @newissueslist, $barcode unless ( grep /^$barcode$/, @newissueslist );
246
276
247
            if ( $hold_existed ) {
277
            if ( $hold_existed ) {
248
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
278
                my $dtf = Koha::Database->new->schema->storage->datetime_parser;
Lines 268-276 elsif ( $patron && ( $op eq 'cud-checkout' ) ) { Link Here
268
            );
298
            );
269
        }
299
        }
270
    }
300
    }
301
  } # foreach barcode in barcodes
271
} # $op
302
} # $op
272
303
273
if ( $patron && ( $op eq 'cud-renew' ) ) {
304
if ( $patron && ( $op eq 'cud-renew' ) ) {
305
  foreach my $barcode ( @$barcodes ) {
274
    my $item = Koha::Items->find({ barcode => $barcode });
306
    my $item = Koha::Items->find({ barcode => $barcode });
275
307
276
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
308
    if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) {
Lines 284-294 if ( $patron && ( $op eq 'cud-renew' ) ) { Link Here
284
                }
316
                }
285
            );
317
            );
286
            push @newissueslist, $barcode;
318
            push @newissueslist, $barcode;
287
            $template->param( renewed => 1 );
319
            $template->param(
320
                renewed => 1,
321
                barcode => $barcode
322
            );
288
        }
323
        }
289
    } else {
324
    } else {
290
        $template->param( renewed => 0 );
325
        $template->param( renewed => 0 );
291
    }
326
    }
327
  } # foreach barcode in barcodes
292
}
328
}
293
329
294
if ( $patron) {
330
if ( $patron) {
295
- 

Return to bug 32256