Bug 32256: Display barcodes not checked out in batch

This patch encourages the user to check out certain items individually if they fail to be checked out in a batch.

This way they will be presented with more useful error messages.

To test:

1 - Enable BatchCheckouts, select nothing in BatchCheckoutsValidCategories
2 - Find three barcodes
3 - log into SCO with a user in category Patron, paste the barcodes separated by newlines and submit. confirm one item is succcessfully checked out and the other two barcodes are listed in the pop-up, encouraged to try checking out individually.
4 - select Patron in BatchCheckoutsValidCategories
5 - log into SCO with your Patron user again, confirm you can check out multiple items at a time

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Aleisha Amohia 2024-04-15 00:52:58 +00:00 committed by Katrin Fischer
parent e9f387cfc3
commit 3c57d0f3db
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 25 additions and 2 deletions

View File

@ -241,6 +241,17 @@
</div>
[% END %]
[% IF ( circ_error_BATCH_CHECKOUT ) %]
<div class="alert alert-warning">
<h3>Item cannot be checked out in a batch</h3>
<p>Check out the following item(s) individually:</p>
<ul>
[% FOREACH barcode IN circ_error_BATCH_CHECKOUT %]
<li><i>[% barcode | html %]</i></li>
[% END %]
</ul>
</div>
[% END %]
[% UNLESS ( hide_main ) %]

View File

@ -145,15 +145,27 @@ if ( C4::Context->preference('BatchCheckouts') and $patron ) {
# do nothing - logged in patron is allowed to do batch checkouts
} else {
# patron category not allowed to do batch checkouts, only allow first barcode
my @error_barcodes;
while ( scalar @$barcodes > 1 ) {
pop @$barcodes;
my $error_barcode = pop @$barcodes;
push @error_barcodes, $error_barcode;
}
$template->param(
"circ_error_BATCH_CHECKOUT" => \@error_barcodes,
) if @$barcodes;
}
} else {
# batch checkouts not enabled, only allow first barcode
my @error_barcodes;
while ( scalar @$barcodes > 1 ) {
pop @$barcodes;
my $error_barcode = pop @$barcodes;
push @error_barcodes, $error_barcode;
}
$template->param(
"circ_error_BATCH_CHECKOUT" => \@error_barcodes,
) if @$barcodes;
}
if ( $patron && $op eq "cud-returnbook" && $allowselfcheckreturns ) {