From fb4b91c4e172f696177a00f47a920d37cc33d6f3 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 26 Mar 2019 20:20:29 +0000 Subject: [PATCH] Bug 19722: Don't show items at job completion if over pref To test: 1 - Set MaxItemsToDisplayForBatchMod to some number 2 - Modify less items than that 3 - Note they show a - Note if over 1000 they show in a simple display 4 - Modify more items 5 - Note they do not show and you see a note Signed-off-by: Josef Moravec --- .../prog/en/modules/tools/batchMod-edit.tt | 20 +++++++----- tools/batchMod.pl | 36 +++++++++++++--------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index e96dda3d0d..968770d323 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -211,15 +211,19 @@ $(document).ready(function(){ [% END %] -[% IF ( simple_items_display ) %] -

The following items were modified:

- [% END %] [% IF ( show ) %] diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 8e1e854ab0..85077ab33c 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -119,21 +119,27 @@ if ($op eq "action") { # Once the job is done if ($completedJobID) { # If we have a reasonable amount of items, we display them - if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsToDisplayForBatchDel") // 1000 ) ) { - $items_display_hashref=BuildItemsData(@itemnumbers); - } else { - # Else, we only display the barcode - my @simple_items_display = map { - my $itemnumber = $_; - my $item = Koha::Items->find($itemnumber); - { - itemnumber => $itemnumber, - barcode => $item ? ( $item->barcode // q{} ) : q{}, - biblionumber => $item ? $item->biblio->biblionumber : q{}, - }; - } @itemnumbers; - $template->param("simple_items_display" => \@simple_items_display); - } + my $max_items = $del ? C4::Context->preference("MaxItemsToDisplayForBatchDel") : C4::Context->preference("MaxItemsToDisplayForBatchMod"); + if (scalar(@itemnumbers) <= $max_items ){ + if (scalar(@itemnumbers) <= 1000 ) { + $items_display_hashref=BuildItemsData(@itemnumbers); + } else { + # Else, we only display the barcode + my @simple_items_display = map { + my $itemnumber = $_; + my $item = Koha::Items->find($itemnumber); + { + itemnumber => $itemnumber, + barcode => $item ? ( $item->barcode // q{} ) : q{}, + biblionumber => $item ? $item->biblio->biblionumber : q{}, + }; + } @itemnumbers; + $template->param("simple_items_display" => \@simple_items_display); + } + } else { + $template->param( "too_many_items_display" => scalar(@itemnumbers) ); + $template->param( "job_completed" => 1 ); + } # Setting the job as done my $job = C4::BackgroundJob->fetch($sessionID, $completedJobID); -- 2.11.0