Bugzilla – Attachment 69426 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 - Add MaxItemsToDisplayForBatchMod systempreference
Bug-19722---Add-MaxItemsToDisplayForBatchMod-syste.patch (text/plain), 7.34 KB, created by
Nick Clemens (kidclamp)
on 2017-11-30 23:29:29 UTC
(
hide
)
Description:
Bug 19722 - Add MaxItemsToDisplayForBatchMod systempreference
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-11-30 23:29:29 UTC
Size:
7.34 KB
patch
obsolete
>From 1a17485a370828b42c42421a5ca48b6b95502285 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 30 Nov 2017 23:22:27 +0000 >Subject: [PATCH] Bug 19722 - Add MaxItemsToDisplayForBatchMod systempreference > >To test: >1 - Get a list of itemnumbers or barcodes >2 - Set MaxItemsToProcessForBatchMod to less than this number of items >3 - Attempt to batch edit, you arent allowed >4 - Set MaxItemsToProcessForBatchMod to some hugh number like 60000 >5 - Try a list of as many items as possible 30000 was good for me (they > should exist in your system) >6 - Try to batch edit, system will timeout on displaying these items >7 - Apply patch, update database >8 - Set MaxItemsToDisplayForBatchMod to 1000 (default) >9 - Try large file again, should not display items, but allow >modification, wait for this to finish >10 - SetMaxItemsToProcessForBatchMod to 1000 and try large file again >11 - Should be prohibited as before >--- > .../bug_19722_add_MaxItemsToDisplayForBatchMod_pref.perl | 8 ++++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../intranet-tmpl/prog/en/modules/admin/preferences/tools.pref | 5 +++++ > koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt | 10 ++++++---- > tools/batchMod.pl | 9 +++++---- > 5 files changed, 25 insertions(+), 8 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_19722_add_MaxItemsToDisplayForBatchMod_pref.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_19722_add_MaxItemsToDisplayForBatchMod_pref.perl b/installer/data/mysql/atomicupdate/bug_19722_add_MaxItemsToDisplayForBatchMod_pref.perl >new file mode 100644 >index 0000000..2e056ce >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_19722_add_MaxItemsToDisplayForBatchMod_pref.perl >@@ -0,0 +1,8 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) >+ VALUES ('MaxItemsToDisplayForBatchMod','1000',NULL,'Display up to a given number of items in a single item modification batch.','Integer')" >+ ); >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 19722 - Add a MaxItemsToDisplayForBatchMod preference)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index f6e666b..9e87331 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -259,6 +259,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'), > ('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), > ('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'), >+('MaxItemsToDisplayForBatchMod','1000',NULL,'Display up to a given number of items in a single item modification batch.','Integer'), > ('MaxItemsToProcessForBatchMod','1000',NULL,'Process up to a given number of items in a single item modification batch.','Integer'), > ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), > ('MaxOpenSuggestions','',NULL,'Limit the number of open suggestions a patron can have at once','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >index 4ca398d..52dfd85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref >@@ -10,6 +10,11 @@ Tools: > - pref: MaxItemsToDisplayForBatchDel > class: integer > - items in a single item deletion batch. >+ - >+ - Display up to >+ - pref: MaxItemsToDisplayForBatchMod >+ class: integer >+ - items in a single item modification batch. > Patron cards: > - > - Limit the number of creator images stored in the database to >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 c25dfe4..5a331d8 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 >@@ -103,7 +103,7 @@ $(document).ready(function(){ > </tbody> > </table> > [% IF ( item_loop ) %] >- [% UNLESS ( too_many_items ) %] >+ [% UNLESS ( too_many_items_display ) %] > <h4>The following barcodes were found: </h4> > [% END %] > [% END %] >@@ -176,14 +176,16 @@ $(document).ready(function(){ > > [% IF ( show ) %] > >-[% IF ( too_many_items ) %] >- <p>Too many items ([% too_many_items %]): You are not allowed to edit more than [% Koha.Preference('MaxItemsToProcessForBatchMod') %] items in a batch.</p> >+[% IF ( too_many_items_process ) %] >+ <p>Too many items ([% too_many_items_process %]): You are not allowed to edit more than [% Koha.Preference('MaxItemsToProcessForBatchMod') %] items in a batch.</p> >+[% ELSIF ( too_many_items_display ) %] >+ <p>Too many items ([% too_many_items_display %]): You are editing more than [% Koha.Preference('MaxItemsToDisplayForBatchMod') %] items in a batch, items will not be shown.</p> > [% FOREACH itemnumber IN itemnumbers_array %] > <input type="hidden" name="itemnumber" value="[% itemnumber %]" /> > [% END %] > [% END %]<!-- /too_many_items --> > >-[% IF ( item_loop ) %] >+[% UNLESS (too_many_items_process) %] > <div id="cataloguing_additem_newitem"> > <h2>Edit Items</h2> > <div class="hint">Checking the box right next the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div> >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 0ab4db7..b20700d 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -283,13 +283,14 @@ if ($op eq "show"){ > # Flag to tell the template there are valid results, hidden or not > if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); } > # Only display the items if there are no more than pref MaxItemsToProcessForBatchMod or MaxItemsToDisplayForBatchDel >- my $max_items = $del >+ my $max_display_items = $del > ? C4::Context->preference("MaxItemsToDisplayForBatchDel") >- : C4::Context->preference("MaxItemsToProcessForBatchMod"); >- if (scalar(@itemnumbers) <= ( $max_items // 1000 ) ) { >+ : C4::Context->preference("MaxItemsToDisplayForBatchMod"); >+ $template->param("too_many_items_process" => scalar(@itemnumbers)) if !$del && scalar(@itemnumbers) >= C4::Context->preference("MaxItemsToProcessForBatchMod"); >+ if (scalar(@itemnumbers) <= ( $max_display_items // 1000 ) ) { > $items_display_hashref=BuildItemsData(@itemnumbers); > } else { >- $template->param("too_many_items" => scalar(@itemnumbers)); >+ $template->param("too_many_items_display" => scalar(@itemnumbers)); > # Even if we do not display the items, we need the itemnumbers > $template->param(itemnumbers_array => \@itemnumbers); > } >-- >2.1.4
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