Fix: Test pour viter erreurs

This commit is contained in:
Laurent Destailleur 2005-12-09 23:31:03 +00:00
parent 64ee49be81
commit 22565a5cad

View File

@ -979,39 +979,43 @@ class Propal
}
}
/**
* \brief Renvoie un tableau contenant les commandes associées
* \remarks Fonction plus lourde que commande_liste_array
* \sa commande_liste_array
*/
function associated_orders ()
/**
* \brief Renvoie un tableau contenant les commandes associées
* \remarks Fonction plus lourde que commande_liste_array
* \sa commande_liste_array
*/
function associated_orders()
{
$ga = array();
$ga = array();
$sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr";
$sql.= " WHERE fk_propale = " . $this->id;
if ($this->db->query($sql) )
{
$nump = $this->db->num_rows();
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object();
$order=new Commande($this->db);
$sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr";
$sql .= " WHERE fk_propale = " . $this->id;
if ($this->db->query($sql) )
{
$nump = $this->db->num_rows();
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object();
$order=new Commande($this->db);
$order->fetch($obj->fk_commande);
$ga[$i] = $order;
$i++;
}
}
return $ga;
}
else
{
print $this->db->error();
}
if ($obj->fk_commande)
{
$order->fetch($obj->fk_commande);
$ga[$i] = $order;
}
$i++;
}
}
return $ga;
}
else
{
print $this->db->error();
}
}
/**