Replace function rand with mt_rand (prepare php 8)

This commit is contained in:
Laurent Destailleur
2016-03-05 15:01:25 +01:00
parent d8045e33bb
commit d1777a6783
15 changed files with 36 additions and 36 deletions

View File

@@ -117,7 +117,7 @@ $result=0;
while ($i < GEN_NUMBER_PROPAL && $result >= 0)
{
$i++;
$socid = rand(1, $num_socs);
$socid = mt_rand(1, $num_socs);
print "Proposal ".$i." for socid ".$socid;
$soc = new Societe($db);
@@ -140,14 +140,14 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$result=$propal->create($user);
if ($result >= 0)
{
$nbp = rand(2, 5);
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$propal->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
$result=$propal->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
if ($result < 0)
{
dol_print_error($db,$propal->error);