mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
90 lines
3.0 KiB
PHP
90 lines
3.0 KiB
PHP
|
|
<?php
|
|||
|
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|||
|
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
|||
|
|
*
|
|||
|
|
* 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/dev/generate-societe.php
|
|||
|
|
\brief Page de g<EFBFBD>n<EFBFBD>ration de donn<EFBFBD>es al<EFBFBD>atoires pour les societes
|
|||
|
|
\version $Revision$
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
require ("../htdocs/master.inc.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/paiement.class.php");
|
|||
|
|
include_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
|||
|
|
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
* Parametre
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
define (GEN_NUMBER_SOCIETE, 10);
|
|||
|
|
|
|||
|
|
|
|||
|
|
$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"; }
|
|||
|
|
|
|||
|
|
$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 "G<EFBFBD>n<EFBFBD>re ".GEN_NUMBER_SOCIETE." soci<63>t<EFBFBD>s\n";
|
|||
|
|
for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
|||
|
|
{
|
|||
|
|
print "Soci<EFBFBD>t<EFBFBD> $s\n";
|
|||
|
|
$soc = new Societe($db);
|
|||
|
|
$soc->nom = "Soci<EFBFBD>t<EFBFBD> al<61>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<EFBFBD>re $rand contact<br>";
|
|||
|
|
for ($c = 0 ; $c < $rand ; $c++)
|
|||
|
|
{
|
|||
|
|
$contact = new Contact($db);
|
|||
|
|
$contact->socid = $socid;
|
|||
|
|
$contact->nom = "Nom al<61>a ".time()."-$c";
|
|||
|
|
if ( $contact->create($user) )
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
?>
|