From 18394592894f9ee5c472425831fc294bf808a9d7 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 16 Nov 2003 16:41:29 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20g=E9n=E9ration=20des=20commandes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/system/gendata.php | 108 +++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/system/gendata.php b/htdocs/admin/system/gendata.php index 18ce53f65d8..42ee5570ab5 100644 --- a/htdocs/admin/system/gendata.php +++ b/htdocs/admin/system/gendata.php @@ -20,16 +20,15 @@ */ require("./pre.inc.php"); +$user->getrights('commande'); +$user->getrights('expedition'); + llxHeader(); ?> -

Attention

-

Ceci est un générateur de données aléatoires, ne +

Attention : Ceci est un générateur de données aléatoires, ne pas utiliser sur une base de données en production, les opérations ne sont pas réversibles

-
-Home | -Sociétés | -Produits | -Factures + +Home

query($sql)) { $num = $db->num_rows(); $i = 0; while ($i < $num) { $row = $db->fetch_row($i); $societesid[$i] = $row[0]; $i++; } } else { print "err"; } +$sql = "SELECT rowid FROM llx_commande"; $commandesid = array(); +if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; +while ($i < $num) { $row = $db->fetch_row($i); $commandesid[$i] = $row[0]; $i++; } } else { print "err"; } -print "". sizeof($societesid) ." sociétés "; -print " - ". sizeof($productsid) ." produits "; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ""; +print ""; +print '"; + +print '
SociétésProduitsFacturesCommandes
". sizeof($societesid) ."". sizeof($productsid) ."'; +print "". sizeof($commandesid) ."
'; print "

"; if ($action == 'product') @@ -129,7 +142,7 @@ if ($action == 'facture') } } -if ($action == 'societe') +if ($_GET["action"] == 'societe') { $rands = rand(1,400); @@ -163,5 +176,80 @@ if ($action == 'societe') } } +if ($_GET["action"] == 'commande') +{ + $dates = array (mktime(12,0,0,1,3,2003), + mktime(12,0,0,1,9,2003), + mktime(12,0,0,2,13,2003), + mktime(12,0,0,2,23,2003), + mktime(12,0,0,3,30,2003), + mktime(12,0,0,4,3,2003), + mktime(12,0,0,4,3,2003), + mktime(12,0,0,5,9,2003), + mktime(12,0,0,5,1,2003), + mktime(12,0,0,5,13,2003), + mktime(12,0,0,5,19,2003), + mktime(12,0,0,5,23,2003), + mktime(12,0,0,6,3,2003), + mktime(12,0,0,6,19,2003), + mktime(12,0,0,6,24,2003), + mktime(12,0,0,7,3,2003), + mktime(12,0,0,7,9,2003), + mktime(12,0,0,7,23,2003), + mktime(12,0,0,7,30,2003), + mktime(12,0,0,8,9,2003), + mktime(12,0,0,9,23,2003), + mktime(12,0,0,10,3,2003), + mktime(12,0,0,11,12,2003), + mktime(12,0,0,11,13,2003), + mktime(12,0,0,1,3,2002), + mktime(12,0,0,1,9,2002), + mktime(12,0,0,2,13,2002), + mktime(12,0,0,2,23,2002), + mktime(12,0,0,3,30,2002), + mktime(12,0,0,4,3,2002), + mktime(12,0,0,4,3,2002), + mktime(12,0,0,5,9,2002), + mktime(12,0,0,5,1,2002), + mktime(12,0,0,5,13,2002), + mktime(12,0,0,5,19,2002), + mktime(12,0,0,5,23,2002), + mktime(12,0,0,6,3,2002), + mktime(12,0,0,6,19,2002), + mktime(12,0,0,6,24,2002), + mktime(12,0,0,7,3,2002), + mktime(12,0,0,7,9,2002), + mktime(12,0,0,7,23,2002), + mktime(12,0,0,7,30,2002), + mktime(12,0,0,8,9,2002), + mktime(12,0,0,9,23,2002), + mktime(12,0,0,10,3,2002), + mktime(12,0,0,11,12,2003), + mktime(12,0,0,11,13,2003), + mktime(12,0,0,12,12,2003), + mktime(12,0,0,12,13,2003), + ); + + require DOL_DOCUMENT_ROOT."/commande/commande.class.php"; + + $com = new Commande($db); + + $com->soc_id = 4; + $com->date_commande = $dates[rand(1, sizeof($dates)-1)]; + $com->note = $HTTP_POST_VARS["note"]; + $com->source = 1; + $com->projetid = 0; + $com->remise_percent = 0; + + $pidrand = rand(1, sizeof($productsid)-1); + $com->add_product($productsid[rand(1, sizeof($productsid)-1)],rand(1,11),rand(1,6),rand(0,20)); + $id = $com->create($user); + print " " . strftime("%d %B %Y",$com->date_commande); + $com->fetch($id); + print " " . $com->valid($user); +} + + + llxFooter(); ?>