More simple specimen for test

This commit is contained in:
Laurent Destailleur 2014-02-08 12:58:27 +01:00
parent 59a25832bd
commit 70ab096b79

View File

@ -1010,21 +1010,14 @@ class Contact extends CommonObject
{ {
global $user,$langs; global $user,$langs;
// Charge tableau des id de societe socids // Get first id of existing company and save it into $socid
$socids = array(); $socid = 0;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe LIMIT 10"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe ORDER BY rowid LIMIT 1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num_socs = $this->db->num_rows($resql); $obj = $this->db->fetch_object($resql);
$i = 0; if ($obj) $socid=$obj->rowid;
while ($i < $num_socs)
{
$i++;
$row = $this->db->fetch_row($resql);
$socids[$i] = $row[0];
}
} }
// Initialise parameters // Initialise parameters
@ -1039,7 +1032,7 @@ class Contact extends CommonObject
$this->country_code = 'FR'; $this->country_code = 'FR';
$this->country = 'France'; $this->country = 'France';
$this->email = 'specimen@specimen.com'; $this->email = 'specimen@specimen.com';
$this->skype = 'tom.hanson'; $this->skype = 'tom.hanson';
$this->phone_pro = '0909090901'; $this->phone_pro = '0909090901';
$this->phone_perso = '0909090902'; $this->phone_perso = '0909090902';
@ -1049,8 +1042,7 @@ class Contact extends CommonObject
$this->note_public='This is a comment (public)'; $this->note_public='This is a comment (public)';
$this->note_private='This is a comment (private)'; $this->note_private='This is a comment (private)';
$socid = rand(1, $num_socs); $this->socid = $socid;
$this->socid = $socids[$socid];
$this->statut=1; $this->statut=1;
} }