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 * \brief Renvoie un tableau contenant les commandes associées
* \remarks Fonction plus lourde que commande_liste_array * \remarks Fonction plus lourde que commande_liste_array
* \sa commande_liste_array * \sa commande_liste_array
*/ */
function associated_orders () 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"; if ($obj->fk_commande)
$sql .= " WHERE fk_propale = " . $this->id; {
if ($this->db->query($sql) ) $order->fetch($obj->fk_commande);
{ $ga[$i] = $order;
$nump = $this->db->num_rows(); }
$i++;
if ($nump) }
{ }
$i = 0; return $ga;
while ($i < $nump) }
{ else
$obj = $this->db->fetch_object(); {
$order=new Commande($this->db); print $this->db->error();
$order->fetch($obj->fk_commande); }
$ga[$i] = $order;
$i++;
}
}
return $ga;
}
else
{
print $this->db->error();
}
} }
/** /**