From ce36c6e56a4d11c449bf278127753eb424df0649 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 Aug 2024 13:10:53 +0200 Subject: [PATCH] Bug 37675: Make random generates the same numbers less probable This is really not the ideal patch but definitely the easiest to write and with (hopefully) the least side-effects possible. Ideally we would like to rethink how this "id" is generated and start from ... 1 To improve this patch we could follow-up and store the list of the generate numbers, then generate a new one if it exists already. --- cataloguing/addbiblio.pl | 2 +- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 9d41a15a645..1b973b660e0 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -183,7 +183,7 @@ sub MARCfindbreeding { =cut sub CreateKey { - return int(rand(1000000)); + return int(rand(10000000)); } =head2 GetMandatoryFieldZ3950 diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index 2cb734ef6e1..ed0ac18b794 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -506,7 +506,7 @@ function UnCloneField(index) { * This function create a random number */ function CreateKey(){ - return parseInt(Math.random() * 100000); + return parseInt(Math.random() * 10000000); } /* Functions developed for additem.tt */ -- 2.34.1