Bug 34146: Do not allow multiple copies to crash server
Currently hardcoded to 1000. Can be refined later. Let's first prevent this kind of accidents. Test plan: Add additem.pl. Edit the 1000 to 2. Restart all. Add 3 multiple copies. Notice that you got 2. Revert your code change. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> (cherry picked from commit2eba689a5a
) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commit4945626e32
) Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
parent
c1f054023e
commit
58cbb8f450
2 changed files with 3 additions and 3 deletions
|
@ -45,7 +45,7 @@ use Koha::Result::Boolean;
|
|||
|
||||
use Encode qw( encode_utf8 );
|
||||
use List::MoreUtils qw( any uniq );
|
||||
use List::Util qw( first );
|
||||
use List::Util qw( first min );
|
||||
use MARC::File::XML;
|
||||
use MIME::Base64 qw( decode_base64url encode_base64url );
|
||||
use Storable qw( freeze thaw );
|
||||
|
@ -230,7 +230,7 @@ if ($op eq "additem") {
|
|||
my $add_duplicate_submit = $input->param('add_duplicate_submit');
|
||||
my $add_multiple_copies_submit = $input->param('add_multiple_copies_submit');
|
||||
my $save_as_template_submit = $input->param('save_as_template_submit');
|
||||
my $number_of_copies = $input->param('number_of_copies');
|
||||
my $number_of_copies = min( scalar $input->param('number_of_copies'), 1000 ); # TODO refine hardcoded maximum?
|
||||
|
||||
my @columns = Koha::Items->columns;
|
||||
my $item = Koha::Item->new;
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
<label for="number_of_copies">Number of copies of this item to add: </label>
|
||||
<input type="text" id="number_of_copies" name="number_of_copies" value="" size="2" />
|
||||
<input type="submit" id="add_multiple_copies_submit" name="add_multiple_copies_submit" value="Add" onclick="javascript:return Check(this.form) && CheckMultipleAdd(this.form.number_of_copies.value);" /> <a href="#" id="cancel_add_multiple" class="cancel">Cancel</a>
|
||||
<div class="hint"><p>The barcode you enter will be incremented for each additional item.</p></div>
|
||||
<div class="hint"><p>Maximum currently set to 1000. The barcode you enter will be incremented for each additional item.</p></div>
|
||||
</fieldset>
|
||||
|
||||
<span id="savetemplate">
|
||||
|
|
Loading…
Reference in a new issue