From aec4deb681ab43f08aab075869ddc1d342c40f92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Aug 2005 21:46:05 +0000 Subject: [PATCH] =?UTF-8?q?Qual:=20Supprime=20scripts=20de=20g=E9n=E9ratio?= =?UTF-8?q?n=20de=20donn=E9es=20rendus=20obsoletes=20par=20nouveaux=20dans?= =?UTF-8?q?=20repertoires=20dev.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/system/gen-commande.php | 91 --------- htdocs/admin/system/gendata.php | 268 --------------------------- 2 files changed, 359 deletions(-) delete mode 100644 htdocs/admin/system/gen-commande.php delete mode 100644 htdocs/admin/system/gendata.php diff --git a/htdocs/admin/system/gen-commande.php b/htdocs/admin/system/gen-commande.php deleted file mode 100644 index a943b3a9040..00000000000 --- a/htdocs/admin/system/gen-commande.php +++ /dev/null @@ -1,91 +0,0 @@ - - * Copyright (C) 2004 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/*! \file htdocs/admin/system/gen-commande.php - \brief Générateur de données aléatoires pour les produits et sociétés - \version $Revision$ -*/ - -require("./pre.inc.php"); - -$langs->load("admin"); - -if (!$user->admin) - accessforbidden(); - -llxHeader(); - -$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); -if ($db->query($sql)) { - $num = $db->num_rows(); $i = 0; - while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } - -$sql = "SELECT idp FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; -while ($i < $num) { $row = $db->fetch_row($i); $societesid[$i] = $row[0]; $i++; } } else { print "err"; } - -$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) - ); - -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 = $_POST["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)); - -print $com->create($user) . " " . $com->date_commande; - - - - - -llxFooter(); -?> diff --git a/htdocs/admin/system/gendata.php b/htdocs/admin/system/gendata.php deleted file mode 100644 index 044aa66614c..00000000000 --- a/htdocs/admin/system/gendata.php +++ /dev/null @@ -1,268 +0,0 @@ - - * Copyright (C) 2004 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/*! \file htdocs/admin/system/gendata.php - \brief Page de génération de données aléatoires pour les commandes et expedition - \version $Revision$ -*/ - -require("./pre.inc.php"); - -$langs->load("admin"); - -$user->getrights('commande'); -$user->getrights('expedition'); - -if (!$user->admin) - accessforbidden(); - -llxHeader(); - -?> -

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
-
-query($sql)) { - $num = $db->num_rows(); $i = 0; - while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } - -$sql = "SELECT idp FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->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 ".MAIN_DB_PREFIX."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 ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ""; -print ""; -print '"; - -print '
SociétésProduitsFacturesCommandes
". sizeof($societesid) ."". sizeof($productsid) ."'; -print "". sizeof($commandesid) ."
'; -print "

"; - -if ($action == 'product') -{ - $randf = rand(1,200); - - print "Génère $randf produits
"; - for ($f = 0 ; $f < $randf ; $f++) - { - $produit = new Product($db); - $produit->type = 1; - $produit->envente = 1; - $produit->ref = time() . "$f"; - $produit->libelle = $langs->trans("Label"); - $produit->description = $langs->trans("Description"); - $produit->price = rand(1,10000); - $produit->tva_tx = "19.6"; - $produit->create($user); - } -} - -if ($action == 'facture') -{ - $randf = rand(1,2); - - print "Génère $randf factures
"; - for ($f = 0 ; $f < $randf ; $f++) - { - $facture = new Facture($db, $societesid[rand(1, sizeof($societesid)-1)]); - - $facture->number = time() . $f; - $datef = time()*2; - while($datef > time()) - $datef = mktime(12,0,0,rand(1,12),rand(1,31),rand(2002,2003)); - - $facture->date = $datef; - $facture->note = ''; - $facture->cond_reglement = 1; - $facture->remise_percent = rand(0,50); - - $prand = rand(1,200); - for ($p = 0 ; $p < $prand ; $p++) - { - $pidrand = rand(1, sizeof($productsid)-1); - $facture->add_product($productsid[rand(1, sizeof($productsid)-1)],rand(1,11)); - print "(AP ".$productsid[$pidrand].") "; - } - - $id = $facture->create($user); - if ($id) - { - print " - facture $id ok"; - $test = rand(0,1); - $test = 1; - if ($test > 0) - { - $facture->set_valid($id, $user); - print " - validée"; - } - - if($datef < (time() - (24*3600*30))) - { - $paiement = new Paiement($db); - $paiement->facid = $id; - $paiement->amount = $facture->total_ttc; - $paiement->paiementid = 1; - $paiement->datepaye = "now()"; - $paiement->create($user); - $facture->set_payed($id); - print " - payée"; - } - - print "
"; - } - - } -} - -if ($_GET["action"] == 'societe') -{ - - $rands = rand(1,400); - - print "Génère $rands société
"; - for ($s = 0 ; $s < $rands ; $s++) - { - print "- société $s
"; - $soc = new Societe($db); - $soc->nom = "Société aléatoire num ".time()."$s"; - $villes = array("Auray","Baden","Vannes","Pirouville","Haguenau","Souffelweiersheim","Illkirch-Graffenstaden","Lauterbourg","Picauville","Sainte-Mère Eglise","Le Bono"); - $soc->ville = $villes[rand(0,sizeof($villes)-1)]; - $soc->client = 1; - $socid = $soc->create(); - - if ($socid) - { - $rand = rand(1,4); - print "-- génère $rand contact
"; - for ($c = 0 ; $c < $rand ; $c++) - { - $contact = new Contact($db); - $contact->socid = $socid; - $contact->nom = "Nom aléa ".time()."-$c"; - if ( $contact->create($user) ) - { - - } - } - } - } -} - -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 = $_POST["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(); -?>