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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2023-06-29 06:18:04 +00:00 committed by Tomas Cohen Arazi
parent 143693e217
commit f88d2e7983
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 4 additions and 3 deletions

View file

@ -307,7 +307,7 @@ $(document).ready(function() {
<hr>
<div class="subfield_line">
<label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p>
<label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" maxlength="3" size="2"> <span class="hint">Number of copies limited to under 1000. The barcode you enter will be incremented for each additional item.</p>
</div>
<input type="hidden" name="moditem" value="" />
@ -458,7 +458,7 @@ $(document).ready(function() {
<hr>
<div class="subfield_line">
<label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" size="2"> <span class="hint">The barcode you enter will be incremented for each additional item.</p>
<label for="number_of_copies">Number of copies to be made of this item </label> <input type="text" id="number_of_copies[% newserialloo.serialid | html %][% newserialloo.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]" name="number_of_copies" value="1" maxlength="3" size="2"> <span class="hint">Number of copies limited to under 1000. The barcode you enter will be incremented for each additional item.</p>
</div>
<input type="hidden" name="moditem" value="" />

View file

@ -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.