This commit is contained in:
Regis Houssin 2006-05-30 19:04:30 +00:00
parent 27c019bece
commit 949df6831e
2 changed files with 32 additions and 35 deletions

View File

@ -555,29 +555,26 @@ class Expedition
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$ligne = new ExpeditionLigne(); $ligne = new ExpeditionLigne();
$obj = $this->db->fetch_object($resql);
$obj = $this->db->fetch_object($resql); $ligne->product_id = $obj->fk_product;
$ligne->qty_commande = $obj->qtycom;
$ligne->qty_expedition = $obj->qtyexp;
$ligne->description = stripslashes($obj->description);
$ligne->product_id = $obj->fk_product; $this->lignes[$i] = $ligne;
$ligne->qty_commande = $obj->qtycom; $i++;
$ligne->qty_expedition = $obj->qtyexp; }
$ligne->description = stripslashes($obj->description); $this->db->free($resql);
$this->lignes[$i] = $ligne;
$i++;
}
$this->db->free($resql);
} }
return $this->lignes; return $this->lignes;
} }
} }

View File

@ -172,29 +172,29 @@ class Livraison
function create_line($transaction, $commande_ligne_id, $qty) function create_line($transaction, $commande_ligne_id, $qty)
{ {
$error = 0; $error = 0;
$idprod = 0; $idprod = 0;
$j = 0; $j = 0;
while (($j < sizeof($this->commande->lignes)) && idprod == 0) while (($j < sizeof($this->commande->lignes)) && idprod == 0)
{ {
if ($this->commande->lignes[$j]->id == $commande_ligne_id) if ($this->commande->lignes[$j]->id == $commande_ligne_id)
{ {
$idprod = $this->commande->lignes[$j]->product_id; $idprod = $this->commande->lignes[$j]->product_id;
} }
$j++; $j++;
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."livraisondet (fk_livraison, fk_commande_ligne, qty)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."livraisondet (fk_livraison, fk_commande_ligne, qty)";
$sql .= " VALUES ($this->id,".$commande_ligne_id.",".$qty.")"; $sql .= " VALUES ($this->id,".$commande_ligne_id.",".$qty.")";
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
$error++; $error++;
} }
if ($error == 0 ) if ($error == 0 )
{ {
return 1; return 1;
} }
} }