From f88d2e7983a8962e6c7de424dee7cc20200f2c74 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 29 Jun 2023 06:18:04 +0000 Subject: [PATCH] Bug 34146: Counterpart for serials-edit Not only additem suffers from it. We can do the same with serials-edit. This patch adds a server-side and client-side check as we did for additem. Test plan: Receive serial with adding items. Try to add more than 999 items in number of copies. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/serials/serials-edit.tt | 4 ++-- serials/serials-edit.pl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt index 8c5ba5d8db..172a015e6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt @@ -307,7 +307,7 @@ $(document).ready(function() {
- The barcode you enter will be incremented for each additional item.

+ Number of copies limited to under 1000. The barcode you enter will be incremented for each additional item.

@@ -458,7 +458,7 @@ $(document).ready(function() {
- The barcode you enter will be incremented for each additional item.

+ Number of copies limited to under 1000. The barcode you enter will be incremented for each additional item.

diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl index b80fa46f21..060bfbb19f 100755 --- a/serials/serials-edit.pl +++ b/serials/serials-edit.pl @@ -77,6 +77,7 @@ use Koha::Items; use Koha::Serial::Items; use List::MoreUtils qw( uniq ); +use List::Util qw( min ); my $query = CGI->new(); my $dbh = C4::Context->dbh; @@ -277,7 +278,7 @@ if ( $op and $op eq 'serialchangestatus' ) { my @serials = $query->multi_param('serial'); my @bibnums = $query->multi_param('bibnum'); my @itemid = $query->multi_param('itemid'); - my @num_copies = $query->multi_param('number_of_copies'); + my @num_copies = map { min($_, 1000); } $query->multi_param('number_of_copies'); #Rebuilding ALL the data for items into a hash # parting them on $itemid. -- 2.39.5