From 3c57d0f3db065b0aebbebad1c08b14bee8bd3016 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 15 Apr 2024 00:52:58 +0000 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Andrew Fuerste Henry Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- .../bootstrap/en/modules/sco/sco-main.tt | 11 +++++++++++ opac/sco/sco-main.pl | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index 2ef8b7134d..13e510ce7b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -241,6 +241,17 @@ [% END %] + [% IF ( circ_error_BATCH_CHECKOUT ) %] +
+

Item cannot be checked out in a batch

+

Check out the following item(s) individually:

+
    + [% FOREACH barcode IN circ_error_BATCH_CHECKOUT %] +
  • [% barcode | html %]
  • + [% END %] +
+
+ [% END %] [% UNLESS ( hide_main ) %] diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 7f4593b71b..c049f2bb01 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -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 ) { -- 2.39.5