From efa2110a8cf68764f3cb69edbf0535e8ef573b93 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 Oct 2021 17:27:23 +0200 Subject: [PATCH] Bug 28445: Respect MaxItemsToDisplayForBatchMod from job detail view Signed-off-by: Nick Clemens --- Koha/BackgroundJob/BatchUpdateItem.pm | 20 +++++++++++-------- .../batch_item_record_modification.inc | 6 +++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Koha/BackgroundJob/BatchUpdateItem.pm b/Koha/BackgroundJob/BatchUpdateItem.pm index 8336b16e23..6c7246e240 100644 --- a/Koha/BackgroundJob/BatchUpdateItem.pm +++ b/Koha/BackgroundJob/BatchUpdateItem.pm @@ -177,14 +177,18 @@ sub additional_report { my $job = Koha::BackgroundJobs->find( $args->{job_id} ); my $itemnumbers = $job->report->{modified_itemnumbers}; - my $items_table = - Koha::UI::Table::Builder::Items->new( { itemnumbers => $itemnumbers } ) - ->build_table; - - return { - items => $items_table->{items}, - item_header_loop => $items_table->{headers}, - }; + if ( scalar(@$itemnumbers) > C4::Context->preference('MaxItemsToDisplayForBatchMod') ) { + return { too_many_items_display => 1 }; + } else { + my $items_table = + Koha::UI::Table::Builder::Items->new( { itemnumbers => $itemnumbers } ) + ->build_table; + + return { + items => $items_table->{items}, + item_header_loop => $items_table->{headers}, + }; + } } 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc index cbefbbe416..4d4fed19fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_item_record_modification.inc @@ -1,3 +1,5 @@ +[% USE Koha %] + [% BLOCK report %] [% SET report = job.report %] [% IF report %] @@ -30,7 +32,9 @@ [% END %] - [% IF items.size %] + [% IF too_many_items_display %] +

Too many items ([% too_many_items_display | html %]): You have edited more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') | html %] items in a batch, items will not be shown.

+ [% ELSIF items.size %] [% PROCESS items_table_batchmod headers => item_header_loop, items => items, display_columns_selection => 1 %] [% END %] [% END %] -- 2.20.1