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
@ -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;
} }