Bug 28445: Respect MaxItemsToDisplayForBatchMod from job detail view

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-10-13 17:27:23 +02:00
parent ef09becd10
commit c048faac3f
2 changed files with 16 additions and 8 deletions

View File

@ -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;
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},
};
return {
items => $items_table->{items},
item_header_loop => $items_table->{headers},
};
}
}
1;

View File

@ -1,3 +1,5 @@
[% USE Koha %]
[% BLOCK report %]
[% SET report = job.report %]
[% IF report %]
@ -30,7 +32,9 @@
</div>
[% END %]
[% IF items.size %]
[% IF too_many_items_display %]
<p>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.</p>
[% ELSIF items.size %]
[% PROCESS items_table_batchmod headers => item_header_loop, items => items, display_columns_selection => 1 %]
[% END %]
[% END %]