Bugzilla – Attachment 87079 Details for
Bug 19722
Add a MaxItemsToDisplayForBatchMod preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19722: Don't show items at job completion if over pref
Bug-19722-Dont-show-items-at-job-completion-if-ove.patch (text/plain), 4.58 KB, created by
Josef Moravec
on 2019-03-27 15:50:07 UTC
(
hide
)
Description:
Bug 19722: Don't show items at job completion if over pref
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-27 15:50:07 UTC
Size:
4.58 KB
patch
obsolete
>From fb4b91c4e172f696177a00f47a920d37cc33d6f3 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >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 <josef.moravec@gmail.com> >--- > .../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(){ > </div> > [% END %]<!-- /item_loop --> > >-[% IF ( simple_items_display ) %] >- <p>The following items were modified:</p> >- <ul> >- [% FOREACH simple_items_displa IN simple_items_display %] >- <li> >- [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% simple_items_displa.biblionumber | uri %]&itemnumber=[% simple_items_displa.itemnumber | uri %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %] >- </li> >+[% IF ( simple_items_display || job_completed ) %] >+ [% 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> >+ [% ELSE %] >+ <p>The following items were modified:</p> >+ <ul> >+ [% FOREACH simple_items_displa IN simple_items_display %] >+ <li> >+ [% IF ( CAN_user_editcatalogue_edit_items ) %]<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% simple_items_displa.biblionumber | uri %]&itemnumber=[% simple_items_displa.itemnumber | uri %]">[% simple_items_displa.barcode | html %]</a>[% ELSE %][% simple_items_displa.barcode | html %][% END %] >+ </li> >+ [% END %] >+ </ul> > [% END %] >- </ul> > [% END %]<!-- /simple_items_display --> > > [% 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19722
:
69426
|
74682
|
77020
|
87033
|
87034
|
87035
|
87077
|
87078
| 87079