@@ -, +, @@ hardcoded - set the pref to 2 - try to delete a batch of 3 items: they are not displayed - try to modify a batch of 3 items: you are not allowed to do that - set the pref to 1000 and try again. Now items are displayed and you are allow to modify them. --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 9 +++++++++ koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc | 1 + .../prog/en/modules/admin/preferences/tools.pref | 5 +++++ tools/batchMod.pl | 6 +++--- 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -176,6 +176,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('MARCAuthorityControlField008','|| aca||aabn | a|a d',NULL,NULL,'Textarea'), ('MARCOrgCode','OSt','','Define MARC Organization Code - 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'), +('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer'), ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), ('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'), ('maxRecordsForFacets','20',NULL,NULL,'Integer'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7825,6 +7825,15 @@ if ( CheckVersion($DBversion) ) { } +$DBversion = "3.15.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(q| + INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer') + |); + print "Upgrade to $DBversion done (Bug 11343: Add system preference MaxItemsForBatch )\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc @@ -15,6 +15,7 @@ [% IF ( searching ) %]
  • [% ELSE %]
  • [% END %]Searching
  • [% IF ( serials ) %]
  • [% ELSE %]
  • [% END %]Serials
  • [% IF ( staff_client ) %]
  • [% ELSE %]
  • [% END %]Staff client
  • +[% IF ( tools ) %]
  • [% ELSE %]
  • [% END %]Tools
  • [% IF ( web_services ) %]
  • [% ELSE %]
  • [% END %]Web services
  • --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref @@ -0,0 +1,5 @@ +Tools: + - + - Maximum number of items record to process in a batch (modification or deletion) + - pref: MaxItemsForBatch + class: Integer --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -111,7 +111,7 @@ 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) <= 1000) { + if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsForBatch") // 1000 ) ) { $items_display_hashref=BuildItemsData(@itemnumbers); } else { # Else, we only display the barcode @@ -267,8 +267,8 @@ 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 1000 - if (scalar(@itemnumbers) <= 1000) { + # Only display the items if there are no more than pref MaxItemsForBatch + if (scalar(@itemnumbers) <= ( C4::Context->preference("MaxItemsForBatch") // 1000 ) ) { $items_display_hashref=BuildItemsData(@itemnumbers); } else { $template->param("too_many_items" => scalar(@itemnumbers)); --