diff --git a/dev/initdata/generate-facture.php b/dev/initdata/generate-facture.php index b3a8be318c3..72184d8bb5c 100644 --- a/dev/initdata/generate-facture.php +++ b/dev/initdata/generate-facture.php @@ -19,10 +19,10 @@ */ /** - \file htdocs/dev/generate-facture.php - \brief Script de generation de donnees aleatoires pour les factures - \version $Id$ -*/ + * \file htdocs/dev/generate-facture.php + * \brief Script de generation de donnees aleatoires pour les factures + * \version $Id$ + */ // Test si mode batch $sapi_type = php_sapi_name(); diff --git a/dev/initdata/generate-produit.php b/dev/initdata/generate-produit.php index dc0a0207000..9038afb960e 100644 --- a/dev/initdata/generate-produit.php +++ b/dev/initdata/generate-produit.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2010 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 @@ -19,11 +19,11 @@ * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ -/** - \file htdocs/dev/generate-produit.php - \brief Script de generation de donnees aleatoires pour les produits - \version $Id$ -*/ +/** + * \file htdocs/dev/generate-produit.php + * \brief Script de generation de donnees aleatoires pour les produits + * \version $Id$ + */ // Test si mode batch $sapi_type = php_sapi_name(); @@ -52,15 +52,15 @@ define (GEN_NUMBER_PRODUIT, 5); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); if ($db->query($sql)) { - $num = $db->num_rows(); $i = 0; + $num = $db->num_rows(); $i = 0; while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; +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; +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"; } diff --git a/dev/initdata/generate-propale.php b/dev/initdata/generate-propale.php index 994c681eea8..1b53f80c6ed 100644 --- a/dev/initdata/generate-propale.php +++ b/dev/initdata/generate-propale.php @@ -20,10 +20,10 @@ */ /** - \file htdocs/dev/generate-propale.php - \brief Script de generation de donnees aleatoires pour les propales - \version $Id$ -*/ + * \file htdocs/dev/generate-propale.php + * \brief Script de generation de donnees aleatoires pour les propales + * \version $Id$ + */ // Test si mode batch $sapi_type = php_sapi_name(); @@ -49,7 +49,7 @@ define (GEN_NUMBER_PROPAL, 5); $sql = "SELECT min(rowid) FROM ".MAIN_DB_PREFIX."user"; $resql = $db->query($sql); -if ($resql) +if ($resql) { $row = $db->fetch_row($resql); $user = new User($db, $row[0]); @@ -58,14 +58,14 @@ if ($resql) $socids = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE client=1"; $resql = $db->query($sql); -if ($resql) +if ($resql) { $num_socs = $db->num_rows($resql); $i = 0; while ($i < $num_socs) { $i++; - + $row = $db->fetch_row($resql); $socids[$i] = $row[0]; } @@ -74,14 +74,14 @@ if ($resql) $contids = array(); $sql = "SELECT rowid, fk_soc FROM ".MAIN_DB_PREFIX."socpeople"; $resql = $db->query($sql); -if ($resql) +if ($resql) { $num_conts = $db->num_rows($resql); $i = 0; while ($i < $num_conts) { $i++; - + $row = $db->fetch_row($resql); $contids[$row[1]][0] = $row[0]; // A ameliorer } @@ -90,14 +90,14 @@ if ($resql) $prodids = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE envente=1"; $resql = $db->query($sql); -if ($resql) +if ($resql) { $num_prods = $db->num_rows($resql); $i = 0; while ($i < $num_prods) { $i++; - + $row = $db->fetch_row($resql); $prodids[$i] = $row[0]; } @@ -106,9 +106,9 @@ if ($resql) $user->rights->propale->valider=1; -if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php")) +if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php"); } $i=0; @@ -118,23 +118,23 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $i++; $socid = rand(1, $num_socs); print "Proposal ".$i." for socid ".$socid; - + $soc = new Societe($db); - - + + $obj = $conf->global->PROPALE_ADDON; $modPropale = new $obj; $numpr = $modPropale->getNextValue($soc); - + $propal = new Propal($db, $socids[$socid]); - + $propal->ref = $numpr; $propal->contactid = $contids[$socids[$socid]][0]; $propal->datep = time(); $propal->cond_reglement_id = 3; $propal->mode_reglement_id = 3; $propal->author = $user->id; - + $result=$propal->create($user); if ($result >= 0) { diff --git a/dev/initdata/generate-societe.php b/dev/initdata/generate-societe.php index 7fa765f7d12..4164542f432 100644 --- a/dev/initdata/generate-societe.php +++ b/dev/initdata/generate-societe.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2007 Laurent Destailleur + * Copyright (C) 2006-2010 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 @@ -20,10 +20,10 @@ */ /** - \file htdocs/dev/generate-societe.php - \brief Script de generation de donnees aleatoires pour les societes - \version $Id$ -*/ + * \file htdocs/dev/generate-societe.php + * \brief Script de generation de donnees aleatoires pour les societes + * \version $Id$ + */ // Test si mode batch $sapi_type = php_sapi_name(); @@ -45,7 +45,7 @@ include_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $villes = array("Auray","Baden","Vannes","Pirouville","Haguenau","Souffelweiersheim","Illkirch-Graffenstaden","Lauterbourg","Picauville","Sainte-Mère Eglise","Le Bono"); $prenoms = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Dorothee","Saby","Brigitte","Karine","Jose-Anne","Celine","Virginie"); - + /* * Parametre */ @@ -55,15 +55,15 @@ 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; + $num = $db->num_rows(); $i = 0; while ($i < $num) { $row = $db->fetch_row($i); $productsid[$i] = $row[0]; $i++; } } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); -if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; +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; +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"; }